PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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-2017, 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 
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  */
115 extern bool execTuplesMatch(TupleTableSlot *slot1,
116  TupleTableSlot *slot2,
117  int numCols,
118  AttrNumber *matchColIdx,
119  FmgrInfo *eqfunctions,
120  MemoryContext evalContext);
121 extern bool execTuplesUnequal(TupleTableSlot *slot1,
122  TupleTableSlot *slot2,
123  int numCols,
124  AttrNumber *matchColIdx,
125  FmgrInfo *eqfunctions,
126  MemoryContext evalContext);
127 extern FmgrInfo *execTuplesMatchPrepare(int numCols,
128  Oid *eqOperators);
129 extern void execTuplesHashPrepare(int numCols,
130  Oid *eqOperators,
131  FmgrInfo **eqFunctions,
132  FmgrInfo **hashFunctions);
133 extern TupleHashTable BuildTupleHashTable(int numCols, AttrNumber *keyColIdx,
134  FmgrInfo *eqfunctions,
135  FmgrInfo *hashfunctions,
136  long nbuckets, Size additionalsize,
137  MemoryContext tablecxt,
138  MemoryContext tempcxt, bool use_variable_hash_iv);
140  TupleTableSlot *slot,
141  bool *isnew);
143  TupleTableSlot *slot,
144  FmgrInfo *eqfunctions,
145  FmgrInfo *hashfunctions);
146 
147 /*
148  * prototypes from functions in execJunk.c
149  */
150 extern JunkFilter *ExecInitJunkFilter(List *targetList, bool hasoid,
151  TupleTableSlot *slot);
152 extern JunkFilter *ExecInitJunkFilterConversion(List *targetList,
153  TupleDesc cleanTupType,
154  TupleTableSlot *slot);
155 extern AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter,
156  const char *attrName);
157 extern AttrNumber ExecFindJunkAttributeInTlist(List *targetlist,
158  const char *attrName);
160  bool *isNull);
161 extern TupleTableSlot *ExecFilterJunk(JunkFilter *junkfilter,
162  TupleTableSlot *slot);
163 
164 
165 /*
166  * prototypes from functions in execMain.c
167  */
168 extern void ExecutorStart(QueryDesc *queryDesc, int eflags);
169 extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags);
170 extern void ExecutorRun(QueryDesc *queryDesc,
171  ScanDirection direction, uint64 count, bool execute_once);
172 extern void standard_ExecutorRun(QueryDesc *queryDesc,
173  ScanDirection direction, uint64 count, bool execute_once);
174 extern void ExecutorFinish(QueryDesc *queryDesc);
175 extern void standard_ExecutorFinish(QueryDesc *queryDesc);
176 extern void ExecutorEnd(QueryDesc *queryDesc);
177 extern void standard_ExecutorEnd(QueryDesc *queryDesc);
178 extern void ExecutorRewind(QueryDesc *queryDesc);
179 extern bool ExecCheckRTPerms(List *rangeTable, bool ereport_on_violation);
180 extern void CheckValidResultRel(Relation resultRel, CmdType operation);
181 extern void InitResultRelInfo(ResultRelInfo *resultRelInfo,
182  Relation resultRelationDesc,
183  Index resultRelationIndex,
184  Relation partition_root,
185  int instrument_options);
186 extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid);
187 extern bool ExecContextForcesOids(PlanState *planstate, bool *hasoids);
188 extern void ExecConstraints(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);
209  PartitionDispatch **pd,
210  ResultRelInfo **partitions,
211  TupleConversionMap ***tup_conv_maps,
212  TupleTableSlot **partition_tuple_slot,
213  int *num_parted, int *num_partitions);
214 extern int ExecFindPartition(ResultRelInfo *resultRelInfo,
215  PartitionDispatch *pd,
216  TupleTableSlot *slot,
217  EState *estate);
218 
219 #define EvalPlanQualSetSlot(epqstate, slot) ((epqstate)->origslot = (slot))
220 extern void EvalPlanQualFetchRowMarks(EPQState *epqstate);
221 extern TupleTableSlot *EvalPlanQualNext(EPQState *epqstate);
222 extern void EvalPlanQualBegin(EPQState *epqstate, EState *parentestate);
223 extern void EvalPlanQualEnd(EPQState *epqstate);
224 
225 /*
226  * prototypes from functions in execProcnode.c
227  */
228 extern PlanState *ExecInitNode(Plan *node, EState *estate, int eflags);
229 extern TupleTableSlot *ExecProcNode(PlanState *node);
230 extern Node *MultiExecProcNode(PlanState *node);
231 extern void ExecEndNode(PlanState *node);
232 extern bool ExecShutdownNode(PlanState *node);
233 
234 /*
235  * prototypes from functions in execExpr.c
236  */
237 extern ExprState *ExecInitExpr(Expr *node, PlanState *parent);
238 extern ExprState *ExecInitQual(List *qual, PlanState *parent);
239 extern ExprState *ExecInitCheck(List *qual, PlanState *parent);
240 extern List *ExecInitExprList(List *nodes, PlanState *parent);
241 extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,
242  ExprContext *econtext,
243  TupleTableSlot *slot,
244  PlanState *parent,
245  TupleDesc inputDesc);
246 extern ExprState *ExecPrepareExpr(Expr *node, EState *estate);
247 extern ExprState *ExecPrepareQual(List *qual, EState *estate);
248 extern ExprState *ExecPrepareCheck(List *qual, EState *estate);
249 extern List *ExecPrepareExprList(List *nodes, EState *estate);
250 
251 /*
252  * ExecEvalExpr
253  *
254  * Evaluate expression identified by "state" in the execution context
255  * given by "econtext". *isNull is set to the is-null flag for the result,
256  * and the Datum value is the function result.
257  *
258  * The caller should already have switched into the temporary memory
259  * context econtext->ecxt_per_tuple_memory. The convenience entry point
260  * ExecEvalExprSwitchContext() is provided for callers who don't prefer to
261  * do the switch in an outer loop.
262  */
263 #ifndef FRONTEND
264 static inline Datum
266  ExprContext *econtext,
267  bool *isNull)
268 {
269  return (*state->evalfunc) (state, econtext, isNull);
270 }
271 #endif
272 
273 /*
274  * ExecEvalExprSwitchContext
275  *
276  * Same as ExecEvalExpr, but get into the right allocation context explicitly.
277  */
278 #ifndef FRONTEND
279 static inline Datum
281  ExprContext *econtext,
282  bool *isNull)
283 {
284  Datum retDatum;
285  MemoryContext oldContext;
286 
287  oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
288  retDatum = (*state->evalfunc) (state, econtext, isNull);
289  MemoryContextSwitchTo(oldContext);
290  return retDatum;
291 }
292 #endif
293 
294 /*
295  * ExecProject
296  *
297  * Projects a tuple based on projection info and stores it in the slot passed
298  * to ExecBuildProjectInfo().
299  *
300  * Note: the result is always a virtual tuple; therefore it may reference
301  * the contents of the exprContext's scan tuples and/or temporary results
302  * constructed in the exprContext. If the caller wishes the result to be
303  * valid longer than that data will be valid, he must call ExecMaterializeSlot
304  * on the result slot.
305  */
306 #ifndef FRONTEND
307 static inline TupleTableSlot *
309 {
310  ExprContext *econtext = projInfo->pi_exprContext;
311  ExprState *state = &projInfo->pi_state;
312  TupleTableSlot *slot = state->resultslot;
313  bool isnull;
314 
315  /*
316  * Clear any former contents of the result slot. This makes it safe for
317  * us to use the slot's Datum/isnull arrays as workspace.
318  */
319  ExecClearTuple(slot);
320 
321  /* Run the expression, discarding scalar result from the last column. */
322  (void) ExecEvalExprSwitchContext(state, econtext, &isnull);
323 
324  /*
325  * Successfully formed a result row. Mark the result slot as containing a
326  * valid virtual tuple (inlined version of ExecStoreVirtualTuple()).
327  */
328  slot->tts_isempty = false;
329  slot->tts_nvalid = slot->tts_tupleDescriptor->natts;
330 
331  return slot;
332 }
333 #endif
334 
335 /*
336  * ExecQual - evaluate a qual prepared with ExecInitQual (possibly via
337  * ExecPrepareQual). Returns true if qual is satisfied, else false.
338  *
339  * Note: ExecQual used to have a third argument "resultForNull". The
340  * behavior of this function now corresponds to resultForNull == false.
341  * If you want the resultForNull == true behavior, see ExecCheck.
342  */
343 #ifndef FRONTEND
344 static inline bool
346 {
347  Datum ret;
348  bool isnull;
349 
350  /* short-circuit (here and in ExecInitQual) for empty restriction list */
351  if (state == NULL)
352  return true;
353 
354  /* verify that expression was compiled using ExecInitQual */
355  Assert(state->flags & EEO_FLAG_IS_QUAL);
356 
357  ret = ExecEvalExprSwitchContext(state, econtext, &isnull);
358 
359  /* EEOP_QUAL should never return NULL */
360  Assert(!isnull);
361 
362  return DatumGetBool(ret);
363 }
364 #endif
365 
366 extern bool ExecCheck(ExprState *state, ExprContext *context);
367 
368 /*
369  * prototypes from functions in execSRF.c
370  */
372  ExprContext *econtext, PlanState *parent);
374  ExprContext *econtext,
375  MemoryContext argContext,
376  TupleDesc expectedDesc,
377  bool randomAccess);
379  ExprContext *econtext, PlanState *parent);
381  ExprContext *econtext,
382  bool *isNull,
383  ExprDoneCond *isDone);
384 
385 /*
386  * prototypes from functions in execScan.c
387  */
388 typedef TupleTableSlot *(*ExecScanAccessMtd) (ScanState *node);
390 
391 extern TupleTableSlot *ExecScan(ScanState *node, ExecScanAccessMtd accessMtd,
392  ExecScanRecheckMtd recheckMtd);
393 extern void ExecAssignScanProjectionInfo(ScanState *node);
394 extern void ExecAssignScanProjectionInfoWithVarno(ScanState *node, Index varno);
395 extern void ExecScanReScan(ScanState *node);
396 
397 /*
398  * prototypes from functions in execTuples.c
399  */
400 extern void ExecInitResultTupleSlot(EState *estate, PlanState *planstate);
401 extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate);
404  TupleDesc tupType);
405 extern TupleDesc ExecTypeFromTL(List *targetList, bool hasoid);
406 extern TupleDesc ExecCleanTypeFromTL(List *targetList, bool hasoid);
407 extern TupleDesc ExecTypeFromExprList(List *exprList);
408 extern void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList);
409 extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg);
410 
411 typedef struct TupOutputState
412 {
416 
418  TupleDesc tupdesc);
419 extern void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull);
420 extern void do_text_output_multiline(TupOutputState *tstate, const char *txt);
421 extern void end_tup_output(TupOutputState *tstate);
422 
423 /*
424  * Write a single line of text given as a C string.
425  *
426  * Should only be used with a single-TEXT-attribute tupdesc.
427  */
428 #define do_text_output_oneline(tstate, str_to_emit) \
429  do { \
430  Datum values_[1]; \
431  bool isnull_[1]; \
432  values_[0] = PointerGetDatum(cstring_to_text(str_to_emit)); \
433  isnull_[0] = false; \
434  do_tup_output(tstate, values_, isnull_); \
435  pfree(DatumGetPointer(values_[0])); \
436  } while (0)
437 
438 
439 /*
440  * prototypes from functions in execUtils.c
441  */
442 extern EState *CreateExecutorState(void);
443 extern void FreeExecutorState(EState *estate);
444 extern ExprContext *CreateExprContext(EState *estate);
446 extern void FreeExprContext(ExprContext *econtext, bool isCommit);
447 extern void ReScanExprContext(ExprContext *econtext);
448 
449 #define ResetExprContext(econtext) \
450  MemoryContextReset((econtext)->ecxt_per_tuple_memory)
451 
453 
454 /* Get an EState's per-output-tuple exprcontext, making it if first use */
455 #define GetPerTupleExprContext(estate) \
456  ((estate)->es_per_tuple_exprcontext ? \
457  (estate)->es_per_tuple_exprcontext : \
458  MakePerTupleExprContext(estate))
459 
460 #define GetPerTupleMemoryContext(estate) \
461  (GetPerTupleExprContext(estate)->ecxt_per_tuple_memory)
462 
463 /* Reset an EState's per-output-tuple exprcontext, if one's been created */
464 #define ResetPerTupleExprContext(estate) \
465  do { \
466  if ((estate)->es_per_tuple_exprcontext) \
467  ResetExprContext((estate)->es_per_tuple_exprcontext); \
468  } while (0)
469 
470 extern void ExecAssignExprContext(EState *estate, PlanState *planstate);
471 extern void ExecAssignResultType(PlanState *planstate, TupleDesc tupDesc);
472 extern void ExecAssignResultTypeFromTL(PlanState *planstate);
473 extern TupleDesc ExecGetResultType(PlanState *planstate);
474 extern void ExecAssignProjectionInfo(PlanState *planstate,
475  TupleDesc inputDesc);
476 extern void ExecFreeExprContext(PlanState *planstate);
477 extern void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc);
478 extern void ExecAssignScanTypeFromOuterPlan(ScanState *scanstate);
479 
480 extern bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid);
481 
482 extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags);
483 extern void ExecCloseScanRelation(Relation scanrel);
484 
485 extern int executor_errposition(EState *estate, int location);
486 
487 extern void RegisterExprContextCallback(ExprContext *econtext,
489  Datum arg);
490 extern void UnregisterExprContextCallback(ExprContext *econtext,
492  Datum arg);
493 
494 extern void ExecLockNonLeafAppendTables(List *partitioned_rels, EState *estate);
495 
496 extern Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname,
497  bool *isNull);
499  bool *isNull);
500 
501 extern int ExecTargetListLength(List *targetlist);
502 extern int ExecCleanTargetListLength(List *targetlist);
503 
504 /*
505  * prototypes from functions in execIndexing.c
506  */
507 extern void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative);
508 extern void ExecCloseIndices(ResultRelInfo *resultRelInfo);
510  EState *estate, bool noDupErr, bool *specConflict,
511  List *arbiterIndexes);
512 extern bool ExecCheckIndexConstraints(TupleTableSlot *slot, EState *estate,
513  ItemPointer conflictTid, List *arbiterIndexes);
515  IndexInfo *indexInfo,
516  ItemPointer tupleid,
517  Datum *values, bool *isnull,
518  EState *estate, bool newIndex);
519 
520 /*
521  * prototypes from functions in execReplication.c
522  */
523 extern bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid,
524  LockTupleMode lockmode,
525  TupleTableSlot *searchslot,
526  TupleTableSlot *outslot);
527 extern bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode,
528  TupleTableSlot *searchslot, TupleTableSlot *outslot);
529 
530 extern void ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot);
531 extern void ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate,
532  TupleTableSlot *searchslot, TupleTableSlot *slot);
533 extern void ExecSimpleRelationDelete(EState *estate, EPQState *epqstate,
534  TupleTableSlot *searchslot);
535 extern void CheckCmdReplicaIdentity(Relation rel, CmdType cmd);
536 
537 
538 #endif /* EXECUTOR_H */
bool(* ExecutorCheckPerms_hook_type)(List *, bool)
Definition: executor.h:88
bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid)
Definition: execUtils.c:577
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:603
TupleDesc ExecGetResultType(PlanState *planstate)
Definition: execUtils.c:469
LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo)
Definition: execMain.c:2259
TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, FmgrInfo *eqfunctions, FmgrInfo *hashfunctions)
Definition: execGrouping.c:425
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:1996
ProjectionInfo * ExecBuildProjectionInfo(List *targetList, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent, TupleDesc inputDesc)
Definition: execExpr.c:301
bool ExecSupportsBackwardScan(Plan *node)
Definition: execAmi.c:456
bool tts_isempty
Definition: tuptable.h:116
ResultRelInfo * ExecGetTriggerResultRel(EState *estate, Oid relid)
Definition: execMain.c:1355
ExprContext * CreateExprContext(EState *estate)
Definition: execUtils.c:218
bool execTuplesMatch(TupleTableSlot *slot1, TupleTableSlot *slot2, int numCols, AttrNumber *matchColIdx, FmgrInfo *eqfunctions, MemoryContext evalContext)
Definition: execGrouping.c:69
static Datum ExecEvalExprSwitchContext(ExprState *state, ExprContext *econtext, bool *isNull)
Definition: executor.h:280
bool execTuplesUnequal(TupleTableSlot *slot1, TupleTableSlot *slot2, int numCols, AttrNumber *matchColIdx, FmgrInfo *eqfunctions, MemoryContext evalContext)
Definition: execGrouping.c:139
TupOutputState * begin_tup_output_tupdesc(DestReceiver *dest, TupleDesc tupdesc)
Definition: execTuples.c:1232
ExecRowMark * ExecFindRowMark(EState *estate, Index rti, bool missing_ok)
Definition: execMain.c:2285
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:160
ExecAuxRowMark * ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
Definition: execMain.c:2309
uint32 TransactionId
Definition: c.h:397
void ExecScanReScan(ScanState *node)
Definition: execScan.c:327
void ExecAssignScanTypeFromOuterPlan(ScanState *scanstate)
Definition: execUtils.c:552
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:307
void execTuplesHashPrepare(int numCols, Oid *eqOperators, FmgrInfo **eqFunctions, FmgrInfo **hashFunctions)
Definition: execGrouping.c:233
Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno, bool *isNull)
Definition: execUtils.c:946
MemoryContext ecxt_per_tuple_memory
Definition: execnodes.h:203
void ExecAssignResultType(PlanState *planstate, TupleDesc tupDesc)
Definition: execUtils.c:428
void(* ExecutorEnd_hook_type)(QueryDesc *queryDesc)
Definition: executor.h:84
void UnregisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg)
Definition: execUtils.c:758
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
void standard_ExecutorFinish(QueryDesc *queryDesc)
Definition: execMain.c:407
void ExecCloseIndices(ResultRelInfo *resultRelInfo)
Definition: execIndexing.c:224
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
FmgrInfo * execTuplesMatchPrepare(int numCols, Oid *eqOperators)
Definition: execGrouping.c:204
Node * MultiExecProcNode(PlanState *node)
Definition: execProcnode.c:601
void(* ExecutorFinish_hook_type)(QueryDesc *queryDesc)
Definition: executor.h:80
Definition: nodes.h:509
int ExecCleanTargetListLength(List *targetlist)
Definition: execUtils.c:1007
TupleDesc ExecCleanTypeFromTL(List *targetList, bool hasoid)
Definition: execTuples.c:900
void ExecRestrPos(PlanState *node)
Definition: execAmi.c:358
int executor_errposition(EState *estate, int location)
Definition: execUtils.c:705
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:235
void ExecSimpleRelationDelete(EState *estate, EPQState *epqstate, TupleTableSlot *searchslot)
TupleTableSlot * slot
Definition: executor.h:413
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:69
bool ExecCheck(ExprState *state, ExprContext *context)
Definition: execExpr.c:544
unsigned int Oid
Definition: postgres_ext.h:31
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:516
static bool ExecQual(ExprState *state, ExprContext *econtext)
Definition: executor.h:345
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:467
int natts
Definition: tupdesc.h:73
HeapTuple EvalPlanQualGetTuple(EPQState *epqstate, Index rti)
Definition: execMain.c:2751
#define PGDLLIMPORT
Definition: c.h:1063
char bool
Definition: c.h:202
void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList)
Definition: execTuples.c:986
bool ExecShutdownNode(PlanState *node)
Definition: execProcnode.c:855
TupleTableSlot *(* ExecScanAccessMtd)(ScanState *node)
Definition: executor.h:388
Definition: type.h:90
void(* ExecutorStart_hook_type)(QueryDesc *queryDesc, int eflags)
Definition: executor.h:69
bool ExecContextForcesOids(PlanState *planstate, bool *hasoids)
Definition: execMain.c:1445
bool ExecCheckRTPerms(List *rangeTable, bool ereport_on_violation)
Definition: execMain.c:567
void standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
Definition: execMain.c:153
LockTupleMode
Definition: heapam.h:38
bool ExecSupportsMarkRestore(struct Path *pathnode)
Definition: execAmi.c:400
bool(* ExecScanRecheckMtd)(ScanState *node, TupleTableSlot *slot)
Definition: executor.h:389
TupleDesc ExecTypeFromExprList(List *exprList)
Definition: execTuples.c:947
TupleTableSlot * ExecProcNode(PlanState *node)
Definition: execProcnode.c:398
void EvalPlanQualFetchRowMarks(EPQState *epqstate)
Definition: execMain.c:2766
void EvalPlanQualSetPlan(EPQState *epqstate, Plan *subplan, List *auxrowmarks)
Definition: execMain.c:2715
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate)
Definition: execTuples.c:842
void ExecutorRewind(QueryDesc *queryDesc)
Definition: execMain.c:524
PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook
Definition: execMain.c:72
bool ExecMaterializesOutput(NodeTag plantype)
Definition: execAmi.c:571
TupleTableSlot * ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
Definition: execScan.c:121
void ExecConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
Definition: execMain.c:1831
Datum ExecMakeFunctionResultSet(SetExprState *fcache, ExprContext *econtext, bool *isNull, ExprDoneCond *isDone)
Definition: execSRF.c:473
RelOptInfo * parent
Definition: relation.h:952
void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc)
Definition: execUtils.c:540
ExprStateEvalFunc evalfunc
Definition: execnodes.h:80
PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook
Definition: execMain.c:69
void ExecAssignResultTypeFromTL(PlanState *planstate)
Definition: execUtils.c:440
static Datum ExecEvalExpr(ExprState *state, ExprContext *econtext, bool *isNull)
Definition: executor.h:265
#define EEO_FLAG_IS_QUAL
Definition: execnodes.h:51
void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg)
Definition: execUtils.c:671
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:2917
ScanDirection
Definition: sdir.h:22
#define DatumGetBool(X)
Definition: postgres.h:399
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
Definition: execUtils.c:487
TupleTableSlot * EvalPlanQualNext(EPQState *epqstate)
Definition: execMain.c:2901
void end_tup_output(TupOutputState *tstate)
Definition: execTuples.c:1308
ExprState * ExecPrepareCheck(List *qual, EState *estate)
Definition: execExpr.c:488
ExprState * ExecInitCheck(List *qual, PlanState *parent)
Definition: execExpr.c:246
WCOKind
Definition: parsenodes.h:1078
TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew)
Definition: execGrouping.c:351
List * ExecPrepareExprList(List *nodes, EState *estate)
Definition: execExpr.c:511
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:418
void ExecutorFinish(QueryDesc *queryDesc)
Definition: execMain.c:398
void CheckValidResultRel(Relation resultRel, CmdType operation)
Definition: execMain.c:1060
ExprContext * CreateStandaloneExprContext(void)
Definition: execUtils.c:290
ExprDoneCond
Definition: execnodes.h:235
TupleDesc tts_tupleDescriptor
Definition: tuptable.h:121
void ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot)
void ExecReScan(PlanState *node)
Definition: execAmi.c:75
AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, const char *attrName)
Definition: execJunk.c:221
PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook
Definition: execMain.c:71
HeapTuple EvalPlanQualFetch(EState *estate, Relation relation, int lockmode, LockWaitPolicy wait_policy, ItemPointer tid, TransactionId priorXmax)
Definition: execMain.c:2467
PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook
Definition: execMain.c:75
ExprState * ExecInitExpr(Expr *node, PlanState *parent)
Definition: execExpr.c:113
uintptr_t Datum
Definition: postgres.h:372
void ExecSetupPartitionTupleRouting(Relation rel, PartitionDispatch **pd, ResultRelInfo **partitions, TupleConversionMap ***tup_conv_maps, TupleTableSlot **partition_tuple_slot, int *num_parted, int *num_partitions)
Definition: execMain.c:3176
void FreeExprContext(ExprContext *econtext, bool isCommit)
Definition: execUtils.c:349
TupleTableSlot * ExecFilterJunk(JunkFilter *junkfilter, TupleTableSlot *slot)
Definition: execJunk.c:262
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:654
unsigned int Index
Definition: c.h:365
void InitResultRelInfo(ResultRelInfo *resultRelInfo, Relation resultRelationDesc, Index resultRelationIndex, Relation partition_root, int instrument_options)
Definition: execMain.c:1260
ExprState * ExecPrepareExpr(Expr *node, EState *estate)
Definition: execExpr.c:437
EState * CreateExecutorState(void)
Definition: execUtils.c:80
SetExprState * ExecInitTableFunctionResult(Expr *expr, ExprContext *econtext, PlanState *parent)
Definition: execSRF.c:56
void ReScanExprContext(ExprContext *econtext)
Definition: execUtils.c:376
void ExecCloseScanRelation(Relation scanrel)
Definition: execUtils.c:661
int ExecTargetListLength(List *targetlist)
Definition: execUtils.c:997
Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull)
Definition: execJunk.c:248
List * ExecInsertIndexTuples(TupleTableSlot *slot, ItemPointer tupleid, EState *estate, bool noDupErr, bool *specConflict, List *arbiterIndexes)
Definition: execIndexing.c:271
#define NULL
Definition: c.h:229
void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
Definition: execMain.c:296
#define Assert(condition)
Definition: c.h:675
void RegisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg)
Definition: execUtils.c:732
Definition: regguts.h:298
ExprState * ExecPrepareQual(List *qual, EState *estate)
Definition: execExpr.c:465
TupleDesc ExecTypeFromTL(List *targetList, bool hasoid)
Definition: execTuples.c:888
int ExecFindPartition(ResultRelInfo *resultRelInfo, PartitionDispatch *pd, TupleTableSlot *slot, EState *estate)
Definition: execMain.c:3265
size_t Size
Definition: c.h:356
void CheckCmdReplicaIdentity(Relation rel, CmdType cmd)
void ExecAssignScanProjectionInfoWithVarno(ScanState *node, Index varno)
Definition: execScan.c:247
List * ExecInitExprList(List *nodes, PlanState *parent)
Definition: execExpr.c:266
void EvalPlanQualSetTuple(EPQState *epqstate, Index rti, HeapTuple tuple)
Definition: execMain.c:2731
void ExecMarkPos(PlanState *node)
Definition: execAmi.c:309
void do_text_output_multiline(TupOutputState *tstate, const char *txt)
Definition: execTuples.c:1278
SetExprState * ExecInitFunctionResultSet(Expr *expr, ExprContext *econtext, PlanState *parent)
Definition: execSRF.c:424
static Datum values[MAXATTR]
Definition: bootstrap.c:163
void EvalPlanQualInit(EPQState *epqstate, EState *estate, Plan *subplan, List *auxrowmarks, int epqParam)
Definition: execMain.c:2696
void EvalPlanQualEnd(EPQState *epqstate)
Definition: execMain.c:3107
bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode, TupleTableSlot *searchslot, TupleTableSlot *outslot)
void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull)
Definition: execTuples.c:1250
ExprContext * MakePerTupleExprContext(EState *estate)
Definition: execUtils.c:391
TupleHashTable BuildTupleHashTable(int numCols, AttrNumber *keyColIdx, FmgrInfo *eqfunctions, FmgrInfo *hashfunctions, long nbuckets, Size additionalsize, MemoryContext tablecxt, MemoryContext tempcxt, bool use_variable_hash_iv)
Definition: execGrouping.c:290
TupleTableSlot * EvalPlanQual(EState *estate, EPQState *epqstate, Relation relation, Index rti, int lockmode, ItemPointer tid, TransactionId priorXmax)
Definition: execMain.c:2380
Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname, bool *isNull)
Definition: execUtils.c:885
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:140
void ExecutorEnd(QueryDesc *queryDesc)
Definition: execMain.c:458
uint8 flags
Definition: execnodes.h:57
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:826
ExprState pi_state
Definition: execnodes.h:296
void * arg
TupleTableSlot * ExecInitNullTupleSlot(EState *estate, TupleDesc tupType)
Definition: execTuples.c:866
DestReceiver * dest
Definition: executor.h:414
TupleTableSlot * ExecInitExtraTupleSlot(EState *estate)
Definition: execTuples.c:852
void(* ExprContextCallbackFunction)(Datum arg)
Definition: execnodes.h:160
Tuplestorestate * ExecMakeTableFunctionResult(SetExprState *setexpr, ExprContext *econtext, MemoryContext argContext, TupleDesc expectedDesc, bool randomAccess)
Definition: execSRF.c:101
void ExecInitResultTupleSlot(EState *estate, PlanState *planstate)
Definition: execTuples.c:832
ExprContext * pi_exprContext
Definition: execnodes.h:298
void(* ExecutorRun_hook_type)(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
Definition: executor.h:73
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:648
PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook
Definition: execMain.c:70
Definition: relation.h:946
void ExecutorStart(QueryDesc *queryDesc, int eflags)
Definition: execMain.c:144
static TupleTableSlot * ExecProject(ProjectionInfo *projInfo)
Definition: executor.h:308
void FreeExecutorState(EState *estate)
Definition: execUtils.c:178