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);
-}
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;
bool useResOwner);
extern void ReleaseCachedPlan(CachedPlan *plan, bool useResOwner);
extern TupleDesc PlanCacheComputeResultDesc(List *stmt_list);
-extern bool HaveCachedPlans(void);
extern void ResetPlanCache(void);