1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +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

@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.315 2006/04/10 21:53:38 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.316 2006/04/25 14:09:15 momjian Exp $
*
*--------------------------------------------------------------------
*/
@@ -32,6 +32,7 @@
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "commands/async.h"
#include "commands/prepare.h"
#include "commands/variable.h"
#include "commands/vacuum.h"
#include "executor/executor.h"
@@ -53,6 +54,7 @@
#include "postmaster/bgwriter.h"
#include "postmaster/syslogger.h"
#include "postmaster/postmaster.h"
#include "storage/backendid.h"
#include "storage/bufmgr.h"
#include "storage/fd.h"
#include "storage/freespace.h"
@@ -61,11 +63,13 @@
#include "tcop/tcopprot.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/hsearch.h"
#include "utils/memutils.h"
#include "utils/pg_locale.h"
#include "utils/portal.h"
#include "utils/syscache.h"
#include "pgstat.h"
#ifndef PG_KRB_SRVTAB
#define PG_KRB_SRVTAB ""
#endif
@@ -4649,8 +4653,33 @@ GetPGVariableResultDesc(const char *name)
void
ResetPGVariable(const char *name)
{
char namespaceName[NAMEDATALEN];
Oid namespaceId;
if (pg_strcasecmp(name, "all") == 0)
/* resetting all GUC variables */
ResetAllOptions();
else if (pg_strcasecmp(name, "connection") == 0)
{
ResetAllOptions();
/* Clean temp-tables */
snprintf(namespaceName, sizeof(namespaceName), "pg_temp_%d",
MyBackendId);
namespaceId = GetSysCacheOid(NAMESPACENAME,
CStringGetDatum(namespaceName), 0, 0, 0);
RemoveTempRelations(namespaceId);
DropAllPreparedStatements();
Async_UnlistenAll();
/* Delete cursors, including WITH HOLD */
PortalHashTableDeleteAll();
if (IsTransactionBlock())
UserAbortTransactionBlock();
}
else
set_config_option(name,
NULL,