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

Add RESET CONNECTION, to reset all aspects of a session.

Hans-J?rgen Sch?nig
This commit is contained in:
Bruce Momjian
2006-04-25 14:09:21 +00:00
parent 11fbdf2f25
commit 6378fdd971
12 changed files with 128 additions and 20 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.85 2006/03/05 15:58:49 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.86 2006/04/25 14:09:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -402,6 +402,9 @@ DropDependentPortals(MemoryContext queryContext)
HASH_SEQ_STATUS status;
PortalHashEnt *hentry;
if (PortalHashTable == NULL)
return;
hash_seq_init(&status, PortalHashTable);
while ((hentry = (PortalHashEnt *) hash_seq_search(&status)) != NULL)
@@ -413,6 +416,30 @@ DropDependentPortals(MemoryContext queryContext)
}
}
/*
* Delete all WITH HOLD cursors, used by RESET CONNECTION
*/
void
PortalHashTableDeleteAll(void)
{
HASH_SEQ_STATUS status;
PortalHashEnt *hentry;
if (PortalHashTable == NULL)
return;
hash_seq_init(&status, PortalHashTable);
while ((hentry = (PortalHashEnt *) hash_seq_search(&status)) != NULL)
{
Portal portal = hentry->portal;
if ((portal->cursorOptions & CURSOR_OPT_HOLD) &&
portal->status != PORTAL_ACTIVE)
PortalDrop(portal, false);
}
}
/*
* Pre-commit processing for portals.