mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-06 15:24:56 +08:00
Back out RESET CONNECTION until there is more discussion.
This commit is contained in:
parent
6378fdd971
commit
59d591e79a
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/reset.sgml,v 1.27 2006/04/25 14:09:06 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/reset.sgml,v 1.28 2006/04/25 14:11:51 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -11,8 +11,7 @@ PostgreSQL documentation
|
||||
|
||||
<refnamediv>
|
||||
<refname>RESET</refname>
|
||||
<refpurpose>restore the value of a run-time parameter to the default value,
|
||||
or reset all aspects of a session</refpurpose>
|
||||
<refpurpose>restore the value of a run-time parameter to the default value</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<indexterm zone="sql-reset">
|
||||
@ -23,7 +22,6 @@ PostgreSQL documentation
|
||||
<synopsis>
|
||||
RESET <replaceable class="PARAMETER">name</replaceable>
|
||||
RESET ALL
|
||||
RESET CONNECTION
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@ -81,20 +79,7 @@ SET <replaceable class="parameter">parameter</replaceable> TO DEFAULT
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>CONNECTION</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Reset the all aspects of a session, including runtime parameters,
|
||||
transaction status, temporary tables, <literal>WITH HOLD</literal>
|
||||
cursors, prepared statements, and <command>LISTEN</command>
|
||||
registrations.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.83 2006/04/25 14:09:08 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.84 2006/04/25 14:11:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -134,6 +134,7 @@ char *namespace_search_path = NULL;
|
||||
/* Local functions */
|
||||
static void recomputeNamespacePath(void);
|
||||
static void InitTempTableNamespace(void);
|
||||
static void RemoveTempRelations(Oid tempNamespaceId);
|
||||
static void RemoveTempRelationsCallback(int code, Datum arg);
|
||||
static void NamespaceCallback(Datum arg, Oid relid);
|
||||
|
||||
@ -1728,7 +1729,7 @@ AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
|
||||
* in order to clean out any relations that might have been created by
|
||||
* a crashed backend.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
RemoveTempRelations(Oid tempNamespaceId)
|
||||
{
|
||||
ObjectAddress object;
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.130 2006/04/25 14:09:10 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.131 2006/04/25 14:11:54 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -127,6 +127,7 @@ static bool unlistenExitRegistered = false;
|
||||
bool Trace_notify = false;
|
||||
|
||||
|
||||
static void Async_UnlistenAll(void);
|
||||
static void Async_UnlistenOnExit(int code, Datum arg);
|
||||
static void ProcessIncomingNotify(void);
|
||||
static void NotifyMyFrontEnd(char *relname, int32 listenerPID);
|
||||
@ -334,7 +335,7 @@ Async_Unlisten(const char *relname)
|
||||
*
|
||||
*--------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
static void
|
||||
Async_UnlistenAll(void)
|
||||
{
|
||||
Relation lRel;
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Copyright (c) 2002-2006, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.51 2006/04/25 14:09:11 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.52 2006/04/25 14:11:54 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -33,6 +33,7 @@
|
||||
#include "utils/hsearch.h"
|
||||
#include "utils/memutils.h"
|
||||
|
||||
|
||||
/*
|
||||
* The hash table in which prepared queries are stored. This is
|
||||
* per-backend: query plans are not shared between backends.
|
||||
@ -546,30 +547,6 @@ DeallocateQuery(DeallocateStmt *stmt)
|
||||
DropPreparedStatement(stmt->name, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove all prepared plans from the backend.
|
||||
*/
|
||||
void
|
||||
DropAllPreparedStatements(void)
|
||||
{
|
||||
PreparedStatement *prep_statement;
|
||||
HASH_SEQ_STATUS status;
|
||||
|
||||
if (!prepared_queries)
|
||||
return;
|
||||
|
||||
hash_seq_init(&status, prepared_queries);
|
||||
|
||||
while ((prep_statement = (PreparedStatement *) hash_seq_search(&status)))
|
||||
{
|
||||
DropDependentPortals(prep_statement->context);
|
||||
|
||||
/* Flush the context holding the subsidiary data */
|
||||
MemoryContextDelete(prep_statement->context);
|
||||
hash_search(prepared_queries, prep_statement->stmt_name, HASH_REMOVE, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal version of DEALLOCATE
|
||||
*
|
||||
|
@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.541 2006/04/25 14:09:12 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.542 2006/04/25 14:11:55 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@ -1244,12 +1244,6 @@ VariableResetStmt:
|
||||
n->name = $2;
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
| RESET CONNECTION
|
||||
{
|
||||
VariableResetStmt *n = makeNode(VariableResetStmt);
|
||||
n->name = "connection";
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
| RESET TIME ZONE
|
||||
{
|
||||
VariableResetStmt *n = makeNode(VariableResetStmt);
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.316 2006/04/25 14:09:15 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.317 2006/04/25 14:11:56 momjian Exp $
|
||||
*
|
||||
*--------------------------------------------------------------------
|
||||
*/
|
||||
@ -32,7 +32,6 @@
|
||||
#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"
|
||||
@ -54,7 +53,6 @@
|
||||
#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"
|
||||
@ -63,13 +61,11 @@
|
||||
#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
|
||||
@ -4653,33 +4649,8 @@ 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,
|
||||
|
@ -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.86 2006/04/25 14:09:16 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.87 2006/04/25 14:11:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -402,9 +402,6 @@ 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)
|
||||
@ -416,30 +413,6 @@ 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.
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/catalog/namespace.h,v 1.40 2006/04/25 14:09:16 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/catalog/namespace.h,v 1.41 2006/04/25 14:11:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -74,8 +74,6 @@ extern void PopSpecialNamespace(Oid namespaceId);
|
||||
extern Oid FindConversionByName(List *conname);
|
||||
extern Oid FindDefaultConversionProc(int4 for_encoding, int4 to_encoding);
|
||||
|
||||
extern void RemoveTempRelations(Oid tempNamespaceId);
|
||||
|
||||
/* initialization & transaction cleanup code */
|
||||
extern void InitializeSearchPath(void);
|
||||
extern void AtEOXact_Namespace(bool isCommit);
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/commands/async.h,v 1.32 2006/04/25 14:09:17 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/commands/async.h,v 1.33 2006/04/25 14:11:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -19,7 +19,6 @@ extern bool Trace_notify;
|
||||
extern void Async_Notify(const char *relname);
|
||||
extern void Async_Listen(const char *relname);
|
||||
extern void Async_Unlisten(const char *relname);
|
||||
extern void Async_UnlistenAll(void);
|
||||
|
||||
/* perform (or cancel) outbound notify processing at transaction commit */
|
||||
extern void AtCommit_Notify(void);
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 2002-2006, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/commands/prepare.h,v 1.19 2006/04/25 14:09:18 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/commands/prepare.h,v 1.20 2006/04/25 14:11:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -62,7 +62,6 @@ extern void StorePreparedStatement(const char *stmt_name,
|
||||
extern PreparedStatement *FetchPreparedStatement(const char *stmt_name,
|
||||
bool throwError);
|
||||
extern void DropPreparedStatement(const char *stmt_name, bool showError);
|
||||
extern void DropAllPreparedStatements(void);
|
||||
extern List *FetchPreparedStatementParams(const char *stmt_name);
|
||||
extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt);
|
||||
extern bool PreparedStatementReturnsTuples(PreparedStatement *stmt);
|
||||
|
@ -39,7 +39,7 @@
|
||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.60 2006/04/25 14:09:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.61 2006/04/25 14:11:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -200,7 +200,6 @@ extern void AtSubAbort_Portals(SubTransactionId mySubid,
|
||||
extern void AtSubCleanup_Portals(SubTransactionId mySubid);
|
||||
extern Portal CreatePortal(const char *name, bool allowDup, bool dupSilent);
|
||||
extern Portal CreateNewPortal(void);
|
||||
extern void PortalHashTableDeleteAll(void);
|
||||
extern void PortalDrop(Portal portal, bool isTopCommit);
|
||||
extern void DropDependentPortals(MemoryContext queryContext);
|
||||
extern Portal GetPortalByName(const char *name);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.322 2006/04/25 14:09:21 momjian Exp $ */
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.323 2006/04/25 14:11:59 momjian Exp $ */
|
||||
|
||||
/* Copyright comment */
|
||||
%{
|
||||
@ -1196,8 +1196,6 @@ VariableResetStmt: RESET var_name
|
||||
{ $$ = make_str("reset transaction isolation level"); }
|
||||
| RESET SESSION AUTHORIZATION
|
||||
{ $$ = make_str("reset session authorization"); }
|
||||
| RESET CONNECTION
|
||||
{ $$ = make_str("reset connection"); }
|
||||
| RESET ALL
|
||||
{ $$ = make_str("reset all"); }
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user