diff options
author | Neil Conway <neilc@samurai.com> | 2007-04-12 06:53:49 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2007-04-12 06:53:49 +0000 |
commit | d13e903beaecd45a3721e4c2a7f9ff842ce94a79 (patch) | |
tree | 3ded6910c6f451bb982fb5033735afd24927c5b6 /src/backend/tcop/utility.c | |
parent | e6e47f278d2ab0fc744b56fed86cc34299079037 (diff) | |
download | postgresql-d13e903beaecd45a3721e4c2a7f9ff842ce94a79.tar.gz postgresql-d13e903beaecd45a3721e4c2a7f9ff842ce94a79.zip |
RESET SESSION, plus related new DDL commands. Patch from Marko Kreen,
reviewed by Neil Conway. This patch adds the following DDL command
variants: RESET SESSION, RESET TEMP, RESET PLANS, CLOSE ALL, and
DEALLOCATE ALL. RESET SESSION is intended for use by connection
pool software and the like, in order to reset a client session
to something close to its initial state.
Note that while most of these command variants can be executed
inside a transaction block (but are not transaction-aware!),
RESET SESSION cannot. While this is inconsistent, it is intended
to catch programmer mistakes: RESET SESSION in an open transaction
block is probably unintended.
Diffstat (limited to 'src/backend/tcop/utility.c')
-rw-r--r-- | src/backend/tcop/utility.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 864b6d1dd63..88adb625d55 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.276 2007/04/02 03:49:39 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.277 2007/04/12 06:53:47 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -990,7 +990,7 @@ ProcessUtility(Node *parsetree, { VariableResetStmt *n = (VariableResetStmt *) parsetree; - ResetPGVariable(n->name); + ResetPGVariable(n->name, isTopLevel); } break; @@ -1387,7 +1387,13 @@ CreateCommandTag(Node *parsetree) break; case T_ClosePortalStmt: - tag = "CLOSE CURSOR"; + { + ClosePortalStmt *stmt = (ClosePortalStmt *) parsetree; + if (stmt->portalname == NULL) + tag = "CLOSE CURSOR ALL"; + else + tag = "CLOSE CURSOR"; + } break; case T_FetchStmt: @@ -1746,7 +1752,13 @@ CreateCommandTag(Node *parsetree) break; case T_VariableResetStmt: - tag = "RESET"; + { + VariableResetStmt *stmt = (VariableResetStmt *) parsetree; + if (pg_strcasecmp(stmt->name, "session") == 0) + tag = "RESET SESSION"; + else + tag = "RESET"; + } break; case T_CreateTrigStmt: @@ -1856,7 +1868,13 @@ CreateCommandTag(Node *parsetree) break; case T_DeallocateStmt: - tag = "DEALLOCATE"; + { + DeallocateStmt *stmt = (DeallocateStmt *) parsetree; + if (stmt->name == NULL) + tag = "DEALLOCATE ALL"; + else + tag = "DEALLOCATE"; + } break; /* already-planned queries */ |