1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

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
This commit is contained in:
Jan Wieck
2007-06-05 20:00:41 +00:00
parent f74426283d
commit 1120b99445
3 changed files with 12 additions and 19 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.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;