65 #define EXEC_FLAG_EXPLAIN_ONLY 0x0001
66 #define EXEC_FLAG_EXPLAIN_GENERIC 0x0002
67 #define EXEC_FLAG_REWIND 0x0004
68 #define EXEC_FLAG_BACKWARD 0x0008
69 #define EXEC_FLAG_MARK 0x0010
70 #define EXEC_FLAG_SKIP_TRIGGERS 0x0020
71 #define EXEC_FLAG_WITH_NO_DATA 0x0040
96 bool ereport_on_violation);
126 const Oid *eqOperators,
127 const Oid *collations,
130 const Oid *eqOperators,
136 const Oid *eqfuncoids,
139 long nbuckets,
Size additionalsize,
145 const Oid *eqfuncoids,
148 long nbuckets,
Size additionalsize,
175 const char *attrName);
177 const char *attrName);
212 List *rteperminfos,
bool ereport_on_violation);
217 Index resultRelationIndex,
219 int instrument_options);
242 int epqParam,
List *resultRelations);
248 #define EvalPlanQualSetSlot(epqstate, slot) ((epqstate)->origslot = (slot))
291 bool doSort,
bool doHash,
bool nullcheck);
294 const Oid *hashfunc_oids,
295 const List *collations,
296 const List *hash_exprs,
298 uint32 init_value,
bool keep_nulls);
303 const Oid *eqfunctions,
304 const Oid *collations,
309 const Oid *eqfunctions,
310 const Oid *collations,
311 const List *param_exprs,
348 return state->evalfunc(
state, econtext, isNull);
367 retDatum =
state->evalfunc(
state, econtext, isNull);
533 #define do_text_output_oneline(tstate, str_to_emit) \
537 values_[0] = PointerGetDatum(cstring_to_text(str_to_emit)); \
538 isnull_[0] = false; \
539 do_tup_output(tstate, values_, isnull_); \
540 pfree(DatumGetPointer(values_[0])); \
555 #define ResetExprContext(econtext) \
556 MemoryContextReset((econtext)->ecxt_per_tuple_memory)
561 #define GetPerTupleExprContext(estate) \
562 ((estate)->es_per_tuple_exprcontext ? \
563 (estate)->es_per_tuple_exprcontext : \
564 MakePerTupleExprContext(estate))
566 #define GetPerTupleMemoryContext(estate) \
567 (GetPerTupleExprContext(estate)->ecxt_per_tuple_memory)
570 #define ResetPerTupleExprContext(estate) \
572 if ((estate)->es_per_tuple_exprcontext) \
573 ResetExprContext((estate)->es_per_tuple_exprcontext); \
645 bool *specConflict,
List *arbiterIndexes,
646 bool onlySummarizing);
651 List *arbiterIndexes);
656 EState *estate,
bool newIndex);
static Datum values[MAXATTR]
#define Assert(condition)
void(* ExprContextCallbackFunction)(Datum arg)
TupleTableSlot *(* ExecProcNodeMtd)(struct PlanState *pstate)
TupleDesc ExecGetResultType(PlanState *planstate)
bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode, TupleTableSlot *searchslot, TupleTableSlot *outslot)
bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid, LockTupleMode lockmode, TupleTableSlot *searchslot, TupleTableSlot *outslot)
LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo)
Bitmapset * ExecGetAllUpdatedCols(ResultRelInfo *relinfo, EState *estate)
ExprState * ExecBuildAggTrans(AggState *aggstate, struct AggStatePerPhaseData *phase, bool doSort, bool doHash, bool nullcheck)
void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation, List *mergeActions)
void ExecAssignScanProjectionInfoWithVarno(ScanState *node, int varno)
PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook
void ExecSimpleRelationDelete(ResultRelInfo *resultRelInfo, EState *estate, EPQState *epqstate, TupleTableSlot *searchslot)
void CheckSubscriptionRelkind(char relkind, const char *nspname, const char *relname)
void EvalPlanQualBegin(EPQState *epqstate)
TupleTableSlot * EvalPlanQual(EPQState *epqstate, Relation relation, Index rti, TupleTableSlot *inputslot)
TupleTableSlot * ExecGetTriggerOldSlot(EState *estate, ResultRelInfo *relInfo)
ExprState * ExecPrepareExpr(Expr *node, EState *estate)
StrategyNumber get_equal_strategy_number_for_am(Oid am)
PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook
void ReScanExprContext(ExprContext *econtext)
ExprContext * CreateWorkExprContext(EState *estate)
bool ExecPartitionCheck(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool emitError)
void do_tup_output(TupOutputState *tstate, const Datum *values, const bool *isnull)
void(* ExecutorRun_hook_type)(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
bool ExecCheck(ExprState *state, ExprContext *econtext)
JunkFilter * ExecInitJunkFilter(List *targetList, TupleTableSlot *slot)
const TupleTableSlotOps * ExecGetResultSlotOps(PlanState *planstate, bool *isfixed)
Bitmapset * ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate)
ExprState * ExecInitExprWithParams(Expr *node, ParamListInfo ext_params)
SetExprState * ExecInitTableFunctionResult(Expr *expr, ExprContext *econtext, PlanState *parent)
void execTuplesHashPrepare(int numCols, const Oid *eqOperators, Oid **eqFuncOids, FmgrInfo **hashFunctions)
void(* ExecutorFinish_hook_type)(QueryDesc *queryDesc)
Tuplestorestate * ExecMakeTableFunctionResult(SetExprState *setexpr, ExprContext *econtext, MemoryContext argContext, TupleDesc expectedDesc, bool randomAccess)
static RangeTblEntry * exec_rt_fetch(Index rti, EState *estate)
TupleTableSlot * EvalPlanQualNext(EPQState *epqstate)
TupleHashTable BuildTupleHashTable(PlanState *parent, TupleDesc inputDesc, int numCols, AttrNumber *keyColIdx, const Oid *eqfuncoids, FmgrInfo *hashfunctions, Oid *collations, long nbuckets, Size additionalsize, MemoryContext tablecxt, MemoryContext tempcxt, bool use_variable_hash_iv)
List * ExecInitExprList(List *nodes, PlanState *parent)
void ExecutorEnd(QueryDesc *queryDesc)
void EvalPlanQualInit(EPQState *epqstate, EState *parentestate, Plan *subplan, List *auxrowmarks, int epqParam, List *resultRelations)
void ExecInitRangeTable(EState *estate, List *rangeTable, List *permInfos)
TupleTableSlot * ExecGetReturningSlot(EState *estate, ResultRelInfo *relInfo)
TupleDesc ExecCleanTypeFromTL(List *targetList)
void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
int executor_errposition(EState *estate, int location)
ProjectionInfo * ExecBuildUpdateProjection(List *targetList, bool evalTargetList, List *targetColnos, TupleDesc relDesc, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent)
void ExecInitResultSlot(PlanState *planstate, const TupleTableSlotOps *tts_ops)
TupleTableSlot * ExecInitNullTupleSlot(EState *estate, TupleDesc tupType, const TupleTableSlotOps *tts_ops)
void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList)
TupleHashEntry LookupTupleHashEntryHash(TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew, uint32 hash)
bool ExecSupportsMarkRestore(struct Path *pathnode)
TupleTableSlot * ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno, bool *isNull)
void FreeExprContext(ExprContext *econtext, bool isCommit)
ExprState * ExecInitQual(List *qual, PlanState *parent)
AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, const char *attrName)
void ExecInitResultRelation(EState *estate, ResultRelInfo *resultRelInfo, Index rti)
void end_tup_output(TupOutputState *tstate)
TupleTableSlot * ExecGetUpdateNewTuple(ResultRelInfo *relinfo, TupleTableSlot *planSlot, TupleTableSlot *oldSlot)
void InitResultRelInfo(ResultRelInfo *resultRelInfo, Relation resultRelationDesc, Index resultRelationIndex, ResultRelInfo *partition_root_rri, int instrument_options)
void ExecMarkPos(PlanState *node)
ExprState * ExecPrepareCheck(List *qual, EState *estate)
ExecAuxRowMark * ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
static TupleTableSlot * ExecProject(ProjectionInfo *projInfo)
void ExecSetTupleBound(int64 tuples_needed, PlanState *child_node)
Datum ExecMakeFunctionResultSet(SetExprState *fcache, ExprContext *econtext, MemoryContext argContext, bool *isNull, ExprDoneCond *isDone)
void standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
ExprContext * CreateStandaloneExprContext(void)
void ExecCreateScanSlotFromOuterPlan(EState *estate, ScanState *scanstate, const TupleTableSlotOps *tts_ops)
void ExecutorFinish(QueryDesc *queryDesc)
EState * CreateExecutorState(void)
void ExecEndNode(PlanState *node)
ExprContext * CreateExprContext(EState *estate)
void ExecSimpleRelationUpdate(ResultRelInfo *resultRelInfo, EState *estate, EPQState *epqstate, TupleTableSlot *searchslot, TupleTableSlot *slot)
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew, uint32 *hash)
void EvalPlanQualEnd(EPQState *epqstate)
SetExprState * ExecInitFunctionResultSet(Expr *expr, ExprContext *econtext, PlanState *parent)
void ExecInitResultTypeTL(PlanState *planstate)
void EvalPlanQualSetPlan(EPQState *epqstate, Plan *subplan, List *auxrowmarks)
void CheckCmdReplicaIdentity(Relation rel, CmdType cmd)
void ExecSimpleRelationInsert(ResultRelInfo *resultRelInfo, EState *estate, TupleTableSlot *slot)
AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter, const char *attrName)
PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook
void ExecutorRewind(QueryDesc *queryDesc)
void do_text_output_multiline(TupOutputState *tstate, const char *txt)
void ExecShutdownNode(PlanState *node)
TupleTableSlot * ExecGetTriggerNewSlot(EState *estate, ResultRelInfo *relInfo)
void ExecAssignExprContext(EState *estate, PlanState *planstate)
void ExecutorStart(QueryDesc *queryDesc, int eflags)
Relation ExecGetRangeTableRelation(EState *estate, Index rti)
char * ExecBuildSlotValueDescription(Oid reloid, TupleTableSlot *slot, TupleDesc tupdesc, Bitmapset *modifiedCols, int maxfieldlen)
TupleTableSlot *(* ExecScanAccessMtd)(ScanState *node)
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
TupleTableSlot * ExecInitExtraTupleSlot(EState *estate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
void(* ExecutorStart_hook_type)(QueryDesc *queryDesc, int eflags)
static bool ExecQual(ExprState *state, ExprContext *econtext)
TupleTableSlot * ExecFilterJunk(JunkFilter *junkfilter, TupleTableSlot *slot)
void UnregisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg)
void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc)
bool(* ExecScanRecheckMtd)(ScanState *node, TupleTableSlot *slot)
bool(* ExecutorCheckPerms_hook_type)(List *rangeTable, List *rtePermInfos, bool ereport_on_violation)
ExprState * ExecInitExpr(Expr *node, PlanState *parent)
uint32 TupleHashTableHash(TupleHashTable hashtable, TupleTableSlot *slot)
void standard_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
bool EvalPlanQualFetchRowMark(EPQState *epqstate, Index rti, TupleTableSlot *slot)
void ExecConditionalAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc, int varno)
void(* ExecutorEnd_hook_type)(QueryDesc *queryDesc)
ResultRelInfo * ExecLookupResultRelByOid(ModifyTableState *node, Oid resultoid, bool missing_ok, bool update_cache)
Node * MultiExecProcNode(PlanState *node)
void ExecInitResultTupleSlotTL(PlanState *planstate, const TupleTableSlotOps *tts_ops)
ExprState * ExecInitCheck(List *qual, PlanState *parent)
void ExecCloseIndices(ResultRelInfo *resultRelInfo)
void RegisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg)
List * ExecInsertIndexTuples(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool update, bool noDupErr, bool *specConflict, List *arbiterIndexes, bool onlySummarizing)
static bool ExecQualAndReset(ExprState *state, ExprContext *econtext)
TupleConversionMap * ExecGetRootToChildMap(ResultRelInfo *resultRelInfo, EState *estate)
void ExecAssignScanProjectionInfo(ScanState *node)
int ExecTargetListLength(List *targetlist)
void FreeExecutorState(EState *estate)
struct TupOutputState TupOutputState
bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid)
void ExecCloseResultRelations(EState *estate)
ExprState * ExecPrepareQual(List *qual, EState *estate)
TupleConversionMap * ExecGetChildToRootMap(ResultRelInfo *resultRelInfo)
ExecRowMark * ExecFindRowMark(EState *estate, Index rti, bool missing_ok)
ProjectionInfo * ExecBuildProjectionInfo(List *targetList, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent, TupleDesc inputDesc)
bool ExecMaterializesOutput(NodeTag plantype)
List * ExecGetAncestorResultRels(EState *estate, ResultRelInfo *resultRelInfo)
void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative)
int ExecCleanTargetListLength(List *targetlist)
void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg)
void ExecScanReScan(ScanState *node)
bool ExecSupportsBackwardScan(Plan *node)
Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname, bool *isNull)
ExprState * ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, const TupleTableSlotOps *lops, const TupleTableSlotOps *rops, int numCols, const AttrNumber *keyColIdx, const Oid *eqfunctions, const Oid *collations, PlanState *parent)
PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook
bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, ItemPointer conflictTid, ItemPointer tupleid, List *arbiterIndexes)
TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, ExprState *eqcomp, FmgrInfo *hashfunctions)
void ExecReScan(PlanState *node)
TupleHashTable BuildTupleHashTableExt(PlanState *parent, TupleDesc inputDesc, int numCols, AttrNumber *keyColIdx, const Oid *eqfuncoids, FmgrInfo *hashfunctions, Oid *collations, long nbuckets, Size additionalsize, MemoryContext metacxt, MemoryContext tablecxt, MemoryContext tempcxt, bool use_variable_hash_iv)
TupOutputState * begin_tup_output_tupdesc(DestReceiver *dest, TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook
List * ExecPrepareExprList(List *nodes, EState *estate)
ExprContext * MakePerTupleExprContext(EState *estate)
TupleDesc ExecTypeFromExprList(List *exprList)
TupleDesc ExecTypeFromTL(List *targetList)
TupleTableSlot * EvalPlanQualSlot(EPQState *epqstate, Relation relation, Index rti)
static Datum ExecEvalExpr(ExprState *state, ExprContext *econtext, bool *isNull)
Bitmapset * ExecGetExtraUpdatedCols(ResultRelInfo *relinfo, EState *estate)
bool execCurrentOf(CurrentOfExpr *cexpr, ExprContext *econtext, Oid table_oid, ItemPointer current_tid)
void ResetTupleHashTable(TupleHashTable hashtable)
void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
ResultRelInfo * ExecGetTriggerResultRel(EState *estate, Oid relid, ResultRelInfo *rootRelInfo)
void standard_ExecutorEnd(QueryDesc *queryDesc)
ExprState * ExecBuildHash32Expr(TupleDesc desc, const TupleTableSlotOps *ops, const Oid *hashfunc_oids, const List *collations, const List *hash_exprs, const bool *opstrict, PlanState *parent, uint32 init_value, bool keep_nulls)
void ExecRestrPos(PlanState *node)
void ExecCloseRangeTableRelations(EState *estate)
static Datum ExecEvalExprSwitchContext(ExprState *state, ExprContext *econtext, bool *isNull)
void check_exclusion_constraint(Relation heap, Relation index, IndexInfo *indexInfo, ItemPointer tupleid, const Datum *values, const bool *isnull, EState *estate, bool newIndex)
ExprState * execTuplesMatchPrepare(TupleDesc desc, int numCols, const AttrNumber *keyColIdx, const Oid *eqOperators, const Oid *collations, PlanState *parent)
void ExecSetExecProcNode(PlanState *node, ExecProcNodeMtd function)
void ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
Bitmapset * ExecGetInsertedCols(ResultRelInfo *relinfo, EState *estate)
void ExecConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
JunkFilter * ExecInitJunkFilterConversion(List *targetList, TupleDesc cleanTupType, TupleTableSlot *slot)
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
bool ExecCheckPermissions(List *rangeTable, List *rteperminfos, bool ereport_on_violation)
static Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull)
Oid ExecGetResultRelCheckAsUser(ResultRelInfo *relInfo, EState *estate)
ExprState * ExecBuildParamSetEqual(TupleDesc desc, const TupleTableSlotOps *lops, const TupleTableSlotOps *rops, const Oid *eqfunctions, const Oid *collations, const List *param_exprs, PlanState *parent)
static TupleTableSlot * ExecProcNode(PlanState *node)
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
void standard_ExecutorFinish(QueryDesc *queryDesc)
void MemoryContextReset(MemoryContext context)
static void * list_nth(const List *list, int n)
static bool DatumGetBool(Datum X)
MemoryContextSwitchTo(old_ctx)
static unsigned hash(unsigned *uv, int n)
MemoryContext ecxt_per_tuple_memory
ExecProcNodeMtd ExecProcNode
ExprContext * pi_exprContext
TupleDesc tts_tupleDescriptor
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
static Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull)