1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-26 01:22:12 +03:00

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.
This commit is contained in:
Neil Conway
2007-04-12 06:53:49 +00:00
parent e6e47f278d
commit d13e903bea
25 changed files with 479 additions and 38 deletions

View File

@ -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 */