summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorBruce Momjian2006-04-25 14:09:21 +0000
committerBruce Momjian2006-04-25 14:09:21 +0000
commit6378fdd971eccc2ad4acd015b8e1baa27e0910a6 (patch)
treec89984eacac792568d6f3f811840c5d1c9795042 /src/backend/commands
parent11fbdf2f25fef011e884c4b92157c7b0aed9e8b2 (diff)
Add RESET CONNECTION, to reset all aspects of a session.
Hans-J?rgen Sch?nig
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/async.c5
-rw-r--r--src/backend/commands/prepare.c27
2 files changed, 27 insertions, 5 deletions
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c
index 0e2622ad13..508ba9eb5c 100644
--- a/src/backend/commands/async.c
+++ b/src/backend/commands/async.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.129 2006/03/05 15:58:23 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.130 2006/04/25 14:09:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -127,7 +127,6 @@ static bool unlistenExitRegistered = false;
bool Trace_notify = false;
-static void Async_UnlistenAll(void);
static void Async_UnlistenOnExit(int code, Datum arg);
static void ProcessIncomingNotify(void);
static void NotifyMyFrontEnd(char *relname, int32 listenerPID);
@@ -335,7 +334,7 @@ Async_Unlisten(const char *relname)
*
*--------------------------------------------------------------
*/
-static void
+void
Async_UnlistenAll(void)
{
Relation lRel;
diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c
index 0892ab9fbb..02f8d14c8c 100644
--- a/src/backend/commands/prepare.c
+++ b/src/backend/commands/prepare.c
@@ -10,7 +10,7 @@
* Copyright (c) 2002-2006, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.50 2006/04/22 01:25:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.51 2006/04/25 14:09:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,7 +33,6 @@
#include "utils/hsearch.h"
#include "utils/memutils.h"
-
/*
* The hash table in which prepared queries are stored. This is
* per-backend: query plans are not shared between backends.
@@ -548,6 +547,30 @@ DeallocateQuery(DeallocateStmt *stmt)
}
/*
+ * Remove all prepared plans from the backend.
+ */
+void
+DropAllPreparedStatements(void)
+{
+ PreparedStatement *prep_statement;
+ HASH_SEQ_STATUS status;
+
+ if (!prepared_queries)
+ return;
+
+ hash_seq_init(&status, prepared_queries);
+
+ while ((prep_statement = (PreparedStatement *) hash_seq_search(&status)))
+ {
+ DropDependentPortals(prep_statement->context);
+
+ /* Flush the context holding the subsidiary data */
+ MemoryContextDelete(prep_statement->context);
+ hash_search(prepared_queries, prep_statement->stmt_name, HASH_REMOVE, NULL);
+ }
+}
+
+/*
* Internal version of DEALLOCATE
*
* If showError is false, dropping a nonexistent statement is a no-op.