summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorJan Wieck <JanWieck@Yahoo.com>2007-06-05 20:00:41 +0000
committerJan Wieck <JanWieck@Yahoo.com>2007-06-05 20:00:41 +0000
commit1120b99445a90ceba27f49e5cf86293f0628d06a (patch)
tree59c3c2464aaa4baa017512463d4c46a0778f1bc6 /src/backend
parentf74426283d9a5d889c310e3844ef850622203d7e (diff)
downloadpostgresql-1120b99445a90ceba27f49e5cf86293f0628d06a.tar.gz
The session_replication_role actually can be changed at will during
a session regardless of the existence of cached plans. The plancache only needs to be invalidated so that rules affected by the new setting will be reflected in the new query plans. Jan
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/utils/cache/plancache.c13
-rw-r--r--src/backend/utils/misc/guc.c15
2 files changed, 11 insertions, 17 deletions
diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c
index 75810caa73..21aed6eadb 100644
--- a/src/backend/utils/cache/plancache.c
+++ b/src/backend/utils/cache/plancache.c
@@ -33,7 +33,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.9 2007/05/14 18:13:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.10 2007/06/05 20:00:41 wieck Exp $
*
*-------------------------------------------------------------------------
*/
@@ -944,14 +944,3 @@ InvalRelid(Oid relid, LOCKMODE lockmode, InvalRelidContext *context)
if (relid == context->inval_relid || context->inval_relid == InvalidOid)
context->plan->dead = true;
}
-
-
-/*
- * HaveCachedPlans
- * Check if the plancache has stored any plans at all.
- */
-bool
-HaveCachedPlans(void)
-{
- return (cached_plans_list != NIL);
-}
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index ec547a6670..3428d0a172 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.393 2007/06/03 17:07:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.394 2007/06/05 20:00:41 wieck Exp $
*
*--------------------------------------------------------------------
*/
@@ -6270,24 +6270,29 @@ assign_defaultxactisolevel(const char *newval, bool doit, GucSource source)
static const char *
assign_session_replication_role(const char *newval, bool doit, GucSource source)
{
- if (HaveCachedPlans())
- elog(ERROR, "session_replication_role cannot be changed "
- "after prepared plans have been cached");
-
if (pg_strcasecmp(newval, "origin") == 0)
{
if (doit)
+ {
+ ResetPlanCache();
SessionReplicationRole = SESSION_REPLICATION_ROLE_ORIGIN;
+ }
}
else if (pg_strcasecmp(newval, "replica") == 0)
{
if (doit)
+ {
+ ResetPlanCache();
SessionReplicationRole = SESSION_REPLICATION_ROLE_REPLICA;
+ }
}
else if (pg_strcasecmp(newval, "local") == 0)
{
if (doit)
+ {
+ ResetPlanCache();
SessionReplicationRole = SESSION_REPLICATION_ROLE_LOCAL;
+ }
}
else
return NULL;