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