PostgreSQL Source Code  git master
executor.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * executor.h
4  * support for the POSTGRES executor module
5  *
6  *
7  * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/executor/executor.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef EXECUTOR_H
15 #define EXECUTOR_H
16 
17 #include "catalog/partition.h"
18 #include "executor/execdesc.h"
19 #include "nodes/parsenodes.h"
20 #include "utils/memutils.h"
21 
22 
23 /*
24  * The "eflags" argument to ExecutorStart and the various ExecInitNode
25  * routines is a bitwise OR of the following flag bits, which tell the
26  * called plan node what to expect. Note that the flags will get modified
27  * as they are passed down the plan tree, since an upper node may require
28  * functionality in its subnode not demanded of the plan as a whole
29  * (example: MergeJoin requires mark/restore capability in its inner input),
30  * or an upper node may shield its input from some functionality requirement
31  * (example: Materialize shields its input from needing to do backward scan).
32  *
33  * EXPLAIN_ONLY indicates that the plan tree is being initialized just so
34  * EXPLAIN can print it out; it will not be run. Hence, no side-effects
35  * of startup should occur. However, error checks (such as permission checks)
36  * should be performed.
37  *
38  * REWIND indicates that the plan node should try to efficiently support
39  * rescans without parameter changes. (Nodes must support ExecReScan calls
40  * in any case, but if this flag was not given, they are at liberty to do it
41  * through complete recalculation. Note that a parameter change forces a
42  * full recalculation in any case.)
43  *
44  * BACKWARD indicates that the plan node must respect the es_direction flag.
45  * When this is not passed, the plan node will only be run forwards.
46  *
47  * MARK indicates that the plan node must support Mark/Restore calls.
48  * When this is not passed, no Mark/Restore will occur.
49  *
50  * SKIP_TRIGGERS tells ExecutorStart/ExecutorFinish to skip calling
51  * AfterTriggerBeginQuery/AfterTriggerEndQuery. This does not necessarily
52  * mean that the plan can't queue any AFTER triggers; just that the caller
53  * is responsible for there being a trigger context for them to be queued in.
54  *
55  * WITH/WITHOUT_OIDS tell the executor to emit tuples with or without space
56  * for OIDs, respectively. These are currently used only for CREATE TABLE AS.
57  * If neither is set, the plan may or may not produce tuples including OIDs.
58  */
59 #define EXEC_FLAG_EXPLAIN_ONLY 0x0001 /* EXPLAIN, no ANALYZE */
60 #define EXEC_FLAG_REWIND 0x0002 /* need efficient rescan */
61 #define EXEC_FLAG_BACKWARD 0x0004 /* need backward scan */
62 #define EXEC_FLAG_MARK 0x0008 /* need mark/restore */
63 #define EXEC_FLAG_SKIP_TRIGGERS 0x0010 /* skip AfterTrigger calls */
64 #define EXEC_FLAG_WITH_OIDS 0x0020 /* force OIDs in returned tuples */
65 #define EXEC_FLAG_WITHOUT_OIDS 0x0040 /* force no OIDs in returned tuples */
66 #define EXEC_FLAG_WITH_NO_DATA 0x0080 /* rel scannability doesn't matter */
67 
68 
69 /* Hook for plugins to get control in ExecutorStart() */
70 typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags);
72 
73 /* Hook for plugins to get control in ExecutorRun() */
74 typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc,
75  ScanDirection direction,
76  uint64 count,
77  bool execute_once);
79 
80 /* Hook for plugins to get control in ExecutorFinish() */
81 typedef void (*ExecutorFinish_hook_type) (QueryDesc *queryDesc);
83 
84 /* Hook for plugins to get control in ExecutorEnd() */
85 typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc);
87 
88 /* Hook for plugins to get control in ExecCheckRTPerms() */
91 
92 
93 /*
94  * prototypes from functions in execAmi.c
95  */
96 struct Path; /* avoid including relation.h here */
97 
98 extern void ExecReScan(PlanState *node);
99 extern void ExecMarkPos(PlanState *node);
100 extern void ExecRestrPos(PlanState *node);
101 extern bool ExecSupportsMarkRestore(struct Path *pathnode);
102 extern bool ExecSupportsBackwardScan(Plan *node);
103 extern bool ExecMaterializesOutput(NodeTag plantype);
104 
105 /*
106  * prototypes from functions in execCurrent.c
107  */
108 extern bool execCurrentOf(CurrentOfExpr *cexpr,
109  ExprContext *econtext,
110  Oid table_oid,
111  ItemPointer current_tid);
112 
113 /*
114  * prototypes from functions in execGrouping.c
115  */
117  int numCols,
118  AttrNumber *keyColIdx,
119  Oid *eqOperators,
120  PlanState *parent);
121 extern void execTuplesHashPrepare(int numCols,
122  Oid *eqOperators,
123  Oid **eqFuncOids,
124  FmgrInfo **hashFunctions);
126  TupleDesc inputDesc,
127  int numCols, AttrNumber *keyColIdx,
128  Oid *eqfuncoids,
129  FmgrInfo *hashfunctions,
130  long nbuckets, Size additionalsize,
131  MemoryContext tablecxt,
132  MemoryContext tempcxt, bool use_variable_hash_iv);
134  TupleTableSlot *slot,
135  bool *isnew);
137  TupleTableSlot *slot,
138  ExprState *eqcomp,
139  FmgrInfo *hashfunctions);
140 
141 /*
142  * prototypes from functions in execJunk.c
143  */
144 extern JunkFilter *ExecInitJunkFilter(List *targetList, bool hasoid,
145  TupleTableSlot *slot);
146 extern JunkFilter *ExecInitJunkFilterConversion(List *targetList,
147  TupleDesc cleanTupType,
148  TupleTableSlot *slot);
149 extern AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter,
150  const char *attrName);
151 extern AttrNumber ExecFindJunkAttributeInTlist(List *targetlist,
152  const char *attrName);
154  bool *isNull);
155 extern TupleTableSlot *ExecFilterJunk(JunkFilter *junkfilter,
156  TupleTableSlot *slot);
157 
158 
159 /*
160  * prototypes from functions in execMain.c
161  */
162 extern void ExecutorStart(QueryDesc *queryDesc, int eflags);
163 extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags);
164 extern void ExecutorRun(QueryDesc *queryDesc,
165  ScanDirection direction, uint64 count, bool execute_once);
166 extern void standard_ExecutorRun(QueryDesc *queryDesc,
167  ScanDirection direction, uint64 count, bool execute_once);
168 extern void ExecutorFinish(QueryDesc *queryDesc);
169 extern void standard_ExecutorFinish(QueryDesc *queryDesc);
170 extern void ExecutorEnd(QueryDesc *queryDesc);
171 extern void standard_ExecutorEnd(QueryDesc *queryDesc);
172 extern void ExecutorRewind(QueryDesc *queryDesc);
173 extern bool ExecCheckRTPerms(List *rangeTable, bool ereport_on_violation);
174 extern void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation);
175 extern void InitResultRelInfo(ResultRelInfo *resultRelInfo,
176  Relation resultRelationDesc,
177  Index resultRelationIndex,
178  Relation partition_root,
179  int instrument_options);
180 extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid);
181 extern void ExecCleanUpTriggerState(EState *estate);
182 extern bool ExecContextForcesOids(PlanState *planstate, bool *hasoids);
183 extern void ExecConstraints(ResultRelInfo *resultRelInfo,
184  TupleTableSlot *slot, EState *estate,
185  bool check_partition_constraint);
186 extern bool ExecPartitionCheck(ResultRelInfo *resultRelInfo,
187  TupleTableSlot *slot, EState *estate);
188 extern void ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo,
189  TupleTableSlot *slot, EState *estate);
190 extern void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo,
191  TupleTableSlot *slot, EState *estate);
192 extern LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo);
193 extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti, bool missing_ok);
194 extern ExecAuxRowMark *ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist);
195 extern TupleTableSlot *EvalPlanQual(EState *estate, EPQState *epqstate,
196  Relation relation, Index rti, int lockmode,
197  ItemPointer tid, TransactionId priorXmax);
198 extern HeapTuple EvalPlanQualFetch(EState *estate, Relation relation,
199  int lockmode, LockWaitPolicy wait_policy, ItemPointer tid,
200  TransactionId priorXmax);
201 extern void EvalPlanQualInit(EPQState *epqstate, EState *estate,
202  Plan *subplan, List *auxrowmarks, int epqParam);
203 extern void EvalPlanQualSetPlan(EPQState *epqstate,
204  Plan *subplan, List *auxrowmarks);
205 extern void EvalPlanQualSetTuple(EPQState *epqstate, Index rti,
206  HeapTuple tuple);
207 extern HeapTuple EvalPlanQualGetTuple(EPQState *epqstate, Index rti);
208 
209 #define EvalPlanQualSetSlot(epqstate, slot) ((epqstate)->origslot = (slot))
210 extern void EvalPlanQualFetchRowMarks(EPQState *epqstate);
211 extern TupleTableSlot *EvalPlanQualNext(EPQState *epqstate);
212 extern void EvalPlanQualBegin(EPQState *epqstate, EState *parentestate);
213 extern void EvalPlanQualEnd(EPQState *epqstate);
214 
215 /*
216  * functions in execProcnode.c
217  */
218 extern PlanState *ExecInitNode(Plan *node, EState *estate, int eflags);
219 extern void ExecSetExecProcNode(PlanState *node, ExecProcNodeMtd function);
220 extern Node *MultiExecProcNode(PlanState *node);
221 extern void ExecEndNode(PlanState *node);
222 extern bool ExecShutdownNode(PlanState *node);
223 extern void ExecSetTupleBound(int64 tuples_needed, PlanState *child_node);
224 
225 
226 /* ----------------------------------------------------------------
227  * ExecProcNode
228  *
229  * Execute the given node to return a(nother) tuple.
230  * ----------------------------------------------------------------
231  */
232 #ifndef FRONTEND
233 static inline TupleTableSlot *
235 {
236  if (node->chgParam != NULL) /* something changed? */
237  ExecReScan(node); /* let ReScan handle this */
238 
239  return node->ExecProcNode(node);
240 }
241 #endif
242 
243 /*
244  * prototypes from functions in execExpr.c
245  */
246 extern ExprState *ExecInitExpr(Expr *node, PlanState *parent);
247 extern ExprState *ExecInitExprWithParams(Expr *node, ParamListInfo ext_params);
248 extern ExprState *ExecInitQual(List *qual, PlanState *parent);
249 extern ExprState *ExecInitCheck(List *qual, PlanState *parent);
250 extern List *ExecInitExprList(List *nodes, PlanState *parent);
251 extern ExprState *ExecBuildAggTrans(AggState *aggstate, struct AggStatePerPhaseData *phase,
252  bool doSort, bool doHash);
254  int numCols,
255  AttrNumber *keyColIdx,
256  Oid *eqfunctions,
257  PlanState *parent);
258 extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,
259  ExprContext *econtext,
260  TupleTableSlot *slot,
261  PlanState *parent,
262  TupleDesc inputDesc);
263 extern ExprState *ExecPrepareExpr(Expr *node, EState *estate);
264 extern ExprState *ExecPrepareQual(List *qual, EState *estate);
265 extern ExprState *ExecPrepareCheck(List *qual, EState *estate);
266 extern List *ExecPrepareExprList(List *nodes, EState *estate);
267 
268 /*
269  * ExecEvalExpr
270  *
271  * Evaluate expression identified by "state" in the execution context
272  * given by "econtext". *isNull is set to the is-null flag for the result,
273  * and the Datum value is the function result.
274  *
275  * The caller should already have switched into the temporary memory
276  * context econtext->ecxt_per_tuple_memory. The convenience entry point
277  * ExecEvalExprSwitchContext() is provided for callers who don't prefer to
278  * do the switch in an outer loop.
279  */
280 #ifndef FRONTEND
281 static inline Datum
283  ExprContext *econtext,
284  bool *isNull)
285 {
286  return state->evalfunc(state, econtext, isNull);
287 }
288 #endif
289 
290 /*
291  * ExecEvalExprSwitchContext
292  *
293  * Same as ExecEvalExpr, but get into the right allocation context explicitly.
294  */
295 #ifndef FRONTEND
296 static inline Datum
298  ExprContext *econtext,
299  bool *isNull)
300 {
301  Datum retDatum;
302  MemoryContext oldContext;
303 
304  oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
305  retDatum = state->evalfunc(state, econtext, isNull);
306  MemoryContextSwitchTo(oldContext);
307  return retDatum;
308 }
309 #endif
310 
311 /*
312  * ExecProject
313  *
314  * Projects a tuple based on projection info and stores it in the slot passed
315  * to ExecBuildProjectInfo().
316  *
317  * Note: the result is always a virtual tuple; therefore it may reference
318  * the contents of the exprContext's scan tuples and/or temporary results
319  * constructed in the exprContext. If the caller wishes the result to be
320  * valid longer than that data will be valid, he must call ExecMaterializeSlot
321  * on the result slot.
322  */
323 #ifndef FRONTEND
324 static inline TupleTableSlot *
326 {
327  ExprContext *econtext = projInfo->pi_exprContext;
328  ExprState *state = &projInfo->pi_state;
329  TupleTableSlot *slot = state->resultslot;
330  bool isnull;
331 
332  /*
333  * Clear any former contents of the result slot. This makes it safe for
334  * us to use the slot's Datum/isnull arrays as workspace.
335  */
336  ExecClearTuple(slot);
337 
338  /* Run the expression, discarding scalar result from the last column. */
339  (void) ExecEvalExprSwitchContext(state, econtext, &isnull);
340 
341  /*
342  * Successfully formed a result row. Mark the result slot as containing a
343  * valid virtual tuple (inlined version of ExecStoreVirtualTuple()).
344  */
345  slot->tts_isempty = false;
346  slot->tts_nvalid = slot->tts_tupleDescriptor->natts;
347 
348  return slot;
349 }
350 #endif
351 
352 /*
353  * ExecQual - evaluate a qual prepared with ExecInitQual (possibly via
354  * ExecPrepareQual). Returns true if qual is satisfied, else false.
355  *
356  * Note: ExecQual used to have a third argument "resultForNull". The
357  * behavior of this function now corresponds to resultForNull == false.
358  * If you want the resultForNull == true behavior, see ExecCheck.
359  */
360 #ifndef FRONTEND
361 static inline bool
363 {
364  Datum ret;
365  bool isnull;
366 
367  /* short-circuit (here and in ExecInitQual) for empty restriction list */
368  if (state == NULL)
369  return true;
370 
371  /* verify that expression was compiled using ExecInitQual */
372  Assert(state->flags & EEO_FLAG_IS_QUAL);
373 
374  ret = ExecEvalExprSwitchContext(state, econtext, &isnull);
375 
376  /* EEOP_QUAL should never return NULL */
377  Assert(!isnull);
378 
379  return DatumGetBool(ret);
380 }
381 #endif
382 
383 /*
384  * ExecQualAndReset() - evaluate qual with ExecQual() and reset expression
385  * context.
386  */
387 #ifndef FRONTEND
388 static inline bool
390 {
391  bool ret = ExecQual(state, econtext);
392 
393  /* inline ResetExprContext, to avoid ordering issue in this file */
395  return ret;
396 }
397 #endif
398 
399 extern bool ExecCheck(ExprState *state, ExprContext *context);
400 
401 /*
402  * prototypes from functions in execSRF.c
403  */
405  ExprContext *econtext, PlanState *parent);
407  ExprContext *econtext,
408  MemoryContext argContext,
409  TupleDesc expectedDesc,
410  bool randomAccess);
412  ExprContext *econtext, PlanState *parent);
414  ExprContext *econtext,
415  MemoryContext argContext,
416  bool *isNull,
417  ExprDoneCond *isDone);
418 
419 /*
420  * prototypes from functions in execScan.c
421  */
422 typedef TupleTableSlot *(*ExecScanAccessMtd) (ScanState *node);
424 
425 extern TupleTableSlot *ExecScan(ScanState *node, ExecScanAccessMtd accessMtd,
426  ExecScanRecheckMtd recheckMtd);
427 extern void ExecAssignScanProjectionInfo(ScanState *node);
428 extern void ExecAssignScanProjectionInfoWithVarno(ScanState *node, Index varno);
429 extern void ExecScanReScan(ScanState *node);
430 
431 /*
432  * prototypes from functions in execTuples.c
433  */
434 extern void ExecInitResultTupleSlotTL(EState *estate, PlanState *planstate);
435 extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupleDesc);
439  TupleDesc tupType);
440 extern TupleDesc ExecTypeFromTL(List *targetList, bool hasoid);
441 extern TupleDesc ExecCleanTypeFromTL(List *targetList, bool hasoid);
442 extern TupleDesc ExecTypeFromExprList(List *exprList);
443 extern void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList);
444 extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg);
445 
446 typedef struct TupOutputState
447 {
451 
453  TupleDesc tupdesc);
454 extern void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull);
455 extern void do_text_output_multiline(TupOutputState *tstate, const char *txt);
456 extern void end_tup_output(TupOutputState *tstate);
457 
458 /*
459  * Write a single line of text given as a C string.
460  *
461  * Should only be used with a single-TEXT-attribute tupdesc.
462  */
463 #define do_text_output_oneline(tstate, str_to_emit) \
464  do { \
465  Datum values_[1]; \
466  bool isnull_[1]; \
467  values_[0] = PointerGetDatum(cstring_to_text(str_to_emit)); \
468  isnull_[0] = false; \
469  do_tup_output(tstate, values_, isnull_); \
470  pfree(DatumGetPointer(values_[0])); \
471  } while (0)
472 
473 
474 /*
475  * prototypes from functions in execUtils.c
476  */
477 extern EState *CreateExecutorState(void);
478 extern void FreeExecutorState(EState *estate);
479 extern ExprContext *CreateExprContext(EState *estate);
481 extern void FreeExprContext(ExprContext *econtext, bool isCommit);
482 extern void ReScanExprContext(ExprContext *econtext);
483 
484 #define ResetExprContext(econtext) \
485  MemoryContextReset((econtext)->ecxt_per_tuple_memory)
486 
488 
489 /* Get an EState's per-output-tuple exprcontext, making it if first use */
490 #define GetPerTupleExprContext(estate) \
491  ((estate)->es_per_tuple_exprcontext ? \
492  (estate)->es_per_tuple_exprcontext : \
493  MakePerTupleExprContext(estate))
494 
495 #define GetPerTupleMemoryContext(estate) \
496  (GetPerTupleExprContext(estate)->ecxt_per_tuple_memory)
497 
498 /* Reset an EState's per-output-tuple exprcontext, if one's been created */
499 #define ResetPerTupleExprContext(estate) \
500  do { \
501  if ((estate)->es_per_tuple_exprcontext) \
502  ResetExprContext((estate)->es_per_tuple_exprcontext); \
503  } while (0)
504 
505 extern void ExecAssignExprContext(EState *estate, PlanState *planstate);
506 extern TupleDesc ExecGetResultType(PlanState *planstate);
507 extern void ExecAssignProjectionInfo(PlanState *planstate,
508  TupleDesc inputDesc);
509 extern void ExecConditionalAssignProjectionInfo(PlanState *planstate,
510  TupleDesc inputDesc, Index varno);
511 extern void ExecFreeExprContext(PlanState *planstate);
512 extern void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc);
513 extern void ExecCreateScanSlotFromOuterPlan(EState *estate, ScanState *scanstate);
514 
515 extern bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid);
516 
517 extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags);
518 extern void ExecCloseScanRelation(Relation scanrel);
519 
520 extern int executor_errposition(EState *estate, int location);
521 
522 extern void RegisterExprContextCallback(ExprContext *econtext,
524  Datum arg);
525 extern void UnregisterExprContextCallback(ExprContext *econtext,
527  Datum arg);
528 
529 extern void ExecLockNonLeafAppendTables(List *partitioned_rels, EState *estate);
530 
531 extern Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname,
532  bool *isNull);
534  bool *isNull);
535 
536 extern int ExecTargetListLength(List *targetlist);
537 extern int ExecCleanTargetListLength(List *targetlist);
538 
539 /*
540  * prototypes from functions in execIndexing.c
541  */
542 extern void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative);
543 extern void ExecCloseIndices(ResultRelInfo *resultRelInfo);
545  EState *estate, bool noDupErr, bool *specConflict,
546  List *arbiterIndexes);
547 extern bool ExecCheckIndexConstraints(TupleTableSlot *slot, EState *estate,
548  ItemPointer conflictTid, List *arbiterIndexes);
550  IndexInfo *indexInfo,
551  ItemPointer tupleid,
552  Datum *values, bool *isnull,
553  EState *estate, bool newIndex);
554 
555 /*
556  * prototypes from functions in execReplication.c
557  */
558 extern bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid,
559  LockTupleMode lockmode,
560  TupleTableSlot *searchslot,
561  TupleTableSlot *outslot);
562 extern bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode,
563  TupleTableSlot *searchslot, TupleTableSlot *outslot);
564 
565 extern void ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot);
566 extern void ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate,
567  TupleTableSlot *searchslot, TupleTableSlot *slot);
568 extern void ExecSimpleRelationDelete(EState *estate, EPQState *epqstate,
569  TupleTableSlot *searchslot);
570 extern void CheckCmdReplicaIdentity(Relation rel, CmdType cmd);
571 
572 extern void CheckSubscriptionRelkind(char relkind, const char *nspname,
573  const char *relname);
574 
575 #endif /* EXECUTOR_H */
bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid)
Definition: execUtils.c:612
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:638
TupleDesc ExecGetResultType(PlanState *planstate)
Definition: execUtils.c:435
LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo)
Definition: execMain.c:2375
void(* ExecutorRun_hook_type)(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
Definition: executor.h:74
Definition: fmgr.h:56
bool ExecCheckIndexConstraints(TupleTableSlot *slot, EState *estate, ItemPointer conflictTid, List *arbiterIndexes)
Definition: execIndexing.c:475
void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
Definition: execMain.c:2091
ProjectionInfo * ExecBuildProjectionInfo(List *targetList, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent, TupleDesc inputDesc)
Definition: execExpr.c:348
bool ExecSupportsBackwardScan(Plan *node)
Definition: execAmi.c:462
bool tts_isempty
Definition: tuptable.h:116
ResultRelInfo * ExecGetTriggerResultRel(EState *estate, Oid relid)
Definition: execMain.c:1388
ExprContext * CreateExprContext(EState *estate)
Definition: execUtils.c:225
static Datum ExecEvalExprSwitchContext(ExprState *state, ExprContext *econtext, bool *isNull)
Definition: executor.h:297
TupOutputState * begin_tup_output_tupdesc(DestReceiver *dest, TupleDesc tupdesc)
Definition: execTuples.c:1291
ExprState * ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, int numCols, AttrNumber *keyColIdx, Oid *eqfunctions, PlanState *parent)
Definition: execExpr.c:3209
ExecRowMark * ExecFindRowMark(EState *estate, Index rti, bool missing_ok)
Definition: execMain.c:2401
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:204
void CheckSubscriptionRelkind(char relkind, const char *nspname, const char *relname)
ExecAuxRowMark * ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
Definition: execMain.c:2425
void ExecInitResultTupleSlotTL(EState *estate, PlanState *planstate)
Definition: execTuples.c:870
ExprState * ExecInitExprWithParams(Expr *node, ParamListInfo ext_params)
Definition: execExpr.c:155
uint32 TransactionId
Definition: c.h:463
void ExecScanReScan(ScanState *node)
Definition: execScan.c:262
void ExecConditionalAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc, Index varno)
Definition: execUtils.c:473
AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter, const char *attrName)
Definition: execJunk.c:209
void standard_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
Definition: execMain.c:308
Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno, bool *isNull)
Definition: execUtils.c:983
MemoryContext ecxt_per_tuple_memory
Definition: execnodes.h:217
void UnregisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg)
Definition: execUtils.c:793
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:475
void standard_ExecutorFinish(QueryDesc *queryDesc)
Definition: execMain.c:408
void ExecCloseIndices(ResultRelInfo *resultRelInfo)
Definition: execIndexing.c:224
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, ExprState *eqcomp, FmgrInfo *hashfunctions)
Definition: execGrouping.c:291
Node * MultiExecProcNode(PlanState *node)
Definition: execProcnode.c:484
Definition: nodes.h:513
int ExecCleanTargetListLength(List *targetlist)
Definition: execUtils.c:1044
ExprState * execTuplesMatchPrepare(TupleDesc desc, int numCols, AttrNumber *keyColIdx, Oid *eqOperators, PlanState *parent)
Definition: execGrouping.c:60
TupleDesc ExecCleanTypeFromTL(List *targetList, bool hasoid)
Definition: execTuples.c:956
void ExecRestrPos(PlanState *node)
Definition: execAmi.c:363
int executor_errposition(EState *estate, int location)
Definition: execUtils.c:740
void(* ExecutorFinish_hook_type)(QueryDesc *queryDesc)
Definition: executor.h:81
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:235
void MemoryContextReset(MemoryContext context)
Definition: mcxt.c:134
void ExecSimpleRelationDelete(EState *estate, EPQState *epqstate, TupleTableSlot *searchslot)
bool(* ExecutorCheckPerms_hook_type)(List *, bool)
Definition: executor.h:89
TupleTableSlot * slot
Definition: executor.h:448
bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid, LockTupleMode lockmode, TupleTableSlot *searchslot, TupleTableSlot *outslot)
JunkFilter * ExecInitJunkFilter(List *targetList, bool hasoid, TupleTableSlot *slot)
Definition: execJunk.c:61
void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative)
Definition: execIndexing.c:149
TupleTableSlot * resultslot
Definition: execnodes.h:73
bool ExecCheck(ExprState *state, ExprContext *context)
Definition: execExpr.c:594
unsigned int Oid
Definition: postgres_ext.h:31
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:561
static bool ExecQual(ExprState *state, ExprContext *econtext)
Definition: executor.h:362
NodeTag
Definition: nodes.h:26
JunkFilter * ExecInitJunkFilterConversion(List *targetList, TupleDesc cleanTupType, TupleTableSlot *slot)
Definition: execJunk.c:136
struct TupOutputState TupOutputState
void standard_ExecutorEnd(QueryDesc *queryDesc)
Definition: execMain.c:468
int natts
Definition: tupdesc.h:79
TupleTableSlot *(* ExecProcNodeMtd)(struct PlanState *pstate)
Definition: execnodes.h:855
HeapTuple EvalPlanQualGetTuple(EPQState *epqstate, Index rti)
Definition: execMain.c:2867
TupleHashTable BuildTupleHashTable(PlanState *parent, TupleDesc inputDesc, int numCols, AttrNumber *keyColIdx, Oid *eqfuncoids, FmgrInfo *hashfunctions, long nbuckets, Size additionalsize, MemoryContext tablecxt, MemoryContext tempcxt, bool use_variable_hash_iv)
Definition: execGrouping.c:152
#define PGDLLIMPORT
Definition: c.h:1094
char bool
Definition: c.h:265
Datum ExecMakeFunctionResultSet(SetExprState *fcache, ExprContext *econtext, MemoryContext argContext, bool *isNull, ExprDoneCond *isDone)
Definition: execSRF.c:477
void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList)
Definition: execTuples.c:1042
bool ExecShutdownNode(PlanState *node)
Definition: execProcnode.c:747
Definition: type.h:89
bool ExecContextForcesOids(PlanState *planstate, bool *hasoids)
Definition: execMain.c:1516
void ExecCleanUpTriggerState(EState *estate)
Definition: execMain.c:1469
bool ExecCheckRTPerms(List *rangeTable, bool ereport_on_violation)
Definition: execMain.c:568
void standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
Definition: execMain.c:149
LockTupleMode
Definition: heapam.h:38
bool ExecSupportsMarkRestore(struct Path *pathnode)
Definition: execAmi.c:405
TupleDesc ExecTypeFromExprList(List *exprList)
Definition: execTuples.c:1003
void EvalPlanQualFetchRowMarks(EPQState *epqstate)
Definition: execMain.c:2882
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupleDesc)
Definition: execTuples.c:895
void EvalPlanQualSetPlan(EPQState *epqstate, Plan *subplan, List *auxrowmarks)
Definition: execMain.c:2831
void ExecutorRewind(QueryDesc *queryDesc)
Definition: execMain.c:525
PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook
Definition: execMain.c:72
bool ExecMaterializesOutput(NodeTag plantype)
Definition: execAmi.c:577
TupleTableSlot * ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
Definition: execScan.c:121
RelOptInfo * parent
Definition: relation.h:1046
void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc)
Definition: execUtils.c:581
ExprStateEvalFunc evalfunc
Definition: execnodes.h:84
PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook
Definition: execMain.c:69
static Datum ExecEvalExpr(ExprState *state, ExprContext *econtext, bool *isNull)
Definition: executor.h:282
#define EEO_FLAG_IS_QUAL
Definition: execnodes.h:55
void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg)
Definition: execUtils.c:706
bool execCurrentOf(CurrentOfExpr *cexpr, ExprContext *econtext, Oid table_oid, ItemPointer current_tid)
Definition: execCurrent.c:41
void EvalPlanQualBegin(EPQState *epqstate, EState *parentestate)
Definition: execMain.c:3033
ScanDirection
Definition: sdir.h:22
#define DatumGetBool(X)
Definition: postgres.h:376
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
Definition: execUtils.c:453
TupleTableSlot * EvalPlanQualNext(EPQState *epqstate)
Definition: execMain.c:3017
void end_tup_output(TupOutputState *tstate)
Definition: execTuples.c:1367
ExprState * ExecPrepareCheck(List *qual, EState *estate)
Definition: execExpr.c:538
ExprState * ExecInitCheck(List *qual, PlanState *parent)
Definition: execExpr.c:293
WCOKind
Definition: parsenodes.h:1125
TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew)
Definition: execGrouping.c:233
List * ExecPrepareExprList(List *nodes, EState *estate)
Definition: execExpr.c:561
Bitmapset * chgParam
Definition: execnodes.h:896
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:425
void ExecutorFinish(QueryDesc *queryDesc)
Definition: execMain.c:399
bool(* ExecScanRecheckMtd)(ScanState *node, TupleTableSlot *slot)
Definition: executor.h:423
ExprContext * CreateStandaloneExprContext(void)
Definition: execUtils.c:297
ExprDoneCond
Definition: execnodes.h:249
TupleDesc tts_tupleDescriptor
Definition: tuptable.h:121
void ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot)
void ExecReScan(PlanState *node)
Definition: execAmi.c:76
static bool ExecQualAndReset(ExprState *state, ExprContext *econtext)
Definition: executor.h:389
void ExecConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool check_partition_constraint)
Definition: execMain.c:1957
AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, const char *attrName)
Definition: execJunk.c:221
PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook
Definition: execMain.c:71
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:874
HeapTuple EvalPlanQualFetch(EState *estate, Relation relation, int lockmode, LockWaitPolicy wait_policy, ItemPointer tid, TransactionId priorXmax)
Definition: execMain.c:2583
PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook
Definition: execMain.c:75
ExprState * ExecInitExpr(Expr *node, PlanState *parent)
Definition: execExpr.c:118
uintptr_t Datum
Definition: postgres.h:365
void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation)
Definition: execMain.c:1098
void FreeExprContext(ExprContext *econtext, bool isCommit)
Definition: execUtils.c:356
TupleTableSlot * ExecFilterJunk(JunkFilter *junkfilter, TupleTableSlot *slot)
Definition: execJunk.c:262
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:539
static TupleTableSlot * ExecProcNode(PlanState *node)
Definition: executor.h:234
unsigned int Index
Definition: c.h:431
void InitResultRelInfo(ResultRelInfo *resultRelInfo, Relation resultRelationDesc, Index resultRelationIndex, Relation partition_root, int instrument_options)
Definition: execMain.c:1306
ExprState * ExecPrepareExpr(Expr *node, EState *estate)
Definition: execExpr.c:487
EState * CreateExecutorState(void)
Definition: execUtils.c:80
void ExecSetExecProcNode(PlanState *node, ExecProcNodeMtd function)
Definition: execProcnode.c:406
void ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
Definition: execMain.c:1896
SetExprState * ExecInitTableFunctionResult(Expr *expr, ExprContext *econtext, PlanState *parent)
Definition: execSRF.c:56
void ReScanExprContext(ExprContext *econtext)
Definition: execUtils.c:383
void ExecCloseScanRelation(Relation scanrel)
Definition: execUtils.c:696
int ExecTargetListLength(List *targetlist)
Definition: execUtils.c:1034
Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull)
Definition: execJunk.c:248
void(* ExecutorEnd_hook_type)(QueryDesc *queryDesc)
Definition: executor.h:85
List * ExecInsertIndexTuples(TupleTableSlot *slot, ItemPointer tupleid, EState *estate, bool noDupErr, bool *specConflict, List *arbiterIndexes)
Definition: execIndexing.c:271
void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
Definition: execMain.c:297
#define Assert(condition)
Definition: c.h:688
void RegisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg)
Definition: execUtils.c:767
Definition: regguts.h:298
ExprState * ExecPrepareQual(List *qual, EState *estate)
Definition: execExpr.c:515
TupleDesc ExecTypeFromTL(List *targetList, bool hasoid)
Definition: execTuples.c:944
void(* ExprContextCallbackFunction)(Datum arg)
Definition: execnodes.h:174
size_t Size
Definition: c.h:422
void CheckCmdReplicaIdentity(Relation rel, CmdType cmd)
void ExecAssignScanProjectionInfoWithVarno(ScanState *node, Index varno)
Definition: execScan.c:248
List * ExecInitExprList(List *nodes, PlanState *parent)
Definition: execExpr.c:313
void EvalPlanQualSetTuple(EPQState *epqstate, Index rti, HeapTuple tuple)
Definition: execMain.c:2847
void ExecMarkPos(PlanState *node)
Definition: execAmi.c:314
void do_text_output_multiline(TupOutputState *tstate, const char *txt)
Definition: execTuples.c:1337
SetExprState * ExecInitFunctionResultSet(Expr *expr, ExprContext *econtext, PlanState *parent)
Definition: execSRF.c:424
TupleTableSlot * ExecInitExtraTupleSlot(EState *estate, TupleDesc tupleDesc)
Definition: execTuples.c:910
static Datum values[MAXATTR]
Definition: bootstrap.c:164
void EvalPlanQualInit(EPQState *epqstate, EState *estate, Plan *subplan, List *auxrowmarks, int epqParam)
Definition: execMain.c:2812
void EvalPlanQualEnd(EPQState *epqstate)
Definition: execMain.c:3226
bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode, TupleTableSlot *searchslot, TupleTableSlot *outslot)
void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull)
Definition: execTuples.c:1309
ExprContext * MakePerTupleExprContext(EState *estate)
Definition: execUtils.c:398
void execTuplesHashPrepare(int numCols, Oid *eqOperators, Oid **eqFuncOids, FmgrInfo **hashFunctions)
Definition: execGrouping.c:95
ExprState * ExecBuildAggTrans(AggState *aggstate, struct AggStatePerPhaseData *phase, bool doSort, bool doHash)
void(* ExecutorStart_hook_type)(QueryDesc *queryDesc, int eflags)
Definition: executor.h:70
TupleTableSlot * EvalPlanQual(EState *estate, EPQState *epqstate, Relation relation, Index rti, int lockmode, ItemPointer tid, TransactionId priorXmax)
Definition: execMain.c:2496
Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname, bool *isNull)
Definition: execUtils.c:920
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:139
bool ExecPartitionCheck(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
Definition: execMain.c:1858
void ExecutorEnd(QueryDesc *queryDesc)
Definition: execMain.c:459
uint8 flags
Definition: execnodes.h:61
void check_exclusion_constraint(Relation heap, Relation index, IndexInfo *indexInfo, ItemPointer tupleid, Datum *values, bool *isnull, EState *estate, bool newIndex)
Definition: execIndexing.c:863
void ExecLockNonLeafAppendTables(List *partitioned_rels, EState *estate)
Definition: execUtils.c:861
ExprState pi_state
Definition: execnodes.h:310
void * arg
TupleTableSlot * ExecInitNullTupleSlot(EState *estate, TupleDesc tupType)
Definition: execTuples.c:924
DestReceiver * dest
Definition: executor.h:449
TupleTableSlot *(* ExecScanAccessMtd)(ScanState *node)
Definition: executor.h:422
Tuplestorestate * ExecMakeTableFunctionResult(SetExprState *setexpr, ExprContext *econtext, MemoryContext argContext, TupleDesc expectedDesc, bool randomAccess)
Definition: execSRF.c:101
void ExecCreateScanSlotFromOuterPlan(EState *estate, ScanState *scanstate)
Definition: execUtils.c:593
ExprContext * pi_exprContext
Definition: execnodes.h:312
Definition: pg_list.h:45
void ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate, TupleTableSlot *searchslot, TupleTableSlot *slot)
int16 AttrNumber
Definition: attnum.h:21
LockWaitPolicy
Definition: lockoptions.h:36
CmdType
Definition: nodes.h:653
PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook
Definition: execMain.c:70
void ExecutorStart(QueryDesc *queryDesc, int eflags)
Definition: execMain.c:140
static TupleTableSlot * ExecProject(ProjectionInfo *projInfo)
Definition: executor.h:325
void FreeExecutorState(EState *estate)
Definition: execUtils.c:185
void ExecSetTupleBound(int64 tuples_needed, PlanState *child_node)
Definition: execProcnode.c:800