diff options
Diffstat (limited to 'src/include/executor/executor.h')
-rw-r--r-- | src/include/executor/executor.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 30e2a82346f..d12e3f451d2 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -19,6 +19,7 @@ #include "nodes/lockoptions.h" #include "nodes/parsenodes.h" #include "utils/memutils.h" +#include "utils/plancache.h" /* @@ -72,7 +73,7 @@ /* Hook for plugins to get control in ExecutorStart() */ -typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags); +typedef bool (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags); extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook; /* Hook for plugins to get control in ExecutorRun() */ @@ -191,8 +192,11 @@ ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull) /* * prototypes from functions in execMain.c */ -extern void ExecutorStart(QueryDesc *queryDesc, int eflags); -extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags); +extern bool ExecutorStart(QueryDesc *queryDesc, int eflags); +extern void ExecutorStartCachedPlan(QueryDesc *queryDesc, int eflags, + CachedPlanSource *plansource, + int query_index); +extern bool standard_ExecutorStart(QueryDesc *queryDesc, int eflags); extern void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count); extern void standard_ExecutorRun(QueryDesc *queryDesc, @@ -255,6 +259,30 @@ extern void ExecEndNode(PlanState *node); extern void ExecShutdownNode(PlanState *node); extern void ExecSetTupleBound(int64 tuples_needed, PlanState *child_node); +/* + * Is the CachedPlan in es_cachedplan still valid? + * + * Called from InitPlan() because invalidation messages that affect the plan + * might be received after locks have been taken on runtime-prunable relations. + * The caller should take appropriate action if the plan has become invalid. + */ +static inline bool +ExecPlanStillValid(EState *estate) +{ + return estate->es_cachedplan == NULL ? true : + CachedPlanValid(estate->es_cachedplan); +} + +/* + * Locks are needed only if running a cached plan that might contain unlocked + * relations, such as a reused generic plan. + */ +static inline bool +ExecShouldLockRelations(EState *estate) +{ + return estate->es_cachedplan == NULL ? false : + CachedPlanRequiresLocking(estate->es_cachedplan); +} /* ---------------------------------------------------------------- * ExecProcNode |