From d13e903beaecd45a3721e4c2a7f9ff842ce94a79 Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Thu, 12 Apr 2007 06:53:49 +0000 Subject: 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. --- src/backend/commands/portalcmds.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/backend/commands/portalcmds.c') diff --git a/src/backend/commands/portalcmds.c b/src/backend/commands/portalcmds.c index 98b200d2cff..d759ed4ac2d 100644 --- a/src/backend/commands/portalcmds.c +++ b/src/backend/commands/portalcmds.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.62 2007/03/13 00:33:39 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.63 2007/04/12 06:53:46 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -236,11 +236,18 @@ PerformPortalClose(const char *name) { Portal portal; + /* NULL means CLOSE ALL */ + if (name == NULL) + { + PortalHashTableDeleteAll(); + return; + } + /* * Disallow empty-string cursor name (conflicts with protocol-level * unnamed portal). */ - if (!name || name[0] == '\0') + if (name[0] == '\0') ereport(ERROR, (errcode(ERRCODE_INVALID_CURSOR_NAME), errmsg("invalid cursor name: must not be empty"))); -- cgit v1.2.3