PostgreSQL Source Code: src/include/executor/executor.h Source File

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-2025, 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 "datatype/timestamp.h"
18#include "executor/execdesc.h"
19#include "fmgr.h"
20#include "nodes/lockoptions.h"
21#include "nodes/parsenodes.h"
22#include "utils/memutils.h"
23
24
25/*
26 * The "eflags" argument to ExecutorStart and the various ExecInitNode
27 * routines is a bitwise OR of the following flag bits, which tell the
28 * called plan node what to expect. Note that the flags will get modified
29 * as they are passed down the plan tree, since an upper node may require
30 * functionality in its subnode not demanded of the plan as a whole
31 * (example: MergeJoin requires mark/restore capability in its inner input),
32 * or an upper node may shield its input from some functionality requirement
33 * (example: Materialize shields its input from needing to do backward scan).
34 *
35 * EXPLAIN_ONLY indicates that the plan tree is being initialized just so
36 * EXPLAIN can print it out; it will not be run. Hence, no side-effects
37 * of startup should occur. However, error checks (such as permission checks)
38 * should be performed.
39 *
40 * EXPLAIN_GENERIC can only be used together with EXPLAIN_ONLY. It indicates
41 * that a generic plan is being shown using EXPLAIN (GENERIC_PLAN), which
42 * means that missing parameter values must be tolerated. Currently, the only
43 * effect is to suppress execution-time partition pruning.
44 *
45 * REWIND indicates that the plan node should try to efficiently support
46 * rescans without parameter changes. (Nodes must support ExecReScan calls
47 * in any case, but if this flag was not given, they are at liberty to do it
48 * through complete recalculation. Note that a parameter change forces a
49 * full recalculation in any case.)
50 *
51 * BACKWARD indicates that the plan node must respect the es_direction flag.
52 * When this is not passed, the plan node will only be run forwards.
53 *
54 * MARK indicates that the plan node must support Mark/Restore calls.
55 * When this is not passed, no Mark/Restore will occur.
56 *
57 * SKIP_TRIGGERS tells ExecutorStart/ExecutorFinish to skip calling
58 * AfterTriggerBeginQuery/AfterTriggerEndQuery. This does not necessarily
59 * mean that the plan can't queue any AFTER triggers; just that the caller
60 * is responsible for there being a trigger context for them to be queued in.
61 *
62 * WITH_NO_DATA indicates that we are performing REFRESH MATERIALIZED VIEW
63 * ... WITH NO DATA. Currently, the only effect is to suppress errors about
64 * scanning unpopulated materialized views.
65 */
66 #define EXEC_FLAG_EXPLAIN_ONLY 0x0001 /* EXPLAIN, no ANALYZE */
67 #define EXEC_FLAG_EXPLAIN_GENERIC 0x0002 /* EXPLAIN (GENERIC_PLAN) */
68 #define EXEC_FLAG_REWIND 0x0004 /* need efficient rescan */
69 #define EXEC_FLAG_BACKWARD 0x0008 /* need backward scan */
70 #define EXEC_FLAG_MARK 0x0010 /* need mark/restore */
71 #define EXEC_FLAG_SKIP_TRIGGERS 0x0020 /* skip AfterTrigger setup */
72 #define EXEC_FLAG_WITH_NO_DATA 0x0040 /* REFRESH ... WITH NO DATA */
73
74
75/* Hook for plugins to get control in ExecutorStart() */
76 typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags);
77extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook;
78
79/* Hook for plugins to get control in ExecutorRun() */
80 typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc,
81 ScanDirection direction,
82 uint64 count);
83extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook;
84
85/* Hook for plugins to get control in ExecutorFinish() */
86 typedef void (*ExecutorFinish_hook_type) (QueryDesc *queryDesc);
87extern PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook;
88
89/* Hook for plugins to get control in ExecutorEnd() */
90 typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc);
91extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook;
92
93/* Hook for plugins to get control in ExecCheckPermissions() */
94 typedef bool (*ExecutorCheckPerms_hook_type) (List *rangeTable,
95 List *rtePermInfos,
96 bool ereport_on_violation);
97extern PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook;
98
99
100/*
101 * prototypes from functions in execAmi.c
102 */
103 typedef struct Path Path; /* avoid including pathnodes.h here */
104
105extern void ExecReScan(PlanState *node);
106extern void ExecMarkPos(PlanState *node);
107extern void ExecRestrPos(PlanState *node);
108extern bool ExecSupportsMarkRestore(Path *pathnode);
109extern bool ExecSupportsBackwardScan(Plan *node);
110extern bool ExecMaterializesOutput(NodeTag plantype);
111
112/*
113 * prototypes from functions in execCurrent.c
114 */
115extern bool execCurrentOf(CurrentOfExpr *cexpr,
116 ExprContext *econtext,
117 Oid table_oid,
118 ItemPointer current_tid);
119
120/*
121 * prototypes from functions in execGrouping.c
122 */
123extern ExprState *execTuplesMatchPrepare(TupleDesc desc,
124 int numCols,
125 const AttrNumber *keyColIdx,
126 const Oid *eqOperators,
127 const Oid *collations,
128 PlanState *parent);
129extern void execTuplesHashPrepare(int numCols,
130 const Oid *eqOperators,
131 Oid **eqFuncOids,
132 FmgrInfo **hashFunctions);
133extern TupleHashTable BuildTupleHashTable(PlanState *parent,
134 TupleDesc inputDesc,
135 const TupleTableSlotOps *inputOps,
136 int numCols,
137 AttrNumber *keyColIdx,
138 const Oid *eqfuncoids,
139 FmgrInfo *hashfunctions,
140 Oid *collations,
141 long nbuckets,
142 Size additionalsize,
143 MemoryContext metacxt,
144 MemoryContext tablecxt,
145 MemoryContext tempcxt,
146 bool use_variable_hash_iv);
147extern TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable,
148 TupleTableSlot *slot,
149 bool *isnew, uint32 *hash);
150extern uint32 TupleHashTableHash(TupleHashTable hashtable,
151 TupleTableSlot *slot);
152extern TupleHashEntry LookupTupleHashEntryHash(TupleHashTable hashtable,
153 TupleTableSlot *slot,
154 bool *isnew, uint32 hash);
155extern TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable,
156 TupleTableSlot *slot,
157 ExprState *eqcomp,
158 ExprState *hashexpr);
159extern void ResetTupleHashTable(TupleHashTable hashtable);
160
161#ifndef FRONTEND
162/*
163 * Return size of the hash bucket. Useful for estimating memory usage.
164 */
165static inline size_t
166 TupleHashEntrySize(void)
167{
168 return sizeof(TupleHashEntryData);
169}
170
171/*
172 * Return tuple from hash entry.
173 */
174static inline MinimalTuple
175 TupleHashEntryGetTuple(TupleHashEntry entry)
176{
177 return entry->firstTuple;
178}
179
180/*
181 * Get a pointer into the additional space allocated for this entry. The
182 * memory will be maxaligned and zeroed.
183 *
184 * The amount of space available is the additionalsize requested in the call
185 * to BuildTupleHashTable(). If additionalsize was specified as zero, return
186 * NULL.
187 */
188static inline void *
189 TupleHashEntryGetAdditional(TupleHashTable hashtable, TupleHashEntry entry)
190{
191 if (hashtable->additionalsize > 0)
192 return (char *) entry->firstTuple - hashtable->additionalsize;
193 else
194 return NULL;
195}
196#endif
197
198/*
199 * prototypes from functions in execJunk.c
200 */
201extern JunkFilter *ExecInitJunkFilter(List *targetList,
202 TupleTableSlot *slot);
203extern JunkFilter *ExecInitJunkFilterConversion(List *targetList,
204 TupleDesc cleanTupType,
205 TupleTableSlot *slot);
206extern AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter,
207 const char *attrName);
208extern AttrNumber ExecFindJunkAttributeInTlist(List *targetlist,
209 const char *attrName);
210extern TupleTableSlot *ExecFilterJunk(JunkFilter *junkfilter,
211 TupleTableSlot *slot);
212
213/*
214 * ExecGetJunkAttribute
215 *
216 * Given a junk filter's input tuple (slot) and a junk attribute's number
217 * previously found by ExecFindJunkAttribute, extract & return the value and
218 * isNull flag of the attribute.
219 */
220#ifndef FRONTEND
221static inline Datum
222 ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull)
223{
224 Assert(attno > 0);
225 return slot_getattr(slot, attno, isNull);
226}
227#endif
228
229/*
230 * prototypes from functions in execMain.c
231 */
232extern void ExecutorStart(QueryDesc *queryDesc, int eflags);
233extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags);
234extern void ExecutorRun(QueryDesc *queryDesc,
235 ScanDirection direction, uint64 count);
236extern void standard_ExecutorRun(QueryDesc *queryDesc,
237 ScanDirection direction, uint64 count);
238extern void ExecutorFinish(QueryDesc *queryDesc);
239extern void standard_ExecutorFinish(QueryDesc *queryDesc);
240extern void ExecutorEnd(QueryDesc *queryDesc);
241extern void standard_ExecutorEnd(QueryDesc *queryDesc);
242extern void ExecutorRewind(QueryDesc *queryDesc);
243extern bool ExecCheckPermissions(List *rangeTable,
244 List *rteperminfos, bool ereport_on_violation);
245extern bool ExecCheckOneRelPerms(RTEPermissionInfo *perminfo);
246extern void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation,
247 OnConflictAction onConflictAction,
248 List *mergeActions);
249extern void InitResultRelInfo(ResultRelInfo *resultRelInfo,
250 Relation resultRelationDesc,
251 Index resultRelationIndex,
252 ResultRelInfo *partition_root_rri,
253 int instrument_options);
254extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid,
255 ResultRelInfo *rootRelInfo);
256extern List *ExecGetAncestorResultRels(EState *estate, ResultRelInfo *resultRelInfo);
257extern void ExecConstraints(ResultRelInfo *resultRelInfo,
258 TupleTableSlot *slot, EState *estate);
259extern AttrNumber ExecRelGenVirtualNotNull(ResultRelInfo *resultRelInfo,
260 TupleTableSlot *slot,
261 EState *estate,
262 List *notnull_virtual_attrs);
263extern bool ExecPartitionCheck(ResultRelInfo *resultRelInfo,
264 TupleTableSlot *slot, EState *estate, bool emitError);
265extern void ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo,
266 TupleTableSlot *slot, EState *estate);
267extern void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo,
268 TupleTableSlot *slot, EState *estate);
269extern char *ExecBuildSlotValueDescription(Oid reloid, TupleTableSlot *slot,
270 TupleDesc tupdesc,
271 Bitmapset *modifiedCols,
272 int maxfieldlen);
273extern LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo);
274extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti, bool missing_ok);
275extern ExecAuxRowMark *ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist);
276extern TupleTableSlot *EvalPlanQual(EPQState *epqstate, Relation relation,
277 Index rti, TupleTableSlot *inputslot);
278extern void EvalPlanQualInit(EPQState *epqstate, EState *parentestate,
279 Plan *subplan, List *auxrowmarks,
280 int epqParam, List *resultRelations);
281extern void EvalPlanQualSetPlan(EPQState *epqstate,
282 Plan *subplan, List *auxrowmarks);
283extern TupleTableSlot *EvalPlanQualSlot(EPQState *epqstate,
284 Relation relation, Index rti);
285
286 #define EvalPlanQualSetSlot(epqstate, slot) ((epqstate)->origslot = (slot))
287extern bool EvalPlanQualFetchRowMark(EPQState *epqstate, Index rti, TupleTableSlot *slot);
288extern TupleTableSlot *EvalPlanQualNext(EPQState *epqstate);
289extern void EvalPlanQualBegin(EPQState *epqstate);
290extern void EvalPlanQualEnd(EPQState *epqstate);
291
292/*
293 * functions in execProcnode.c
294 */
295extern PlanState *ExecInitNode(Plan *node, EState *estate, int eflags);
296extern void ExecSetExecProcNode(PlanState *node, ExecProcNodeMtd function);
297extern Node *MultiExecProcNode(PlanState *node);
298extern void ExecEndNode(PlanState *node);
299extern void ExecShutdownNode(PlanState *node);
300extern void ExecSetTupleBound(int64 tuples_needed, PlanState *child_node);
301
302
303/* ----------------------------------------------------------------
304 * ExecProcNode
305 *
306 * Execute the given node to return a(nother) tuple.
307 * ----------------------------------------------------------------
308 */
309#ifndef FRONTEND
310static inline TupleTableSlot *
311 ExecProcNode(PlanState *node)
312{
313 if (node->chgParam != NULL) /* something changed? */
314 ExecReScan(node); /* let ReScan handle this */
315
316 return node->ExecProcNode(node);
317}
318#endif
319
320/*
321 * prototypes from functions in execExpr.c
322 */
323extern ExprState *ExecInitExpr(Expr *node, PlanState *parent);
324extern ExprState *ExecInitExprWithParams(Expr *node, ParamListInfo ext_params);
325extern ExprState *ExecInitQual(List *qual, PlanState *parent);
326extern ExprState *ExecInitCheck(List *qual, PlanState *parent);
327extern List *ExecInitExprList(List *nodes, PlanState *parent);
328 extern ExprState *ExecBuildAggTrans(AggState *aggstate, struct AggStatePerPhaseData *phase,
329 bool doSort, bool doHash, bool nullcheck);
330extern ExprState *ExecBuildHash32FromAttrs(TupleDesc desc,
331 const TupleTableSlotOps *ops,
332 FmgrInfo *hashfunctions,
333 Oid *collations,
334 int numCols,
335 AttrNumber *keyColIdx,
336 PlanState *parent,
337 uint32 init_value);
338extern ExprState *ExecBuildHash32Expr(TupleDesc desc,
339 const TupleTableSlotOps *ops,
340 const Oid *hashfunc_oids,
341 const List *collations,
342 const List *hash_exprs,
343 const bool *opstrict, PlanState *parent,
344 uint32 init_value, bool keep_nulls);
345extern ExprState *ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc,
346 const TupleTableSlotOps *lops, const TupleTableSlotOps *rops,
347 int numCols,
348 const AttrNumber *keyColIdx,
349 const Oid *eqfunctions,
350 const Oid *collations,
351 PlanState *parent);
352extern ExprState *ExecBuildParamSetEqual(TupleDesc desc,
353 const TupleTableSlotOps *lops,
354 const TupleTableSlotOps *rops,
355 const Oid *eqfunctions,
356 const Oid *collations,
357 const List *param_exprs,
358 PlanState *parent);
359extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,
360 ExprContext *econtext,
361 TupleTableSlot *slot,
362 PlanState *parent,
363 TupleDesc inputDesc);
364extern ProjectionInfo *ExecBuildUpdateProjection(List *targetList,
365 bool evalTargetList,
366 List *targetColnos,
367 TupleDesc relDesc,
368 ExprContext *econtext,
369 TupleTableSlot *slot,
370 PlanState *parent);
371extern ExprState *ExecPrepareExpr(Expr *node, EState *estate);
372extern ExprState *ExecPrepareQual(List *qual, EState *estate);
373extern ExprState *ExecPrepareCheck(List *qual, EState *estate);
374extern List *ExecPrepareExprList(List *nodes, EState *estate);
375
376/*
377 * ExecEvalExpr
378 *
379 * Evaluate expression identified by "state" in the execution context
380 * given by "econtext". *isNull is set to the is-null flag for the result,
381 * and the Datum value is the function result.
382 *
383 * The caller should already have switched into the temporary memory
384 * context econtext->ecxt_per_tuple_memory. The convenience entry point
385 * ExecEvalExprSwitchContext() is provided for callers who don't prefer to
386 * do the switch in an outer loop.
387 */
388#ifndef FRONTEND
389static inline Datum
390 ExecEvalExpr(ExprState *state,
391 ExprContext *econtext,
392 bool *isNull)
393{
394 return state->evalfunc(state, econtext, isNull);
395}
396#endif
397
398/*
399 * ExecEvalExprNoReturn
400 *
401 * Like ExecEvalExpr(), but for cases where no return value is expected,
402 * because the side-effects of expression evaluation are what's desired. This
403 * is e.g. used for projection and aggregate transition computation.
404
405 * Evaluate expression identified by "state" in the execution context
406 * given by "econtext".
407 *
408 * The caller should already have switched into the temporary memory context
409 * econtext->ecxt_per_tuple_memory. The convenience entry point
410 * ExecEvalExprNoReturnSwitchContext() is provided for callers who don't
411 * prefer to do the switch in an outer loop.
412 */
413#ifndef FRONTEND
414static inline void
415 ExecEvalExprNoReturn(ExprState *state,
416 ExprContext *econtext)
417{
418 PG_USED_FOR_ASSERTS_ONLY Datum retDatum;
419
420 retDatum = state->evalfunc(state, econtext, NULL);
421
422 Assert(retDatum == (Datum) 0);
423}
424#endif
425
426/*
427 * ExecEvalExprSwitchContext
428 *
429 * Same as ExecEvalExpr, but get into the right allocation context explicitly.
430 */
431#ifndef FRONTEND
432static inline Datum
433 ExecEvalExprSwitchContext(ExprState *state,
434 ExprContext *econtext,
435 bool *isNull)
436{
437 Datum retDatum;
438 MemoryContext oldContext;
439
440 oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
441 retDatum = state->evalfunc(state, econtext, isNull);
442 MemoryContextSwitchTo(oldContext);
443 return retDatum;
444}
445#endif
446
447/*
448 * ExecEvalExprNoReturnSwitchContext
449 *
450 * Same as ExecEvalExprNoReturn, but get into the right allocation context
451 * explicitly.
452 */
453#ifndef FRONTEND
454static inline void
455 ExecEvalExprNoReturnSwitchContext(ExprState *state,
456 ExprContext *econtext)
457{
458 MemoryContext oldContext;
459
460 oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
461 ExecEvalExprNoReturn(state, econtext);
462 MemoryContextSwitchTo(oldContext);
463}
464#endif
465
466/*
467 * ExecProject
468 *
469 * Projects a tuple based on projection info and stores it in the slot passed
470 * to ExecBuildProjectionInfo().
471 *
472 * Note: the result is always a virtual tuple; therefore it may reference
473 * the contents of the exprContext's scan tuples and/or temporary results
474 * constructed in the exprContext. If the caller wishes the result to be
475 * valid longer than that data will be valid, he must call ExecMaterializeSlot
476 * on the result slot.
477 */
478#ifndef FRONTEND
479static inline TupleTableSlot *
480 ExecProject(ProjectionInfo *projInfo)
481{
482 ExprContext *econtext = projInfo->pi_exprContext;
483 ExprState *state = &projInfo->pi_state;
484 TupleTableSlot *slot = state->resultslot;
485
486 /*
487 * Clear any former contents of the result slot. This makes it safe for
488 * us to use the slot's Datum/isnull arrays as workspace.
489 */
490 ExecClearTuple(slot);
491
492 /* Run the expression */
493 ExecEvalExprNoReturnSwitchContext(state, econtext);
494
495 /*
496 * Successfully formed a result row. Mark the result slot as containing a
497 * valid virtual tuple (inlined version of ExecStoreVirtualTuple()).
498 */
499 slot->tts_flags &= ~TTS_FLAG_EMPTY;
500 slot->tts_nvalid = slot->tts_tupleDescriptor->natts;
501
502 return slot;
503}
504#endif
505
506/*
507 * ExecQual - evaluate a qual prepared with ExecInitQual (possibly via
508 * ExecPrepareQual). Returns true if qual is satisfied, else false.
509 *
510 * Note: ExecQual used to have a third argument "resultForNull". The
511 * behavior of this function now corresponds to resultForNull == false.
512 * If you want the resultForNull == true behavior, see ExecCheck.
513 */
514#ifndef FRONTEND
515static inline bool
516 ExecQual(ExprState *state, ExprContext *econtext)
517{
518 Datum ret;
519 bool isnull;
520
521 /* short-circuit (here and in ExecInitQual) for empty restriction list */
522 if (state == NULL)
523 return true;
524
525 /* verify that expression was compiled using ExecInitQual */
526 Assert(state->flags & EEO_FLAG_IS_QUAL);
527
528 ret = ExecEvalExprSwitchContext(state, econtext, &isnull);
529
530 /* EEOP_QUAL should never return NULL */
531 Assert(!isnull);
532
533 return DatumGetBool(ret);
534}
535#endif
536
537/*
538 * ExecQualAndReset() - evaluate qual with ExecQual() and reset expression
539 * context.
540 */
541#ifndef FRONTEND
542static inline bool
543 ExecQualAndReset(ExprState *state, ExprContext *econtext)
544{
545 bool ret = ExecQual(state, econtext);
546
547 /* inline ResetExprContext, to avoid ordering issue in this file */
548 MemoryContextReset(econtext->ecxt_per_tuple_memory);
549 return ret;
550}
551#endif
552
553extern bool ExecCheck(ExprState *state, ExprContext *econtext);
554
555/*
556 * prototypes from functions in execSRF.c
557 */
558extern SetExprState *ExecInitTableFunctionResult(Expr *expr,
559 ExprContext *econtext, PlanState *parent);
560extern Tuplestorestate *ExecMakeTableFunctionResult(SetExprState *setexpr,
561 ExprContext *econtext,
562 MemoryContext argContext,
563 TupleDesc expectedDesc,
564 bool randomAccess);
565extern SetExprState *ExecInitFunctionResultSet(Expr *expr,
566 ExprContext *econtext, PlanState *parent);
567extern Datum ExecMakeFunctionResultSet(SetExprState *fcache,
568 ExprContext *econtext,
569 MemoryContext argContext,
570 bool *isNull,
571 ExprDoneCond *isDone);
572
573/*
574 * prototypes from functions in execScan.c
575 */
576 typedef TupleTableSlot *(*ExecScanAccessMtd) (ScanState *node);
577 typedef bool (*ExecScanRecheckMtd) (ScanState *node, TupleTableSlot *slot);
578
579extern TupleTableSlot *ExecScan(ScanState *node, ExecScanAccessMtd accessMtd,
580 ExecScanRecheckMtd recheckMtd);
581extern void ExecAssignScanProjectionInfo(ScanState *node);
582extern void ExecAssignScanProjectionInfoWithVarno(ScanState *node, int varno);
583extern void ExecScanReScan(ScanState *node);
584
585/*
586 * prototypes from functions in execTuples.c
587 */
588extern void ExecInitResultTypeTL(PlanState *planstate);
589extern void ExecInitResultSlot(PlanState *planstate,
590 const TupleTableSlotOps *tts_ops);
591extern void ExecInitResultTupleSlotTL(PlanState *planstate,
592 const TupleTableSlotOps *tts_ops);
593extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate,
594 TupleDesc tupledesc,
595 const TupleTableSlotOps *tts_ops);
596extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate,
597 TupleDesc tupledesc,
598 const TupleTableSlotOps *tts_ops);
599extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate, TupleDesc tupType,
600 const TupleTableSlotOps *tts_ops);
601extern TupleDesc ExecTypeFromTL(List *targetList);
602extern TupleDesc ExecCleanTypeFromTL(List *targetList);
603extern TupleDesc ExecTypeFromExprList(List *exprList);
604extern void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList);
605extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg);
606
607 typedef struct TupOutputState
608{
609 TupleTableSlot *slot;
610 DestReceiver *dest;
611 } TupOutputState;
612
613extern TupOutputState *begin_tup_output_tupdesc(DestReceiver *dest,
614 TupleDesc tupdesc,
615 const TupleTableSlotOps *tts_ops);
616extern void do_tup_output(TupOutputState *tstate, const Datum *values, const bool *isnull);
617extern void do_text_output_multiline(TupOutputState *tstate, const char *txt);
618extern void end_tup_output(TupOutputState *tstate);
619
620/*
621 * Write a single line of text given as a C string.
622 *
623 * Should only be used with a single-TEXT-attribute tupdesc.
624 */
625 #define do_text_output_oneline(tstate, str_to_emit) \
626 do { \
627 Datum values_[1]; \
628 bool isnull_[1]; \
629 values_[0] = PointerGetDatum(cstring_to_text(str_to_emit)); \
630 isnull_[0] = false; \
631 do_tup_output(tstate, values_, isnull_); \
632 pfree(DatumGetPointer(values_[0])); \
633 } while (0)
634
635
636/*
637 * prototypes from functions in execUtils.c
638 */
639extern EState *CreateExecutorState(void);
640extern void FreeExecutorState(EState *estate);
641extern ExprContext *CreateExprContext(EState *estate);
642extern ExprContext *CreateWorkExprContext(EState *estate);
643extern ExprContext *CreateStandaloneExprContext(void);
644extern void FreeExprContext(ExprContext *econtext, bool isCommit);
645extern void ReScanExprContext(ExprContext *econtext);
646
647 #define ResetExprContext(econtext) \
648 MemoryContextReset((econtext)->ecxt_per_tuple_memory)
649
650extern ExprContext *MakePerTupleExprContext(EState *estate);
651
652/* Get an EState's per-output-tuple exprcontext, making it if first use */
653 #define GetPerTupleExprContext(estate) \
654 ((estate)->es_per_tuple_exprcontext ? \
655 (estate)->es_per_tuple_exprcontext : \
656 MakePerTupleExprContext(estate))
657
658 #define GetPerTupleMemoryContext(estate) \
659 (GetPerTupleExprContext(estate)->ecxt_per_tuple_memory)
660
661/* Reset an EState's per-output-tuple exprcontext, if one's been created */
662 #define ResetPerTupleExprContext(estate) \
663 do { \
664 if ((estate)->es_per_tuple_exprcontext) \
665 ResetExprContext((estate)->es_per_tuple_exprcontext); \
666 } while (0)
667
668extern void ExecAssignExprContext(EState *estate, PlanState *planstate);
669extern TupleDesc ExecGetResultType(PlanState *planstate);
670extern const TupleTableSlotOps *ExecGetResultSlotOps(PlanState *planstate,
671 bool *isfixed);
672extern const TupleTableSlotOps *ExecGetCommonSlotOps(PlanState **planstates,
673 int nplans);
674extern const TupleTableSlotOps *ExecGetCommonChildSlotOps(PlanState *ps);
675extern void ExecAssignProjectionInfo(PlanState *planstate,
676 TupleDesc inputDesc);
677extern void ExecConditionalAssignProjectionInfo(PlanState *planstate,
678 TupleDesc inputDesc, int varno);
679extern void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc);
680extern void ExecCreateScanSlotFromOuterPlan(EState *estate,
681 ScanState *scanstate,
682 const TupleTableSlotOps *tts_ops);
683
684extern bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid);
685
686extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags);
687
688extern void ExecInitRangeTable(EState *estate, List *rangeTable, List *permInfos,
689 Bitmapset *unpruned_relids);
690extern void ExecCloseRangeTableRelations(EState *estate);
691extern void ExecCloseResultRelations(EState *estate);
692
693static inline RangeTblEntry *
694 exec_rt_fetch(Index rti, EState *estate)
695{
696 return (RangeTblEntry *) list_nth(estate->es_range_table, rti - 1);
697}
698
699extern Relation ExecGetRangeTableRelation(EState *estate, Index rti,
700 bool isResultRel);
701extern void ExecInitResultRelation(EState *estate, ResultRelInfo *resultRelInfo,
702 Index rti);
703
704extern int executor_errposition(EState *estate, int location);
705
706extern void RegisterExprContextCallback(ExprContext *econtext,
707 ExprContextCallbackFunction function,
708 Datum arg);
709extern void UnregisterExprContextCallback(ExprContext *econtext,
710 ExprContextCallbackFunction function,
711 Datum arg);
712
713extern Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname,
714 bool *isNull);
715extern Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno,
716 bool *isNull);
717
718extern int ExecTargetListLength(List *targetlist);
719extern int ExecCleanTargetListLength(List *targetlist);
720
721extern TupleTableSlot *ExecGetTriggerOldSlot(EState *estate, ResultRelInfo *relInfo);
722extern TupleTableSlot *ExecGetTriggerNewSlot(EState *estate, ResultRelInfo *relInfo);
723extern TupleTableSlot *ExecGetReturningSlot(EState *estate, ResultRelInfo *relInfo);
724extern TupleTableSlot *ExecGetAllNullSlot(EState *estate, ResultRelInfo *relInfo);
725extern TupleConversionMap *ExecGetChildToRootMap(ResultRelInfo *resultRelInfo);
726extern TupleConversionMap *ExecGetRootToChildMap(ResultRelInfo *resultRelInfo, EState *estate);
727
728extern Oid ExecGetResultRelCheckAsUser(ResultRelInfo *relInfo, EState *estate);
729extern Bitmapset *ExecGetInsertedCols(ResultRelInfo *relinfo, EState *estate);
730extern Bitmapset *ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate);
731extern Bitmapset *ExecGetExtraUpdatedCols(ResultRelInfo *relinfo, EState *estate);
732extern Bitmapset *ExecGetAllUpdatedCols(ResultRelInfo *relinfo, EState *estate);
733
734/*
735 * prototypes from functions in execIndexing.c
736 */
737extern void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative);
738extern void ExecCloseIndices(ResultRelInfo *resultRelInfo);
739extern List *ExecInsertIndexTuples(ResultRelInfo *resultRelInfo,
740 TupleTableSlot *slot, EState *estate,
741 bool update,
742 bool noDupErr,
743 bool *specConflict, List *arbiterIndexes,
744 bool onlySummarizing);
745extern bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo,
746 TupleTableSlot *slot,
747 EState *estate, ItemPointer conflictTid,
748 ItemPointer tupleid,
749 List *arbiterIndexes);
750extern void check_exclusion_constraint(Relation heap, Relation index,
751 IndexInfo *indexInfo,
752 ItemPointer tupleid,
753 const Datum *values, const bool *isnull,
754 EState *estate, bool newIndex);
755
756/*
757 * prototypes from functions in execReplication.c
758 */
759extern bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid,
760 LockTupleMode lockmode,
761 TupleTableSlot *searchslot,
762 TupleTableSlot *outslot);
763extern bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode,
764 TupleTableSlot *searchslot, TupleTableSlot *outslot);
765extern bool RelationFindDeletedTupleInfoSeq(Relation rel,
766 TupleTableSlot *searchslot,
767 TransactionId oldestxmin,
768 TransactionId *delete_xid,
769 RepOriginId *delete_origin,
770 TimestampTz *delete_time);
771extern bool RelationFindDeletedTupleInfoByIndex(Relation rel, Oid idxoid,
772 TupleTableSlot *searchslot,
773 TransactionId oldestxmin,
774 TransactionId *delete_xid,
775 RepOriginId *delete_origin,
776 TimestampTz *delete_time);
777extern void ExecSimpleRelationInsert(ResultRelInfo *resultRelInfo,
778 EState *estate, TupleTableSlot *slot);
779extern void ExecSimpleRelationUpdate(ResultRelInfo *resultRelInfo,
780 EState *estate, EPQState *epqstate,
781 TupleTableSlot *searchslot, TupleTableSlot *slot);
782extern void ExecSimpleRelationDelete(ResultRelInfo *resultRelInfo,
783 EState *estate, EPQState *epqstate,
784 TupleTableSlot *searchslot);
785extern void CheckCmdReplicaIdentity(Relation rel, CmdType cmd);
786
787extern void CheckSubscriptionRelkind(char relkind, const char *nspname,
788 const char *relname);
789
790/*
791 * prototypes from functions in nodeModifyTable.c
792 */
793extern TupleTableSlot *ExecGetUpdateNewTuple(ResultRelInfo *relinfo,
794 TupleTableSlot *planSlot,
795 TupleTableSlot *oldSlot);
796extern ResultRelInfo *ExecLookupResultRelByOid(ModifyTableState *node,
797 Oid resultoid,
798 bool missing_ok,
799 bool update_cache);
800
801#endif /* EXECUTOR_H */
int16 AttrNumber
Definition: attnum.h:21
static Datum values[MAXATTR]
Definition: bootstrap.c:153
#define PGDLLIMPORT
Definition: c.h:1319
#define PG_USED_FOR_ASSERTS_ONLY
Definition: c.h:223
int64_t int64
Definition: c.h:535
uint64_t uint64
Definition: c.h:539
uint32_t uint32
Definition: c.h:538
unsigned int Index
Definition: c.h:619
uint32 TransactionId
Definition: c.h:657
size_t Size
Definition: c.h:610
int64 TimestampTz
Definition: timestamp.h:39
ExprDoneCond
Definition: execnodes.h:326
struct TupleHashEntryData TupleHashEntryData
#define EEO_FLAG_IS_QUAL
Definition: execnodes.h:74
TupleTableSlot *(* ExecProcNodeMtd)(PlanState *pstate)
Definition: execnodes.h:1144
static MinimalTuple TupleHashEntryGetTuple(TupleHashEntry entry)
Definition: executor.h:175
TupleDesc ExecGetResultType(PlanState *planstate)
Definition: execUtils.c:495
Relation ExecGetRangeTableRelation(EState *estate, Index rti, bool isResultRel)
Definition: execUtils.c:825
bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode, TupleTableSlot *searchslot, TupleTableSlot *outslot)
bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid, LockTupleMode lockmode, TupleTableSlot *searchslot, TupleTableSlot *outslot)
LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo)
Definition: execMain.c:2520
ResultRelInfo * ExecLookupResultRelByOid(ModifyTableState *node, Oid resultoid, bool missing_ok, bool update_cache)
ExprState * execTuplesMatchPrepare(TupleDesc desc, int numCols, const AttrNumber *keyColIdx, const Oid *eqOperators, const Oid *collations, PlanState *parent)
Definition: execGrouping.c:58
ExecRowMark * ExecFindRowMark(EState *estate, Index rti, bool missing_ok)
Definition: execMain.c:2546
TupleConversionMap * ExecGetRootToChildMap(ResultRelInfo *resultRelInfo, EState *estate)
Definition: execUtils.c:1326
ExecAuxRowMark * ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
Definition: execMain.c:2569
ResultRelInfo * ExecGetTriggerResultRel(EState *estate, Oid relid, ResultRelInfo *rootRelInfo)
Definition: execMain.c:1344
void ExecAssignScanProjectionInfoWithVarno(ScanState *node, int varno)
Definition: execScan.c:94
PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook
Definition: execMain.c:71
TupleTableSlot * EvalPlanQualSlot(EPQState *epqstate, Relation relation, Index rti)
Definition: execMain.c:2767
Bitmapset * ExecGetExtraUpdatedCols(ResultRelInfo *relinfo, EState *estate)
Definition: execUtils.c:1403
void ExecSimpleRelationDelete(ResultRelInfo *resultRelInfo, EState *estate, EPQState *epqstate, TupleTableSlot *searchslot)
void CheckSubscriptionRelkind(char relkind, const char *nspname, const char *relname)
void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation, OnConflictAction onConflictAction, List *mergeActions)
Definition: execMain.c:1050
void EvalPlanQualBegin(EPQState *epqstate)
Definition: execMain.c:2922
Bitmapset * ExecGetInsertedCols(ResultRelInfo *relinfo, EState *estate)
Definition: execUtils.c:1361
TupleTableSlot * ExecGetTriggerNewSlot(EState *estate, ResultRelInfo *relInfo)
Definition: execUtils.c:1226
PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook
Definition: execMain.c:68
char * ExecBuildSlotValueDescription(Oid reloid, TupleTableSlot *slot, TupleDesc tupdesc, Bitmapset *modifiedCols, int maxfieldlen)
Definition: execMain.c:2381
ExprState * ExecBuildHash32FromAttrs(TupleDesc desc, const TupleTableSlotOps *ops, FmgrInfo *hashfunctions, Oid *collations, int numCols, AttrNumber *keyColIdx, PlanState *parent, uint32 init_value)
Definition: execExpr.c:4141
void ReScanExprContext(ExprContext *econtext)
Definition: execUtils.c:443
static TupleTableSlot * ExecProject(ProjectionInfo *projInfo)
Definition: executor.h:480
bool ExecPartitionCheck(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool emitError)
Definition: execMain.c:1846
static void * TupleHashEntryGetAdditional(TupleHashTable hashtable, TupleHashEntry entry)
Definition: executor.h:189
ExprState * ExecInitExpr(Expr *node, PlanState *parent)
Definition: execExpr.c:143
JunkFilter * ExecInitJunkFilterConversion(List *targetList, TupleDesc cleanTupType, TupleTableSlot *slot)
Definition: execJunk.c:137
void do_tup_output(TupOutputState *tstate, const Datum *values, const bool *isnull)
Definition: execTuples.c:2464
ExprState * ExecPrepareExpr(Expr *node, EState *estate)
Definition: execExpr.c:765
bool ExecCheck(ExprState *state, ExprContext *econtext)
Definition: execExpr.c:872
ExprContext * CreateExprContext(EState *estate)
Definition: execUtils.c:307
ExprState * ExecInitCheck(List *qual, PlanState *parent)
Definition: execExpr.c:315
SetExprState * ExecInitFunctionResultSet(Expr *expr, ExprContext *econtext, PlanState *parent)
Definition: execSRF.c:444
bool RelationFindDeletedTupleInfoSeq(Relation rel, TupleTableSlot *searchslot, TransactionId oldestxmin, TransactionId *delete_xid, RepOriginId *delete_origin, TimestampTz *delete_time)
void execTuplesHashPrepare(int numCols, const Oid *eqOperators, Oid **eqFuncOids, FmgrInfo **hashFunctions)
Definition: execGrouping.c:97
void(* ExecutorFinish_hook_type)(QueryDesc *queryDesc)
Definition: executor.h:86
TupleConversionMap * ExecGetChildToRootMap(ResultRelInfo *resultRelInfo)
Definition: execUtils.c:1300
ExprContext * CreateStandaloneExprContext(void)
Definition: execUtils.c:357
void ExecutorEnd(QueryDesc *queryDesc)
Definition: execMain.c:466
void EvalPlanQualInit(EPQState *epqstate, EState *parentestate, Plan *subplan, List *auxrowmarks, int epqParam, List *resultRelations)
Definition: execMain.c:2708
TupleTableSlot * ExecGetTriggerOldSlot(EState *estate, ResultRelInfo *relInfo)
Definition: execUtils.c:1204
TupleDesc ExecCleanTypeFromTL(List *targetList)
Definition: execTuples.c:2139
void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
Definition: execMain.c:2218
int executor_errposition(EState *estate, int location)
Definition: execUtils.c:936
void ExecInitResultSlot(PlanState *planstate, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1968
ProjectionInfo * ExecBuildProjectionInfo(List *targetList, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent, TupleDesc inputDesc)
Definition: execExpr.c:370
void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList)
Definition: execTuples.c:2219
TupleHashEntry LookupTupleHashEntryHash(TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew, uint32 hash)
Definition: execGrouping.c:356
static RangeTblEntry * exec_rt_fetch(Index rti, EState *estate)
Definition: executor.h:694
Tuplestorestate * ExecMakeTableFunctionResult(SetExprState *setexpr, ExprContext *econtext, MemoryContext argContext, TupleDesc expectedDesc, bool randomAccess)
Definition: execSRF.c:101
Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno, bool *isNull)
Definition: execUtils.c:1124
void FreeExprContext(ExprContext *econtext, bool isCommit)
Definition: execUtils.c:416
void ExecInitRangeTable(EState *estate, List *rangeTable, List *permInfos, Bitmapset *unpruned_relids)
Definition: execUtils.c:773
TupleTableSlot * ExecFilterJunk(JunkFilter *junkfilter, TupleTableSlot *slot)
Definition: execJunk.c:247
Node * MultiExecProcNode(PlanState *node)
Definition: execProcnode.c:507
AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, const char *attrName)
Definition: execJunk.c:222
Bitmapset * ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate)
Definition: execUtils.c:1382
TupleTableSlot * ExecGetUpdateNewTuple(ResultRelInfo *relinfo, TupleTableSlot *planSlot, TupleTableSlot *oldSlot)
const TupleTableSlotOps * ExecGetCommonSlotOps(PlanState **planstates, int nplans)
Definition: execUtils.c:536
void ExecInitResultRelation(EState *estate, ResultRelInfo *resultRelInfo, Index rti)
Definition: execUtils.c:880
void end_tup_output(TupOutputState *tstate)
Definition: execTuples.c:2522
void InitResultRelInfo(ResultRelInfo *resultRelInfo, Relation resultRelationDesc, Index resultRelationIndex, ResultRelInfo *partition_root_rri, int instrument_options)
Definition: execMain.c:1243
void ExecMarkPos(PlanState *node)
Definition: execAmi.c:327
void ExecSetTupleBound(int64 tuples_needed, PlanState *child_node)
Definition: execProcnode.c:848
TupleTableSlot * ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
Definition: execScan.c:47
Datum ExecMakeFunctionResultSet(SetExprState *fcache, ExprContext *econtext, MemoryContext argContext, bool *isNull, ExprDoneCond *isDone)
Definition: execSRF.c:497
void standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
Definition: execMain.c:141
void ExecCreateScanSlotFromOuterPlan(EState *estate, ScanState *scanstate, const TupleTableSlotOps *tts_ops)
Definition: execUtils.c:704
void ExecutorFinish(QueryDesc *queryDesc)
Definition: execMain.c:406
bool ExecSupportsMarkRestore(Path *pathnode)
Definition: execAmi.c:418
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:562
JunkFilter * ExecInitJunkFilter(List *targetList, TupleTableSlot *slot)
Definition: execJunk.c:60
void ExecSimpleRelationUpdate(ResultRelInfo *resultRelInfo, EState *estate, EPQState *epqstate, TupleTableSlot *searchslot, TupleTableSlot *slot)
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:2000
TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew, uint32 *hash)
Definition: execGrouping.c:301
void EvalPlanQualEnd(EPQState *epqstate)
Definition: execMain.c:3169
void ExecInitResultTypeTL(PlanState *planstate)
Definition: execTuples.c:1944
void EvalPlanQualSetPlan(EPQState *epqstate, Plan *subplan, List *auxrowmarks)
Definition: execMain.c:2750
void CheckCmdReplicaIdentity(Relation rel, CmdType cmd)
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:142
ExprState * ExecBuildAggTrans(AggState *aggstate, struct AggStatePerPhaseData *phase, bool doSort, bool doHash, bool nullcheck)
void(* ExecutorRun_hook_type)(QueryDesc *queryDesc, ScanDirection direction, uint64 count)
Definition: executor.h:80
void ExecSimpleRelationInsert(ResultRelInfo *resultRelInfo, EState *estate, TupleTableSlot *slot)
AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter, const char *attrName)
Definition: execJunk.c:210
PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook
Definition: execMain.c:70
void ExecutorRewind(QueryDesc *queryDesc)
Definition: execMain.c:536
void do_text_output_multiline(TupOutputState *tstate, const char *txt)
Definition: execTuples.c:2492
void ExecShutdownNode(PlanState *node)
Definition: execProcnode.c:772
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:485
void ExecutorStart(QueryDesc *queryDesc, int eflags)
Definition: execMain.c:122
ExprState * ExecPrepareQual(List *qual, EState *estate)
Definition: execExpr.c:793
AttrNumber ExecRelGenVirtualNotNull(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, List *notnull_virtual_attrs)
Definition: execMain.c:2084
SetExprState * ExecInitTableFunctionResult(Expr *expr, ExprContext *econtext, PlanState *parent)
Definition: execSRF.c:56
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:229
TupleTableSlot * EvalPlanQual(EPQState *epqstate, Relation relation, Index rti, TupleTableSlot *inputslot)
Definition: execMain.c:2639
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
Definition: execUtils.c:583
void(* ExecutorStart_hook_type)(QueryDesc *queryDesc, int eflags)
Definition: executor.h:76
static bool ExecQual(ExprState *state, ExprContext *econtext)
Definition: executor.h:516
ExprContext * MakePerTupleExprContext(EState *estate)
Definition: execUtils.c:458
bool ExecCheckOneRelPerms(RTEPermissionInfo *perminfo)
Definition: execMain.c:646
void UnregisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg)
Definition: execUtils.c:989
void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc)
Definition: execUtils.c:692
bool(* ExecScanRecheckMtd)(ScanState *node, TupleTableSlot *slot)
Definition: executor.h:577
const TupleTableSlotOps * ExecGetCommonChildSlotOps(PlanState *ps)
Definition: execUtils.c:563
TupleTableSlot * ExecInitExtraTupleSlot(EState *estate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:2020
bool(* ExecutorCheckPerms_hook_type)(List *rangeTable, List *rtePermInfos, bool ereport_on_violation)
Definition: executor.h:94
uint32 TupleHashTableHash(TupleHashTable hashtable, TupleTableSlot *slot)
Definition: execGrouping.c:333
bool EvalPlanQualFetchRowMark(EPQState *epqstate, Index rti, TupleTableSlot *slot)
Definition: execMain.c:2795
List * ExecInitExprList(List *nodes, PlanState *parent)
Definition: execExpr.c:335
void ExecConditionalAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc, int varno)
Definition: execUtils.c:603
bool RelationFindDeletedTupleInfoByIndex(Relation rel, Oid idxoid, TupleTableSlot *searchslot, TransactionId oldestxmin, TransactionId *delete_xid, RepOriginId *delete_origin, TimestampTz *delete_time)
void(* ExecutorEnd_hook_type)(QueryDesc *queryDesc)
Definition: executor.h:90
void ExecInitResultTupleSlotTL(PlanState *planstate, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1988
void ExecCloseIndices(ResultRelInfo *resultRelInfo)
Definition: execIndexing.c:238
void RegisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg)
Definition: execUtils.c:963
static bool ExecQualAndReset(ExprState *state, ExprContext *econtext)
Definition: executor.h:543
ExprState * ExecInitExprWithParams(Expr *node, ParamListInfo ext_params)
Definition: execExpr.c:180
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:81
int ExecTargetListLength(List *targetlist)
Definition: execUtils.c:1175
ProjectionInfo * ExecBuildUpdateProjection(List *targetList, bool evalTargetList, List *targetColnos, TupleDesc relDesc, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent)
Definition: execExpr.c:547
void FreeExecutorState(EState *estate)
Definition: execUtils.c:192
struct TupOutputState TupOutputState
static size_t TupleHashEntrySize(void)
Definition: executor.h:166
bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid)
Definition: execUtils.c:729
ExprState * ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, const TupleTableSlotOps *lops, const TupleTableSlotOps *rops, int numCols, const AttrNumber *keyColIdx, const Oid *eqfunctions, const Oid *collations, PlanState *parent)
Definition: execExpr.c:4465
TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, ExprState *eqcomp, ExprState *hashexpr)
Definition: execGrouping.c:388
void ExecCloseResultRelations(EState *estate)
Definition: execMain.c:1565
static TupleTableSlot * ExecProcNode(PlanState *node)
Definition: executor.h:311
TupleTableSlot * ExecGetAllNullSlot(EState *estate, ResultRelInfo *relInfo)
Definition: execUtils.c:1273
bool ExecMaterializesOutput(NodeTag plantype)
Definition: execAmi.c:636
void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative)
Definition: execIndexing.c:160
int ExecCleanTargetListLength(List *targetlist)
Definition: execUtils.c:1185
ExprContext * CreateWorkExprContext(EState *estate)
Definition: execUtils.c:322
TupOutputState * begin_tup_output_tupdesc(DestReceiver *dest, TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:2444
TupleTableSlot *(* ExecScanAccessMtd)(ScanState *node)
Definition: executor.h:576
void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg)
Definition: execUtils.c:910
void ExecScanReScan(ScanState *node)
Definition: execScan.c:108
bool ExecSupportsBackwardScan(Plan *node)
Definition: execAmi.c:511
const TupleTableSlotOps * ExecGetResultSlotOps(PlanState *planstate, bool *isfixed)
Definition: execUtils.c:504
Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname, bool *isNull)
Definition: execUtils.c:1061
TupleHashTable BuildTupleHashTable(PlanState *parent, TupleDesc inputDesc, const TupleTableSlotOps *inputOps, int numCols, AttrNumber *keyColIdx, const Oid *eqfuncoids, FmgrInfo *hashfunctions, Oid *collations, long nbuckets, Size additionalsize, MemoryContext metacxt, MemoryContext tablecxt, MemoryContext tempcxt, bool use_variable_hash_iv)
Definition: execGrouping.c:167
PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook
Definition: execMain.c:74
bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, ItemPointer conflictTid, ItemPointer tupleid, List *arbiterIndexes)
Definition: execIndexing.c:542
Bitmapset * ExecGetAllUpdatedCols(ResultRelInfo *relinfo, EState *estate)
Definition: execUtils.c:1418
void ExecReScan(PlanState *node)
Definition: execAmi.c:77
static void ExecEvalExprNoReturn(ExprState *state, ExprContext *econtext)
Definition: executor.h:415
PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook
Definition: execMain.c:69
TupleDesc ExecTypeFromExprList(List *exprList)
Definition: execTuples.c:2186
List * ExecInsertIndexTuples(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool update, bool noDupErr, bool *specConflict, List *arbiterIndexes, bool onlySummarizing)
Definition: execIndexing.c:309
TupleDesc ExecTypeFromTL(List *targetList)
Definition: execTuples.c:2127
void standard_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count)
Definition: execMain.c:307
static Datum ExecEvalExpr(ExprState *state, ExprContext *econtext, bool *isNull)
Definition: executor.h:390
bool execCurrentOf(CurrentOfExpr *cexpr, ExprContext *econtext, Oid table_oid, ItemPointer current_tid)
Definition: execCurrent.c:44
void ResetTupleHashTable(TupleHashTable hashtable)
Definition: execGrouping.c:280
List * ExecPrepareExprList(List *nodes, EState *estate)
Definition: execExpr.c:839
void standard_ExecutorEnd(QueryDesc *queryDesc)
Definition: execMain.c:475
void ExecRestrPos(PlanState *node)
Definition: execAmi.c:376
static void ExecEvalExprNoReturnSwitchContext(ExprState *state, ExprContext *econtext)
Definition: executor.h:455
void ExecCloseRangeTableRelations(EState *estate)
Definition: execMain.c:1625
static Datum ExecEvalExprSwitchContext(ExprState *state, ExprContext *econtext, bool *isNull)
Definition: executor.h:433
void check_exclusion_constraint(Relation heap, Relation index, IndexInfo *indexInfo, ItemPointer tupleid, const Datum *values, const bool *isnull, EState *estate, bool newIndex)
Definition: execIndexing.c:956
void ExecSetExecProcNode(PlanState *node, ExecProcNodeMtd function)
Definition: execProcnode.c:430
void ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
Definition: execMain.c:1899
ExprState * ExecBuildParamSetEqual(TupleDesc desc, const TupleTableSlotOps *lops, const TupleTableSlotOps *rops, const Oid *eqfunctions, const Oid *collations, const List *param_exprs, PlanState *parent)
Definition: execExpr.c:4624
void ExecConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
Definition: execMain.c:1970
TupleTableSlot * ExecInitNullTupleSlot(EState *estate, TupleDesc tupType, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:2036
TupleTableSlot * ExecGetReturningSlot(EState *estate, ResultRelInfo *relInfo)
Definition: execUtils.c:1248
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:742
bool ExecCheckPermissions(List *rangeTable, List *rteperminfos, bool ereport_on_violation)
Definition: execMain.c:582
static Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull)
Definition: executor.h:222
void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count)
Definition: execMain.c:297
Oid ExecGetResultRelCheckAsUser(ResultRelInfo *relInfo, EState *estate)
Definition: execUtils.c:1489
ExprState * ExecBuildHash32Expr(TupleDesc desc, const TupleTableSlotOps *ops, const Oid *hashfunc_oids, const List *collations, const List *hash_exprs, const bool *opstrict, PlanState *parent, uint32 init_value, bool keep_nulls)
Definition: execExpr.c:4300
EState * CreateExecutorState(void)
Definition: execUtils.c:88
ExprState * ExecPrepareCheck(List *qual, EState *estate)
Definition: execExpr.c:816
List * ExecGetAncestorResultRels(EState *estate, ResultRelInfo *resultRelInfo)
Definition: execMain.c:1420
TupleTableSlot * EvalPlanQualNext(EPQState *epqstate)
Definition: execMain.c:2906
void standard_ExecutorFinish(QueryDesc *queryDesc)
Definition: execMain.c:415
void(* ExprContextCallbackFunction)(Datum arg)
Definition: fmgr.h:26
Assert(PointerIsAligned(start, uint64))
struct parser_state ps
LockTupleMode
Definition: lockoptions.h:50
void MemoryContextReset(MemoryContext context)
Definition: mcxt.c:400
OnConflictAction
Definition: nodes.h:427
CmdType
Definition: nodes.h:273
NodeTag
Definition: nodes.h:27
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:124
WCOKind
Definition: parsenodes.h:1389
NameData attname
Definition: pg_attribute.h:41
on_exit_nicely_callback function
void * arg
NameData relname
Definition: pg_class.h:38
static void * list_nth(const List *list, int n)
Definition: pg_list.h:299
static bool DatumGetBool(Datum X)
Definition: postgres.h:100
uint64_t Datum
Definition: postgres.h:70
unsigned int Oid
Definition: postgres_ext.h:32
static unsigned hash(unsigned *uv, int n)
Definition: rege_dfa.c:715
ScanDirection
Definition: sdir.h:25
Definition: execnodes.h:655
List * es_range_table
Definition: execnodes.h:662
MemoryContext ecxt_per_tuple_memory
Definition: execnodes.h:281
Definition: primnodes.h:189
Definition: fmgr.h:57
Definition: pg_list.h:54
Definition: nodes.h:135
Definition: pathnodes.h:1778
Bitmapset * chgParam
Definition: execnodes.h:1191
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1165
Definition: plannodes.h:177
ExprState pi_state
Definition: execnodes.h:386
ExprContext * pi_exprContext
Definition: execnodes.h:388
Definition: rel.h:56
TupleTableSlot * slot
Definition: executor.h:609
DestReceiver * dest
Definition: executor.h:610
int natts
Definition: tupdesc.h:137
MinimalTuple firstTuple
Definition: execnodes.h:849
Size additionalsize
Definition: execnodes.h:872
TupleDesc tts_tupleDescriptor
Definition: tuptable.h:123
AttrNumber tts_nvalid
Definition: tuptable.h:120
uint16 tts_flags
Definition: tuptable.h:118
Definition: type.h:96
Definition: regguts.h:323
static Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull)
Definition: tuptable.h:399
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:458
uint16 RepOriginId
Definition: xlogdefs.h:68

AltStyle によって変換されたページ (->オリジナル) /