1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-29 23:43:17 +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

@@ -12,7 +12,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.100 2007/03/13 00:33:42 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.101 2007/04/12 06:53:48 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -452,6 +452,29 @@ PortalDrop(Portal portal, bool isTopCommit)
pfree(portal);
}
/*
* Delete all declared cursors.
*
* Used by commands: CLOSE ALL, RESET SESSION
*/
void
PortalHashTableDeleteAll(void)
{
HASH_SEQ_STATUS status;
PortalHashEnt *hentry;
if (PortalHashTable == NULL)
return;
hash_seq_init(&status, PortalHashTable);
while ((hentry = hash_seq_search(&status)) != NULL)
{
Portal portal = hentry->portal;
if (portal->status != PORTAL_ACTIVE)
PortalDrop(portal, false);
}
}
/*
* Pre-commit processing for portals.