PostgreSQL Source Code  git master
execnodes.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * execnodes.h
4  * definitions for executor state nodes
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/nodes/execnodes.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef EXECNODES_H
15 #define EXECNODES_H
16 
17 #include "access/genam.h"
18 #include "access/heapam.h"
19 #include "access/tupconvert.h"
20 #include "executor/instrument.h"
21 #include "lib/pairingheap.h"
22 #include "nodes/params.h"
23 #include "nodes/plannodes.h"
24 #include "utils/hsearch.h"
25 #include "utils/queryenvironment.h"
26 #include "utils/reltrigger.h"
27 #include "utils/sharedtuplestore.h"
28 #include "utils/sortsupport.h"
29 #include "utils/tuplestore.h"
30 #include "utils/tuplesort.h"
31 #include "nodes/tidbitmap.h"
33 
34 
35 struct PlanState; /* forward references in this file */
37 struct ExprState;
38 struct ExprContext;
39 struct ExprEvalStep; /* avoid including execExpr.h everywhere */
40 
41 
42 /* ----------------
43  * ExprState node
44  *
45  * ExprState is the top-level node for expression evaluation.
46  * It contains instructions (in ->steps) to evaluate the expression.
47  * ----------------
48  */
49 typedef Datum (*ExprStateEvalFunc) (struct ExprState *expression,
50  struct ExprContext *econtext,
51  bool *isNull);
52 
53 /* Bits in ExprState->flags (see also execExpr.h for private flag bits): */
54 /* expression is for use with ExecQual() */
55 #define EEO_FLAG_IS_QUAL (1 << 0)
56 
57 typedef struct ExprState
58 {
60 
61  uint8 flags; /* bitmask of EEO_FLAG_* bits, see above */
62 
63  /*
64  * Storage for result value of a scalar expression, or for individual
65  * column results within expressions built by ExecBuildProjectionInfo().
66  */
67  bool resnull;
69 
70  /*
71  * If projecting a tuple result, this slot holds the result; else NULL.
72  */
74 
75  /*
76  * Instructions to compute expression's return value.
77  */
79 
80  /*
81  * Function that actually evaluates the expression. This can be set to
82  * different values depending on the complexity of the expression.
83  */
85 
86  /* original expression tree, for debugging only */
88 
89  /* private state for an evalfunc */
91 
92  /*
93  * XXX: following fields only needed during "compilation" (ExecInitExpr);
94  * could be thrown away afterwards.
95  */
96 
97  int steps_len; /* number of steps currently */
98  int steps_alloc; /* allocated length of steps array */
99 
100  struct PlanState *parent; /* parent PlanState node, if any */
101  ParamListInfo ext_params; /* for compiling PARAM_EXTERN nodes */
102 
105 
108 } ExprState;
109 
110 
111 /* ----------------
112  * IndexInfo information
113  *
114  * this struct holds the information needed to construct new index
115  * entries for a particular index. Used for both index_build and
116  * retail creation of index entries.
117  *
118  * NumIndexAttrs number of columns in this index
119  * KeyAttrNumbers underlying-rel attribute numbers used as keys
120  * (zeroes indicate expressions)
121  * Expressions expr trees for expression entries, or NIL if none
122  * ExpressionsState exec state for expressions, or NIL if none
123  * Predicate partial-index predicate, or NIL if none
124  * PredicateState exec state for predicate, or NIL if none
125  * ExclusionOps Per-column exclusion operators, or NULL if none
126  * ExclusionProcs Underlying function OIDs for ExclusionOps
127  * ExclusionStrats Opclass strategy numbers for ExclusionOps
128  * UniqueOps Theses are like Exclusion*, but for unique indexes
129  * UniqueProcs
130  * UniqueStrats
131  * Unique is it a unique index?
132  * ReadyForInserts is it valid for inserts?
133  * Concurrent are we doing a concurrent index build?
134  * BrokenHotChain did we detect any broken HOT chains?
135  * ParallelWorkers # of workers requested (excludes leader)
136  * AmCache private cache area for index AM
137  * Context memory context holding this IndexInfo
138  *
139  * ii_Concurrent, ii_BrokenHotChain, and ii_ParallelWorkers are used only
140  * during index build; they're conventionally zeroed otherwise.
141  * ----------------
142  */
143 typedef struct IndexInfo
144 {
147  AttrNumber ii_KeyAttrNumbers[INDEX_MAX_KEYS];
148  List *ii_Expressions; /* list of Expr */
149  List *ii_ExpressionsState; /* list of ExprState */
150  List *ii_Predicate; /* list of Expr */
152  Oid *ii_ExclusionOps; /* array with one entry per column */
153  Oid *ii_ExclusionProcs; /* array with one entry per column */
154  uint16 *ii_ExclusionStrats; /* array with one entry per column */
155  Oid *ii_UniqueOps; /* array with one entry per column */
156  Oid *ii_UniqueProcs; /* array with one entry per column */
157  uint16 *ii_UniqueStrats; /* array with one entry per column */
158  bool ii_Unique;
164  void *ii_AmCache;
166 } IndexInfo;
167 
168 /* ----------------
169  * ExprContext_CB
170  *
171  * List of callbacks to be called at ExprContext shutdown.
172  * ----------------
173  */
175 
176 typedef struct ExprContext_CB
177 {
182 
183 /* ----------------
184  * ExprContext
185  *
186  * This class holds the "current context" information
187  * needed to evaluate expressions for doing tuple qualifications
188  * and tuple projections. For example, if an expression refers
189  * to an attribute in the current inner tuple then we need to know
190  * what the current inner tuple is and so we look at the expression
191  * context.
192  *
193  * There are two memory contexts associated with an ExprContext:
194  * * ecxt_per_query_memory is a query-lifespan context, typically the same
195  * context the ExprContext node itself is allocated in. This context
196  * can be used for purposes such as storing function call cache info.
197  * * ecxt_per_tuple_memory is a short-term context for expression results.
198  * As the name suggests, it will typically be reset once per tuple,
199  * before we begin to evaluate expressions for that tuple. Each
200  * ExprContext normally has its very own per-tuple memory context.
201  *
202  * CurrentMemoryContext should be set to ecxt_per_tuple_memory before
203  * calling ExecEvalExpr() --- see ExecEvalExprSwitchContext().
204  * ----------------
205  */
206 typedef struct ExprContext
207 {
209 
210  /* Tuples that Var nodes in expression may refer to */
214 
215  /* Memory contexts for expression evaluation --- see notes above */
218 
219  /* Values to substitute for Param nodes in expression */
220  ParamExecData *ecxt_param_exec_vals; /* for PARAM_EXEC params */
221  ParamListInfo ecxt_param_list_info; /* for other param types */
222 
223  /*
224  * Values to substitute for Aggref nodes in the expressions of an Agg
225  * node, or for WindowFunc nodes within a WindowAgg node.
226  */
227  Datum *ecxt_aggvalues; /* precomputed values for aggs/windowfuncs */
228  bool *ecxt_aggnulls; /* null flags for aggs/windowfuncs */
229 
230  /* Value to substitute for CaseTestExpr nodes in expression */
233 
234  /* Value to substitute for CoerceToDomainValue nodes in expression */
237 
238  /* Link to containing EState (NULL if a standalone ExprContext) */
240 
241  /* Functions to call back when ExprContext is shut down or rescanned */
243 } ExprContext;
244 
245 /*
246  * Set-result status used when evaluating functions potentially returning a
247  * set.
248  */
249 typedef enum
250 {
251  ExprSingleResult, /* expression does not return a set */
252  ExprMultipleResult, /* this result is an element of a set */
253  ExprEndResult /* there are no more elements in the set */
254 } ExprDoneCond;
255 
256 /*
257  * Return modes for functions returning sets. Note values must be chosen
258  * as separate bits so that a bitmask can be formed to indicate supported
259  * modes. SFRM_Materialize_Random and SFRM_Materialize_Preferred are
260  * auxiliary flags about SFRM_Materialize mode, rather than separate modes.
261  */
262 typedef enum
263 {
264  SFRM_ValuePerCall = 0x01, /* one value returned per call */
265  SFRM_Materialize = 0x02, /* result set instantiated in Tuplestore */
266  SFRM_Materialize_Random = 0x04, /* Tuplestore needs randomAccess */
267  SFRM_Materialize_Preferred = 0x08 /* caller prefers Tuplestore */
269 
270 /*
271  * When calling a function that might return a set (multiple rows),
272  * a node of this type is passed as fcinfo->resultinfo to allow
273  * return status to be passed back. A function returning set should
274  * raise an error if no such resultinfo is provided.
275  */
276 typedef struct ReturnSetInfo
277 {
279  /* values set by caller: */
280  ExprContext *econtext; /* context function is being called in */
281  TupleDesc expectedDesc; /* tuple descriptor expected by caller */
282  int allowedModes; /* bitmask: return modes caller can handle */
283  /* result status from function (but pre-initialized by caller): */
284  SetFunctionReturnMode returnMode; /* actual return mode */
285  ExprDoneCond isDone; /* status for ValuePerCall mode */
286  /* fields filled by function in Materialize return mode: */
287  Tuplestorestate *setResult; /* holds the complete returned tuple set */
288  TupleDesc setDesc; /* actual descriptor for returned tuples */
289 } ReturnSetInfo;
290 
291 /* ----------------
292  * ProjectionInfo node information
293  *
294  * This is all the information needed to perform projections ---
295  * that is, form new tuples by evaluation of targetlist expressions.
296  * Nodes which need to do projections create one of these.
297  *
298  * The target tuple slot is kept in ProjectionInfo->pi_state.resultslot.
299  * ExecProject() evaluates the tlist, forms a tuple, and stores it
300  * in the given slot. Note that the result will be a "virtual" tuple
301  * unless ExecMaterializeSlot() is then called to force it to be
302  * converted to a physical tuple. The slot must have a tupledesc
303  * that matches the output of the tlist!
304  * ----------------
305  */
306 typedef struct ProjectionInfo
307 {
309  /* instructions to evaluate projection */
311  /* expression context in which to evaluate expression */
314 
315 /* ----------------
316  * JunkFilter
317  *
318  * This class is used to store information regarding junk attributes.
319  * A junk attribute is an attribute in a tuple that is needed only for
320  * storing intermediate information in the executor, and does not belong
321  * in emitted tuples. For example, when we do an UPDATE query,
322  * the planner adds a "junk" entry to the targetlist so that the tuples
323  * returned to ExecutePlan() contain an extra attribute: the ctid of
324  * the tuple to be updated. This is needed to do the update, but we
325  * don't want the ctid to be part of the stored new tuple! So, we
326  * apply a "junk filter" to remove the junk attributes and form the
327  * real output tuple. The junkfilter code also provides routines to
328  * extract the values of the junk attribute(s) from the input tuple.
329  *
330  * targetList: the original target list (including junk attributes).
331  * cleanTupType: the tuple descriptor for the "clean" tuple (with
332  * junk attributes removed).
333  * cleanMap: A map with the correspondence between the non-junk
334  * attribute numbers of the "original" tuple and the
335  * attribute numbers of the "clean" tuple.
336  * resultSlot: tuple slot used to hold cleaned tuple.
337  * junkAttNo: not used by junkfilter code. Can be used by caller
338  * to remember the attno of a specific junk attribute
339  * (nodeModifyTable.c keeps the "ctid" or "wholerow"
340  * attno here).
341  * ----------------
342  */
343 typedef struct JunkFilter
344 {
351 } JunkFilter;
352 
353 /*
354  * ResultRelInfo
355  *
356  * Whenever we update an existing relation, we have to update indexes on the
357  * relation, and perhaps also fire triggers. ResultRelInfo holds all the
358  * information needed about a result relation, including indexes.
359  */
360 typedef struct ResultRelInfo
361 {
363 
364  /* result relation's range table index */
366 
367  /* relation descriptor for result relation */
369 
370  /* # of indices existing on result relation */
372 
373  /* array of relation descriptors for indices */
375 
376  /* array of key/attr info for indices */
378 
379  /* triggers to be fired, if any */
381 
382  /* cached lookup info for trigger functions */
384 
385  /* array of trigger WHEN expr states */
387 
388  /* optional runtime measurements for triggers */
390 
391  /* FDW callback functions, if foreign table */
393 
394  /* available to save private state of FDW */
395  void *ri_FdwState;
396 
397  /* true when modifying foreign table directly */
399 
400  /* list of WithCheckOption's to be checked */
402 
403  /* list of WithCheckOption expr states */
405 
406  /* array of constraint-checking expr states */
408 
409  /* for removing junk attributes from tuples */
411 
412  /* for computing a RETURNING list */
414 
415  /* for computing ON CONFLICT DO UPDATE SET */
417 
418  /* list of ON CONFLICT DO UPDATE exprs (qual) */
420 
421  /* partition check expression */
423 
424  /* partition check expression state */
426 
427  /* relation descriptor for root partitioned table */
429 } ResultRelInfo;
430 
431 /* ----------------
432  * EState information
433  *
434  * Master working state for an Executor invocation
435  * ----------------
436  */
437 typedef struct EState
438 {
440 
441  /* Basic state for all query types: */
442  ScanDirection es_direction; /* current scan direction */
443  Snapshot es_snapshot; /* time qual to use */
444  Snapshot es_crosscheck_snapshot; /* crosscheck time qual for RI */
445  List *es_range_table; /* List of RangeTblEntry */
446  PlannedStmt *es_plannedstmt; /* link to top of plan tree */
447  const char *es_sourceText; /* Source text from QueryDesc */
448 
449  JunkFilter *es_junkFilter; /* top-level junk filter, if any */
450 
451  /* If query can insert/delete tuples, the command ID to mark them with */
453 
454  /* Info about target table(s) for insert/update/delete queries: */
455  ResultRelInfo *es_result_relations; /* array of ResultRelInfos */
456  int es_num_result_relations; /* length of array */
457  ResultRelInfo *es_result_relation_info; /* currently active array elt */
458 
459  /*
460  * Info about the target partitioned target table root(s) for
461  * update/delete queries. They required only to fire any per-statement
462  * triggers defined on the table. It exists separately from
463  * es_result_relations, because partitioned tables don't appear in the
464  * plan tree for the update/delete cases.
465  */
466  ResultRelInfo *es_root_result_relations; /* array of ResultRelInfos */
467  int es_num_root_result_relations; /* length of the array */
468 
469  /*
470  * The following list contains ResultRelInfos created by the tuple
471  * routing code for partitions that don't already have one.
472  */
474 
475  /* Stuff used for firing triggers: */
476  List *es_trig_target_relations; /* trigger-only ResultRelInfos */
477  TupleTableSlot *es_trig_tuple_slot; /* for trigger output tuples */
478  TupleTableSlot *es_trig_oldtup_slot; /* for TriggerEnabled */
479  TupleTableSlot *es_trig_newtup_slot; /* for TriggerEnabled */
480 
481  /* Parameter info: */
482  ParamListInfo es_param_list_info; /* values of external params */
483  ParamExecData *es_param_exec_vals; /* values of internal params */
484 
485  QueryEnvironment *es_queryEnv; /* query environment */
486 
487  /* Other working state: */
488  MemoryContext es_query_cxt; /* per-query context in which EState lives */
489 
490  List *es_tupleTable; /* List of TupleTableSlots */
491 
492  List *es_rowMarks; /* List of ExecRowMarks */
493 
494  uint64 es_processed; /* # of tuples processed */
495  Oid es_lastoid; /* last oid processed (by INSERT) */
496 
497  int es_top_eflags; /* eflags passed to ExecutorStart */
498  int es_instrument; /* OR of InstrumentOption flags */
499  bool es_finished; /* true when ExecutorFinish is done */
500 
501  List *es_exprcontexts; /* List of ExprContexts within EState */
502 
503  List *es_subplanstates; /* List of PlanState for SubPlans */
504 
505  List *es_auxmodifytables; /* List of secondary ModifyTableStates */
506 
507  /*
508  * this ExprContext is for per-output-tuple operations, such as constraint
509  * checks and index-value computations. It will be reset for each output
510  * tuple. Note that it will be created only if needed.
511  */
513 
514  /*
515  * These fields are for re-evaluating plan quals when an updated tuple is
516  * substituted in READ COMMITTED mode. es_epqTuple[] contains tuples that
517  * scan plan nodes should return instead of whatever they'd normally
518  * return, or NULL if nothing to return; es_epqTupleSet[] is true if a
519  * particular array entry is valid; and es_epqScanDone[] is state to
520  * remember if the tuple has been returned already. Arrays are of size
521  * list_length(es_range_table) and are indexed by scan node scanrelid - 1.
522  */
523  HeapTuple *es_epqTuple; /* array of EPQ substitute tuples */
524  bool *es_epqTupleSet; /* true if EPQ tuple is provided */
525  bool *es_epqScanDone; /* true if EPQ tuple has been fetched */
526 
527  bool es_use_parallel_mode; /* can we use parallel workers? */
528 
529  /* The per-query shared memory area to use for parallel execution. */
531 } EState;
532 
533 
534 /*
535  * ExecRowMark -
536  * runtime representation of FOR [KEY] UPDATE/SHARE clauses
537  *
538  * When doing UPDATE, DELETE, or SELECT FOR [KEY] UPDATE/SHARE, we will have an
539  * ExecRowMark for each non-target relation in the query (except inheritance
540  * parent RTEs, which can be ignored at runtime). Virtual relations such as
541  * subqueries-in-FROM will have an ExecRowMark with relation == NULL. See
542  * PlanRowMark for details about most of the fields. In addition to fields
543  * directly derived from PlanRowMark, we store an activity flag (to denote
544  * inactive children of inheritance trees), curCtid, which is used by the
545  * WHERE CURRENT OF code, and ermExtra, which is available for use by the plan
546  * node that sources the relation (e.g., for a foreign table the FDW can use
547  * ermExtra to hold information).
548  *
549  * EState->es_rowMarks is a list of these structs.
550  */
551 typedef struct ExecRowMark
552 {
553  Relation relation; /* opened and suitably locked relation */
554  Oid relid; /* its OID (or InvalidOid, if subquery) */
555  Index rti; /* its range table index */
556  Index prti; /* parent range table index, if child */
557  Index rowmarkId; /* unique identifier for resjunk columns */
558  RowMarkType markType; /* see enum in nodes/plannodes.h */
559  LockClauseStrength strength; /* LockingClause's strength, or LCS_NONE */
560  LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
561  bool ermActive; /* is this mark relevant for current tuple? */
562  ItemPointerData curCtid; /* ctid of currently locked tuple, if any */
563  void *ermExtra; /* available for use by relation source node */
564 } ExecRowMark;
565 
566 /*
567  * ExecAuxRowMark -
568  * additional runtime representation of FOR [KEY] UPDATE/SHARE clauses
569  *
570  * Each LockRows and ModifyTable node keeps a list of the rowmarks it needs to
571  * deal with. In addition to a pointer to the related entry in es_rowMarks,
572  * this struct carries the column number(s) of the resjunk columns associated
573  * with the rowmark (see comments for PlanRowMark for more detail). In the
574  * case of ModifyTable, there has to be a separate ExecAuxRowMark list for
575  * each child plan, because the resjunk columns could be at different physical
576  * column positions in different subplans.
577  */
578 typedef struct ExecAuxRowMark
579 {
580  ExecRowMark *rowmark; /* related entry in es_rowMarks */
581  AttrNumber ctidAttNo; /* resno of ctid junk attribute, if any */
582  AttrNumber toidAttNo; /* resno of tableoid junk attribute, if any */
583  AttrNumber wholeAttNo; /* resno of whole-row junk attribute, if any */
585 
586 
587 /* ----------------------------------------------------------------
588  * Tuple Hash Tables
589  *
590  * All-in-memory tuple hash tables are used for a number of purposes.
591  *
592  * Note: tab_hash_funcs are for the key datatype(s) stored in the table,
593  * and tab_eq_funcs are non-cross-type equality operators for those types.
594  * Normally these are the only functions used, but FindTupleHashEntry()
595  * supports searching a hashtable using cross-data-type hashing. For that,
596  * the caller must supply hash functions for the LHS datatype as well as
597  * the cross-type equality operators to use. in_hash_funcs and cur_eq_func
598  * are set to point to the caller's function arrays while doing such a search.
599  * During LookupTupleHashEntry(), they point to tab_hash_funcs and
600  * tab_eq_func respectively.
601  * ----------------------------------------------------------------
602  */
605 
606 typedef struct TupleHashEntryData
607 {
608  MinimalTuple firstTuple; /* copy of first tuple in this group */
609  void *additional; /* user data */
610  uint32 status; /* hash status */
611  uint32 hash; /* hash value (cached) */
613 
614 /* define parameters necessary to generate the tuple hash table interface */
615 #define SH_PREFIX tuplehash
616 #define SH_ELEMENT_TYPE TupleHashEntryData
617 #define SH_KEY_TYPE MinimalTuple
618 #define SH_SCOPE extern
619 #define SH_DECLARE
620 #include "lib/simplehash.h"
621 
622 typedef struct TupleHashTableData
623 {
624  tuplehash_hash *hashtab; /* underlying hash table */
625  int numCols; /* number of columns in lookup key */
626  AttrNumber *keyColIdx; /* attr numbers of key columns */
627  FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */
628  ExprState *tab_eq_func; /* comparator for table datatype(s) */
629  MemoryContext tablecxt; /* memory context containing table */
630  MemoryContext tempcxt; /* context for function evaluations */
631  Size entrysize; /* actual size to make each hash entry */
632  TupleTableSlot *tableslot; /* slot for referencing table entries */
633  /* The following fields are set transiently for each table search: */
634  TupleTableSlot *inputslot; /* current input tuple's slot */
635  FmgrInfo *in_hash_funcs; /* hash functions for input datatype(s) */
636  ExprState *cur_eq_func; /* comparator for for input vs. table */
637  uint32 hash_iv; /* hash-function IV */
638  ExprContext *exprcontext; /* expression context */
640 
641 typedef tuplehash_iterator TupleHashIterator;
642 
643 /*
644  * Use InitTupleHashIterator/TermTupleHashIterator for a read/write scan.
645  * Use ResetTupleHashIterator if the table can be frozen (in this case no
646  * explicit scan termination is needed).
647  */
648 #define InitTupleHashIterator(htable, iter) \
649  tuplehash_start_iterate(htable->hashtab, iter)
650 #define TermTupleHashIterator(iter) \
651  ((void) 0)
652 #define ResetTupleHashIterator(htable, iter) \
653  InitTupleHashIterator(htable, iter)
654 #define ScanTupleHashTable(htable, iter) \
655  tuplehash_iterate(htable->hashtab, iter)
656 
657 
658 /* ----------------------------------------------------------------
659  * Expression State Nodes
660  *
661  * Formerly, there was a separate executor expression state node corresponding
662  * to each node in a planned expression tree. That's no longer the case; for
663  * common expression node types, all the execution info is embedded into
664  * step(s) in a single ExprState node. But we still have a few executor state
665  * node types for selected expression node types, mostly those in which info
666  * has to be shared with other parts of the execution state tree.
667  * ----------------------------------------------------------------
668  */
669 
670 /* ----------------
671  * AggrefExprState node
672  * ----------------
673  */
674 typedef struct AggrefExprState
675 {
677  Aggref *aggref; /* expression plan node */
678  int aggno; /* ID number for agg within its plan node */
680 
681 /* ----------------
682  * WindowFuncExprState node
683  * ----------------
684  */
685 typedef struct WindowFuncExprState
686 {
688  WindowFunc *wfunc; /* expression plan node */
689  List *args; /* ExprStates for argument expressions */
690  ExprState *aggfilter; /* FILTER expression */
691  int wfuncno; /* ID number for wfunc within its plan node */
693 
694 
695 /* ----------------
696  * SetExprState node
697  *
698  * State for evaluating a potentially set-returning expression (like FuncExpr
699  * or OpExpr). In some cases, like some of the expressions in ROWS FROM(...)
700  * the expression might not be a SRF, but nonetheless it uses the same
701  * machinery as SRFs; it will be treated as a SRF returning a single row.
702  * ----------------
703  */
704 typedef struct SetExprState
705 {
707  Expr *expr; /* expression plan node */
708  List *args; /* ExprStates for argument expressions */
709 
710  /*
711  * In ROWS FROM, functions can be inlined, removing the FuncExpr normally
712  * inside. In such a case this is the compiled expression (which cannot
713  * return a set), which'll be evaluated using regular ExecEvalExpr().
714  */
716 
717  /*
718  * Function manager's lookup info for the target function. If func.fn_oid
719  * is InvalidOid, we haven't initialized it yet (nor any of the following
720  * fields, except funcReturnsSet).
721  */
723 
724  /*
725  * For a set-returning function (SRF) that returns a tuplestore, we keep
726  * the tuplestore here and dole out the result rows one at a time. The
727  * slot holds the row currently being returned.
728  */
731 
732  /*
733  * In some cases we need to compute a tuple descriptor for the function's
734  * output. If so, it's stored here.
735  */
737  bool funcReturnsTuple; /* valid when funcResultDesc isn't NULL */
738 
739  /*
740  * Remember whether the function is declared to return a set. This is set
741  * by ExecInitExpr, and is valid even before the FmgrInfo is set up.
742  */
744 
745  /*
746  * setArgsValid is true when we are evaluating a set-returning function
747  * that uses value-per-call mode and we are in the middle of a call
748  * series; we want to pass the same argument values to the function again
749  * (and again, until it returns ExprEndResult). This indicates that
750  * fcinfo_data already contains valid argument data.
751  */
753 
754  /*
755  * Flag to remember whether we have registered a shutdown callback for
756  * this SetExprState. We do so only if funcResultStore or setArgsValid
757  * has been set at least once (since all the callback is for is to release
758  * the tuplestore or clear setArgsValid).
759  */
760  bool shutdown_reg; /* a shutdown callback is registered */
761 
762  /*
763  * Call parameter structure for the function. This has been initialized
764  * (by InitFunctionCallInfoData) if func.fn_oid is valid. It also saves
765  * argument values between calls, when setArgsValid is true.
766  */
768 } SetExprState;
769 
770 /* ----------------
771  * SubPlanState node
772  * ----------------
773  */
774 typedef struct SubPlanState
775 {
777  SubPlan *subplan; /* expression plan node */
778  struct PlanState *planstate; /* subselect plan's state tree */
779  struct PlanState *parent; /* parent plan node's state tree */
780  ExprState *testexpr; /* state of combining expression */
781  List *args; /* states of argument expression(s) */
782  HeapTuple curTuple; /* copy of most recent tuple from subplan */
783  Datum curArray; /* most recent array from ARRAY() subplan */
784  /* these are used when hashing the subselect's output: */
785  TupleDesc descRight; /* subselect desc after projection */
786  ProjectionInfo *projLeft; /* for projecting lefthand exprs */
787  ProjectionInfo *projRight; /* for projecting subselect output */
788  TupleHashTable hashtable; /* hash table for no-nulls subselect rows */
789  TupleHashTable hashnulls; /* hash table for rows with null(s) */
790  bool havehashrows; /* true if hashtable is not empty */
791  bool havenullrows; /* true if hashnulls is not empty */
792  MemoryContext hashtablecxt; /* memory context containing hash tables */
793  MemoryContext hashtempcxt; /* temp memory context for hash tables */
794  ExprContext *innerecontext; /* econtext for computing inner tuples */
795  AttrNumber *keyColIdx; /* control data for hash tables */
796  Oid *tab_eq_funcoids;/* equality func oids for table datatype(s) */
797  FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */
798  FmgrInfo *tab_eq_funcs; /* equality functions for table datatype(s) */
799  FmgrInfo *lhs_hash_funcs; /* hash functions for lefthand datatype(s) */
800  FmgrInfo *cur_eq_funcs; /* equality functions for LHS vs. table */
801  ExprState *cur_eq_comp; /* equality comparator for LHS vs. table */
802 } SubPlanState;
803 
804 /* ----------------
805  * AlternativeSubPlanState node
806  * ----------------
807  */
809 {
811  AlternativeSubPlan *subplan; /* expression plan node */
812  List *subplans; /* SubPlanStates of alternative subplans */
813  int active; /* list index of the one we're using */
815 
816 /*
817  * DomainConstraintState - one item to check during CoerceToDomain
818  *
819  * Note: we consider this to be part of an ExprState tree, so we give it
820  * a name following the xxxState convention. But there's no directly
821  * associated plan-tree node.
822  */
824 {
828 
829 typedef struct DomainConstraintState
830 {
832  DomainConstraintType constrainttype; /* constraint type */
833  char *name; /* name of constraint (for error msgs) */
834  Expr *check_expr; /* for CHECK, a boolean expression */
835  ExprState *check_exprstate; /* check_expr's eval state, or NULL */
837 
838 
839 /* ----------------------------------------------------------------
840  * Executor State Trees
841  *
842  * An executing query has a PlanState tree paralleling the Plan tree
843  * that describes the plan.
844  * ----------------------------------------------------------------
845  */
846 
847 /* ----------------
848  * ExecProcNodeMtd
849  *
850  * This is the method called by ExecProcNode to return the next tuple
851  * from an executor node. It returns NULL, or an empty TupleTableSlot,
852  * if no more tuples are available.
853  * ----------------
854  */
855 typedef TupleTableSlot *(*ExecProcNodeMtd) (struct PlanState *pstate);
856 
857 /* ----------------
858  * PlanState node
859  *
860  * We never actually instantiate any PlanState nodes; this is just the common
861  * abstract superclass for all PlanState-type nodes.
862  * ----------------
863  */
864 typedef struct PlanState
865 {
867 
868  Plan *plan; /* associated Plan node */
869 
870  EState *state; /* at execution time, states of individual
871  * nodes point to one EState for the whole
872  * top-level plan */
873 
874  ExecProcNodeMtd ExecProcNode; /* function to return next tuple */
875  ExecProcNodeMtd ExecProcNodeReal; /* actual function, if above is a
876  * wrapper */
877 
878  Instrumentation *instrument; /* Optional runtime stats for this node */
879  WorkerInstrumentation *worker_instrument; /* per-worker instrumentation */
880 
881  /*
882  * Common structural data for all Plan types. These links to subsidiary
883  * state trees parallel links in the associated plan tree (except for the
884  * subPlan list, which does not exist in the plan tree).
885  */
886  ExprState *qual; /* boolean qual condition */
887  struct PlanState *lefttree; /* input plan tree(s) */
889  List *initPlan; /* Init SubPlanState nodes (un-correlated expr
890  * subselects) */
891  List *subPlan; /* SubPlanState nodes in my expressions */
892 
893  /*
894  * State for management of parameter-change-driven rescanning
895  */
896  Bitmapset *chgParam; /* set of IDs of changed Params */
897 
898  /*
899  * Other run-time state needed by most if not all node types.
900  */
901  TupleTableSlot *ps_ResultTupleSlot; /* slot for my result tuples */
902  ExprContext *ps_ExprContext; /* node's expression-evaluation context */
903  ProjectionInfo *ps_ProjInfo; /* info for doing tuple projection */
904 } PlanState;
905 
906 /* ----------------
907  * these are defined to avoid confusion problems with "left"
908  * and "right" and "inner" and "outer". The convention is that
909  * the "left" plan is the "outer" plan and the "right" plan is
910  * the inner plan, but these make the code more readable.
911  * ----------------
912  */
913 #define innerPlanState(node) (((PlanState *)(node))->righttree)
914 #define outerPlanState(node) (((PlanState *)(node))->lefttree)
915 
916 /* Macros for inline access to certain instrumentation counters */
917 #define InstrCountFiltered1(node, delta) \
918  do { \
919  if (((PlanState *)(node))->instrument) \
920  ((PlanState *)(node))->instrument->nfiltered1 += (delta); \
921  } while(0)
922 #define InstrCountFiltered2(node, delta) \
923  do { \
924  if (((PlanState *)(node))->instrument) \
925  ((PlanState *)(node))->instrument->nfiltered2 += (delta); \
926  } while(0)
927 
928 /*
929  * EPQState is state for executing an EvalPlanQual recheck on a candidate
930  * tuple in ModifyTable or LockRows. The estate and planstate fields are
931  * NULL if inactive.
932  */
933 typedef struct EPQState
934 {
935  EState *estate; /* subsidiary EState */
936  PlanState *planstate; /* plan state tree ready to be executed */
937  TupleTableSlot *origslot; /* original output tuple to be rechecked */
938  Plan *plan; /* plan tree to be executed */
939  List *arowMarks; /* ExecAuxRowMarks (non-locking only) */
940  int epqParam; /* ID of Param to force scan node re-eval */
941 } EPQState;
942 
943 
944 /* ----------------
945  * ResultState information
946  * ----------------
947  */
948 typedef struct ResultState
949 {
950  PlanState ps; /* its first field is NodeTag */
952  bool rs_done; /* are we done? */
953  bool rs_checkqual; /* do we need to check the qual? */
954 } ResultState;
955 
956 /* ----------------
957  * ProjectSetState information
958  *
959  * Note: at least one of the "elems" will be a SetExprState; the rest are
960  * regular ExprStates.
961  * ----------------
962  */
963 typedef struct ProjectSetState
964 {
965  PlanState ps; /* its first field is NodeTag */
966  Node **elems; /* array of expression states */
967  ExprDoneCond *elemdone; /* array of per-SRF is-done states */
968  int nelems; /* length of elemdone[] array */
969  bool pending_srf_tuples; /* still evaluating srfs in tlist? */
970  MemoryContext argcontext; /* context for SRF arguments */
972 
973 /* ----------------
974  * ModifyTableState information
975  * ----------------
976  */
977 typedef struct ModifyTableState
978 {
979  PlanState ps; /* its first field is NodeTag */
980  CmdType operation; /* INSERT, UPDATE, or DELETE */
981  bool canSetTag; /* do we set the command tag/es_processed? */
982  bool mt_done; /* are we done? */
983  PlanState **mt_plans; /* subplans (one per target rel) */
984  int mt_nplans; /* number of plans in the array */
985  int mt_whichplan; /* which one is being executed (0..n-1) */
986  ResultRelInfo *resultRelInfo; /* per-subplan target relations */
987  ResultRelInfo *rootResultRelInfo; /* root target relation (partitioned
988  * table root) */
989  List **mt_arowmarks; /* per-subplan ExecAuxRowMark lists */
990  EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */
991  bool fireBSTriggers; /* do we need to fire stmt triggers? */
992  OnConflictAction mt_onconflict; /* ON CONFLICT type */
993  List *mt_arbiterindexes; /* unique index OIDs to arbitrate taking
994  * alt path */
995  TupleTableSlot *mt_existing; /* slot to store existing target tuple in */
996  List *mt_excludedtlist; /* the excluded pseudo relation's tlist */
997  TupleTableSlot *mt_conflproj; /* CONFLICT ... SET ... projection target */
999  /* Tuple-routing support info */
1001  /* controls transition table population for specified operation */
1003  /* controls transition table population for INSERT...ON CONFLICT UPDATE */
1005  /* Per plan map for tuple conversion from child to root */
1007 
1008 /* ----------------
1009  * AppendState information
1010  *
1011  * nplans how many plans are in the array
1012  * whichplan which plan is being executed (0 .. n-1)
1013  * ----------------
1014  */
1015 
1016 struct AppendState;
1017 typedef struct AppendState AppendState;
1018 struct ParallelAppendState;
1020 
1022 {
1023  PlanState ps; /* its first field is NodeTag */
1024  PlanState **appendplans; /* array of PlanStates for my inputs */
1027  ParallelAppendState *as_pstate; /* parallel coordination info */
1028  Size pstate_len; /* size of parallel coordination info */
1029  bool (*choose_next_subplan) (AppendState *);
1030 };
1031 
1032 /* ----------------
1033  * MergeAppendState information
1034  *
1035  * nplans how many plans are in the array
1036  * nkeys number of sort key columns
1037  * sortkeys sort keys in SortSupport representation
1038  * slots current output tuple of each subplan
1039  * heap heap of active tuples
1040  * initialized true if we have fetched first tuple from each subplan
1041  * ----------------
1042  */
1043 typedef struct MergeAppendState
1044 {
1045  PlanState ps; /* its first field is NodeTag */
1046  PlanState **mergeplans; /* array of PlanStates for my inputs */
1049  SortSupport ms_sortkeys; /* array of length ms_nkeys */
1050  TupleTableSlot **ms_slots; /* array of length ms_nplans */
1051  struct binaryheap *ms_heap; /* binary heap of slot indices */
1052  bool ms_initialized; /* are subplans started? */
1054 
1055 /* ----------------
1056  * RecursiveUnionState information
1057  *
1058  * RecursiveUnionState is used for performing a recursive union.
1059  *
1060  * recursing T when we're done scanning the non-recursive term
1061  * intermediate_empty T if intermediate_table is currently empty
1062  * working_table working table (to be scanned by recursive term)
1063  * intermediate_table current recursive output (next generation of WT)
1064  * ----------------
1065  */
1066 typedef struct RecursiveUnionState
1067 {
1068  PlanState ps; /* its first field is NodeTag */
1073  /* Remaining fields are unused in UNION ALL case */
1074  Oid *eqfuncoids; /* per-grouping-field equality fns */
1075  FmgrInfo *hashfunctions; /* per-grouping-field hash fns */
1076  MemoryContext tempContext; /* short-term context for comparisons */
1077  TupleHashTable hashtable; /* hash table for tuples already seen */
1078  MemoryContext tableContext; /* memory context containing hash table */
1080 
1081 /* ----------------
1082  * BitmapAndState information
1083  * ----------------
1084  */
1085 typedef struct BitmapAndState
1086 {
1087  PlanState ps; /* its first field is NodeTag */
1088  PlanState **bitmapplans; /* array of PlanStates for my inputs */
1089  int nplans; /* number of input plans */
1090 } BitmapAndState;
1091 
1092 /* ----------------
1093  * BitmapOrState information
1094  * ----------------
1095  */
1096 typedef struct BitmapOrState
1097 {
1098  PlanState ps; /* its first field is NodeTag */
1099  PlanState **bitmapplans; /* array of PlanStates for my inputs */
1100  int nplans; /* number of input plans */
1101 } BitmapOrState;
1102 
1103 /* ----------------------------------------------------------------
1104  * Scan State Information
1105  * ----------------------------------------------------------------
1106  */
1107 
1108 /* ----------------
1109  * ScanState information
1110  *
1111  * ScanState extends PlanState for node types that represent
1112  * scans of an underlying relation. It can also be used for nodes
1113  * that scan the output of an underlying plan node --- in that case,
1114  * only ScanTupleSlot is actually useful, and it refers to the tuple
1115  * retrieved from the subplan.
1116  *
1117  * currentRelation relation being scanned (NULL if none)
1118  * currentScanDesc current scan descriptor for scan (NULL if none)
1119  * ScanTupleSlot pointer to slot in tuple table holding scan tuple
1120  * ----------------
1121  */
1122 typedef struct ScanState
1123 {
1124  PlanState ps; /* its first field is NodeTag */
1128 } ScanState;
1129 
1130 /* ----------------
1131  * SeqScanState information
1132  * ----------------
1133  */
1134 typedef struct SeqScanState
1135 {
1136  ScanState ss; /* its first field is NodeTag */
1137  Size pscan_len; /* size of parallel heap scan descriptor */
1138 } SeqScanState;
1139 
1140 /* ----------------
1141  * SampleScanState information
1142  * ----------------
1143  */
1144 typedef struct SampleScanState
1145 {
1147  List *args; /* expr states for TABLESAMPLE params */
1148  ExprState *repeatable; /* expr state for REPEATABLE expr */
1149  /* use struct pointer to avoid including tsmapi.h here */
1150  struct TsmRoutine *tsmroutine; /* descriptor for tablesample method */
1151  void *tsm_state; /* tablesample method can keep state here */
1152  bool use_bulkread; /* use bulkread buffer access strategy? */
1153  bool use_pagemode; /* use page-at-a-time visibility checking? */
1154  bool begun; /* false means need to call BeginSampleScan */
1155  uint32 seed; /* random seed */
1156 } SampleScanState;
1157 
1158 /*
1159  * These structs store information about index quals that don't have simple
1160  * constant right-hand sides. See comments for ExecIndexBuildScanKeys()
1161  * for discussion.
1162  */
1163 typedef struct
1164 {
1165  ScanKey scan_key; /* scankey to put value into */
1166  ExprState *key_expr; /* expr to evaluate to get value */
1167  bool key_toastable; /* is expr's result a toastable datatype? */
1169 
1170 typedef struct
1171 {
1172  ScanKey scan_key; /* scankey to put value into */
1173  ExprState *array_expr; /* expr to evaluate to get array value */
1174  int next_elem; /* next array element to use */
1175  int num_elems; /* number of elems in current array value */
1176  Datum *elem_values; /* array of num_elems Datums */
1177  bool *elem_nulls; /* array of num_elems is-null flags */
1179 
1180 /* ----------------
1181  * IndexScanState information
1182  *
1183  * indexqualorig execution state for indexqualorig expressions
1184  * indexorderbyorig execution state for indexorderbyorig expressions
1185  * ScanKeys Skey structures for index quals
1186  * NumScanKeys number of ScanKeys
1187  * OrderByKeys Skey structures for index ordering operators
1188  * NumOrderByKeys number of OrderByKeys
1189  * RuntimeKeys info about Skeys that must be evaluated at runtime
1190  * NumRuntimeKeys number of RuntimeKeys
1191  * RuntimeKeysReady true if runtime Skeys have been computed
1192  * RuntimeContext expr context for evaling runtime Skeys
1193  * RelationDesc index relation descriptor
1194  * ScanDesc index scan descriptor
1195  *
1196  * ReorderQueue tuples that need reordering due to re-check
1197  * ReachedEnd have we fetched all tuples from index already?
1198  * OrderByValues values of ORDER BY exprs of last fetched tuple
1199  * OrderByNulls null flags for OrderByValues
1200  * SortSupport for reordering ORDER BY exprs
1201  * OrderByTypByVals is the datatype of order by expression pass-by-value?
1202  * OrderByTypLens typlens of the datatypes of order by expressions
1203  * pscan_len size of parallel index scan descriptor
1204  * ----------------
1205  */
1206 typedef struct IndexScanState
1207 {
1208  ScanState ss; /* its first field is NodeTag */
1221 
1222  /* These are needed for re-checking ORDER BY expr ordering */
1231 } IndexScanState;
1232 
1233 /* ----------------
1234  * IndexOnlyScanState information
1235  *
1236  * indexqual execution state for indexqual expressions
1237  * ScanKeys Skey structures for index quals
1238  * NumScanKeys number of ScanKeys
1239  * OrderByKeys Skey structures for index ordering operators
1240  * NumOrderByKeys number of OrderByKeys
1241  * RuntimeKeys info about Skeys that must be evaluated at runtime
1242  * NumRuntimeKeys number of RuntimeKeys
1243  * RuntimeKeysReady true if runtime Skeys have been computed
1244  * RuntimeContext expr context for evaling runtime Skeys
1245  * RelationDesc index relation descriptor
1246  * ScanDesc index scan descriptor
1247  * VMBuffer buffer in use for visibility map testing, if any
1248  * HeapFetches number of tuples we were forced to fetch from heap
1249  * ioss_PscanLen Size of parallel index-only scan descriptor
1250  * ----------------
1251  */
1252 typedef struct IndexOnlyScanState
1253 {
1254  ScanState ss; /* its first field is NodeTag */
1270 
1271 /* ----------------
1272  * BitmapIndexScanState information
1273  *
1274  * result bitmap to return output into, or NULL
1275  * ScanKeys Skey structures for index quals
1276  * NumScanKeys number of ScanKeys
1277  * RuntimeKeys info about Skeys that must be evaluated at runtime
1278  * NumRuntimeKeys number of RuntimeKeys
1279  * ArrayKeys info about Skeys that come from ScalarArrayOpExprs
1280  * NumArrayKeys number of ArrayKeys
1281  * RuntimeKeysReady true if runtime Skeys have been computed
1282  * RuntimeContext expr context for evaling runtime Skeys
1283  * RelationDesc index relation descriptor
1284  * ScanDesc index scan descriptor
1285  * ----------------
1286  */
1287 typedef struct BitmapIndexScanState
1288 {
1289  ScanState ss; /* its first field is NodeTag */
1302 
1303 /* ----------------
1304  * SharedBitmapState information
1305  *
1306  * BM_INITIAL TIDBitmap creation is not yet started, so first worker
1307  * to see this state will set the state to BM_INPROGRESS
1308  * and that process will be responsible for creating
1309  * TIDBitmap.
1310  * BM_INPROGRESS TIDBitmap creation is in progress; workers need to
1311  * sleep until it's finished.
1312  * BM_FINISHED TIDBitmap creation is done, so now all workers can
1313  * proceed to iterate over TIDBitmap.
1314  * ----------------
1315  */
1316 typedef enum
1317 {
1322 
1323 /* ----------------
1324  * ParallelBitmapHeapState information
1325  * tbmiterator iterator for scanning current pages
1326  * prefetch_iterator iterator for prefetching ahead of current page
1327  * mutex mutual exclusion for the prefetching variable
1328  * and state
1329  * prefetch_pages # pages prefetch iterator is ahead of current
1330  * prefetch_target current target prefetch distance
1331  * state current state of the TIDBitmap
1332  * cv conditional wait variable
1333  * phs_snapshot_data snapshot data shared to workers
1334  * ----------------
1335  */
1337 {
1345  char phs_snapshot_data[FLEXIBLE_ARRAY_MEMBER];
1347 
1348 /* ----------------
1349  * BitmapHeapScanState information
1350  *
1351  * bitmapqualorig execution state for bitmapqualorig expressions
1352  * tbm bitmap obtained from child index scan(s)
1353  * tbmiterator iterator for scanning current pages
1354  * tbmres current-page data
1355  * can_skip_fetch can we potentially skip tuple fetches in this scan?
1356  * skip_fetch are we skipping tuple fetches on this page?
1357  * vmbuffer buffer for visibility-map lookups
1358  * pvmbuffer ditto, for prefetched pages
1359  * exact_pages total number of exact pages retrieved
1360  * lossy_pages total number of lossy pages retrieved
1361  * prefetch_iterator iterator for prefetching ahead of current page
1362  * prefetch_pages # pages prefetch iterator is ahead of current
1363  * prefetch_target current target prefetch distance
1364  * prefetch_maximum maximum value for prefetch_target
1365  * pscan_len size of the shared memory for parallel bitmap
1366  * initialized is node is ready to iterate
1367  * shared_tbmiterator shared iterator
1368  * shared_prefetch_iterator shared iterator for prefetching
1369  * pstate shared state for parallel bitmap scan
1370  * ----------------
1371  */
1372 typedef struct BitmapHeapScanState
1373 {
1374  ScanState ss; /* its first field is NodeTag */
1395 
1396 /* ----------------
1397  * TidScanState information
1398  *
1399  * tidexprs list of TidExpr structs (see nodeTidscan.c)
1400  * isCurrentOf scan has a CurrentOfExpr qual
1401  * NumTids number of tids in this scan
1402  * TidPtr index of currently fetched tid
1403  * TidList evaluated item pointers (array of size NumTids)
1404  * htup currently-fetched tuple, if any
1405  * ----------------
1406  */
1407 typedef struct TidScanState
1408 {
1409  ScanState ss; /* its first field is NodeTag */
1416 } TidScanState;
1417 
1418 /* ----------------
1419  * SubqueryScanState information
1420  *
1421  * SubqueryScanState is used for scanning a sub-query in the range table.
1422  * ScanTupleSlot references the current output tuple of the sub-query.
1423  * ----------------
1424  */
1425 typedef struct SubqueryScanState
1426 {
1427  ScanState ss; /* its first field is NodeTag */
1430 
1431 /* ----------------
1432  * FunctionScanState information
1433  *
1434  * Function nodes are used to scan the results of a
1435  * function appearing in FROM (typically a function returning set).
1436  *
1437  * eflags node's capability flags
1438  * ordinality is this scan WITH ORDINALITY?
1439  * simple true if we have 1 function and no ordinality
1440  * ordinal current ordinal column value
1441  * nfuncs number of functions being executed
1442  * funcstates per-function execution states (private in
1443  * nodeFunctionscan.c)
1444  * argcontext memory context to evaluate function arguments in
1445  * ----------------
1446  */
1448 
1449 typedef struct FunctionScanState
1450 {
1451  ScanState ss; /* its first field is NodeTag */
1452  int eflags;
1454  bool simple;
1455  int64 ordinal;
1456  int nfuncs;
1457  struct FunctionScanPerFuncState *funcstates; /* array of length nfuncs */
1460 
1461 /* ----------------
1462  * ValuesScanState information
1463  *
1464  * ValuesScan nodes are used to scan the results of a VALUES list
1465  *
1466  * rowcontext per-expression-list context
1467  * exprlists array of expression lists being evaluated
1468  * array_len size of array
1469  * curr_idx current array index (0-based)
1470  *
1471  * Note: ss.ps.ps_ExprContext is used to evaluate any qual or projection
1472  * expressions attached to the node. We create a second ExprContext,
1473  * rowcontext, in which to build the executor expression state for each
1474  * Values sublist. Resetting this context lets us get rid of expression
1475  * state for each row, avoiding major memory leakage over a long values list.
1476  * ----------------
1477  */
1478 typedef struct ValuesScanState
1479 {
1480  ScanState ss; /* its first field is NodeTag */
1485 } ValuesScanState;
1486 
1487 /* ----------------
1488  * TableFuncScanState node
1489  *
1490  * Used in table-expression functions like XMLTABLE.
1491  * ----------------
1492  */
1493 typedef struct TableFuncScanState
1494 {
1495  ScanState ss; /* its first field is NodeTag */
1496  ExprState *docexpr; /* state for document expression */
1497  ExprState *rowexpr; /* state for row-generating expression */
1498  List *colexprs; /* state for column-generating expression */
1499  List *coldefexprs; /* state for column default expressions */
1500  List *ns_names; /* list of str nodes with namespace names */
1501  List *ns_uris; /* list of states of namespace uri exprs */
1502  Bitmapset *notnulls; /* nullability flag for each output column */
1503  void *opaque; /* table builder private space */
1504  const struct TableFuncRoutine *routine; /* table builder methods */
1505  FmgrInfo *in_functions; /* input function for each column */
1506  Oid *typioparams; /* typioparam for each column */
1507  int64 ordinal; /* row number to be output next */
1508  MemoryContext perValueCxt; /* short life context for value evaluation */
1509  Tuplestorestate *tupstore; /* output tuple store */
1511 
1512 /* ----------------
1513  * CteScanState information
1514  *
1515  * CteScan nodes are used to scan a CommonTableExpr query.
1516  *
1517  * Multiple CteScan nodes can read out from the same CTE query. We use
1518  * a tuplestore to hold rows that have been read from the CTE query but
1519  * not yet consumed by all readers.
1520  * ----------------
1521  */
1522 typedef struct CteScanState
1523 {
1524  ScanState ss; /* its first field is NodeTag */
1525  int eflags; /* capability flags to pass to tuplestore */
1526  int readptr; /* index of my tuplestore read pointer */
1527  PlanState *cteplanstate; /* PlanState for the CTE query itself */
1528  /* Link to the "leader" CteScanState (possibly this same node) */
1530  /* The remaining fields are only valid in the "leader" CteScanState */
1531  Tuplestorestate *cte_table; /* rows already read from the CTE query */
1532  bool eof_cte; /* reached end of CTE query? */
1533 } CteScanState;
1534 
1535 /* ----------------
1536  * NamedTuplestoreScanState information
1537  *
1538  * NamedTuplestoreScan nodes are used to scan a Tuplestore created and
1539  * named prior to execution of the query. An example is a transition
1540  * table for an AFTER trigger.
1541  *
1542  * Multiple NamedTuplestoreScan nodes can read out from the same Tuplestore.
1543  * ----------------
1544  */
1546 {
1547  ScanState ss; /* its first field is NodeTag */
1548  int readptr; /* index of my tuplestore read pointer */
1549  TupleDesc tupdesc; /* format of the tuples in the tuplestore */
1550  Tuplestorestate *relation; /* the rows */
1552 
1553 /* ----------------
1554  * WorkTableScanState information
1555  *
1556  * WorkTableScan nodes are used to scan the work table created by
1557  * a RecursiveUnion node. We locate the RecursiveUnion node
1558  * during executor startup.
1559  * ----------------
1560  */
1561 typedef struct WorkTableScanState
1562 {
1563  ScanState ss; /* its first field is NodeTag */
1566 
1567 /* ----------------
1568  * ForeignScanState information
1569  *
1570  * ForeignScan nodes are used to scan foreign-data tables.
1571  * ----------------
1572  */
1573 typedef struct ForeignScanState
1574 {
1575  ScanState ss; /* its first field is NodeTag */
1576  ExprState *fdw_recheck_quals; /* original quals not in ss.ps.qual */
1577  Size pscan_len; /* size of parallel coordination information */
1578  /* use struct pointer to avoid including fdwapi.h here */
1580  void *fdw_state; /* foreign-data wrapper can keep state here */
1582 
1583 /* ----------------
1584  * CustomScanState information
1585  *
1586  * CustomScan nodes are used to execute custom code within executor.
1587  *
1588  * Core code must avoid assuming that the CustomScanState is only as large as
1589  * the structure declared here; providers are allowed to make it the first
1590  * element in a larger structure, and typically would need to do so. The
1591  * struct is actually allocated by the CreateCustomScanState method associated
1592  * with the plan node. Any additional fields can be initialized there, or in
1593  * the BeginCustomScan method.
1594  * ----------------
1595  */
1596 struct CustomExecMethods;
1597 
1598 typedef struct CustomScanState
1599 {
1601  uint32 flags; /* mask of CUSTOMPATH_* flags, see
1602  * nodes/extensible.h */
1603  List *custom_ps; /* list of child PlanState nodes, if any */
1604  Size pscan_len; /* size of parallel coordination information */
1606 } CustomScanState;
1607 
1608 /* ----------------------------------------------------------------
1609  * Join State Information
1610  * ----------------------------------------------------------------
1611  */
1612 
1613 /* ----------------
1614  * JoinState information
1615  *
1616  * Superclass for state nodes of join plans.
1617  * ----------------
1618  */
1619 typedef struct JoinState
1620 {
1623  bool single_match; /* True if we should skip to next outer tuple
1624  * after finding one inner match */
1625  ExprState *joinqual; /* JOIN quals (in addition to ps.qual) */
1626 } JoinState;
1627 
1628 /* ----------------
1629  * NestLoopState information
1630  *
1631  * NeedNewOuter true if need new outer tuple on next call
1632  * MatchedOuter true if found a join match for current outer tuple
1633  * NullInnerTupleSlot prepared null tuple for left outer joins
1634  * ----------------
1635  */
1636 typedef struct NestLoopState
1637 {
1638  JoinState js; /* its first field is NodeTag */
1642 } NestLoopState;
1643 
1644 /* ----------------
1645  * MergeJoinState information
1646  *
1647  * NumClauses number of mergejoinable join clauses
1648  * Clauses info for each mergejoinable clause
1649  * JoinState current state of ExecMergeJoin state machine
1650  * SkipMarkRestore true if we may skip Mark and Restore operations
1651  * ExtraMarks true to issue extra Mark operations on inner scan
1652  * ConstFalseJoin true if we have a constant-false joinqual
1653  * FillOuter true if should emit unjoined outer tuples anyway
1654  * FillInner true if should emit unjoined inner tuples anyway
1655  * MatchedOuter true if found a join match for current outer tuple
1656  * MatchedInner true if found a join match for current inner tuple
1657  * OuterTupleSlot slot in tuple table for cur outer tuple
1658  * InnerTupleSlot slot in tuple table for cur inner tuple
1659  * MarkedTupleSlot slot in tuple table for marked tuple
1660  * NullOuterTupleSlot prepared null tuple for right outer joins
1661  * NullInnerTupleSlot prepared null tuple for left outer joins
1662  * OuterEContext workspace for computing outer tuple's join values
1663  * InnerEContext workspace for computing inner tuple's join values
1664  * ----------------
1665  */
1666 /* private in nodeMergejoin.c: */
1668 
1669 typedef struct MergeJoinState
1670 {
1671  JoinState js; /* its first field is NodeTag */
1673  MergeJoinClause mj_Clauses; /* array of length mj_NumClauses */
1689 } MergeJoinState;
1690 
1691 /* ----------------
1692  * HashJoinState information
1693  *
1694  * hashclauses original form of the hashjoin condition
1695  * hj_OuterHashKeys the outer hash keys in the hashjoin condition
1696  * hj_InnerHashKeys the inner hash keys in the hashjoin condition
1697  * hj_HashOperators the join operators in the hashjoin condition
1698  * hj_HashTable hash table for the hashjoin
1699  * (NULL if table not built yet)
1700  * hj_CurHashValue hash value for current outer tuple
1701  * hj_CurBucketNo regular bucket# for current outer tuple
1702  * hj_CurSkewBucketNo skew bucket# for current outer tuple
1703  * hj_CurTuple last inner tuple matched to current outer
1704  * tuple, or NULL if starting search
1705  * (hj_CurXXX variables are undefined if
1706  * OuterTupleSlot is empty!)
1707  * hj_OuterTupleSlot tuple slot for outer tuples
1708  * hj_HashTupleSlot tuple slot for inner (hashed) tuples
1709  * hj_NullOuterTupleSlot prepared null tuple for right/full outer joins
1710  * hj_NullInnerTupleSlot prepared null tuple for left/full outer joins
1711  * hj_FirstOuterTupleSlot first tuple retrieved from outer plan
1712  * hj_JoinState current state of ExecHashJoin state machine
1713  * hj_MatchedOuter true if found a join match for current outer
1714  * hj_OuterNotEmpty true if outer relation known not empty
1715  * ----------------
1716  */
1717 
1718 /* these structs are defined in executor/hashjoin.h: */
1721 
1722 typedef struct HashJoinState
1723 {
1724  JoinState js; /* its first field is NodeTag */
1726  List *hj_OuterHashKeys; /* list of ExprState nodes */
1727  List *hj_InnerHashKeys; /* list of ExprState nodes */
1728  List *hj_HashOperators; /* list of operator OIDs */
1729  HashJoinTable hj_HashTable;
1733  HashJoinTuple hj_CurTuple;
1742 } HashJoinState;
1743 
1744 
1745 /* ----------------------------------------------------------------
1746  * Materialization State Information
1747  * ----------------------------------------------------------------
1748  */
1749 
1750 /* ----------------
1751  * MaterialState information
1752  *
1753  * materialize nodes are used to materialize the results
1754  * of a subplan into a temporary file.
1755  *
1756  * ss.ss_ScanTupleSlot refers to output of underlying plan.
1757  * ----------------
1758  */
1759 typedef struct MaterialState
1760 {
1761  ScanState ss; /* its first field is NodeTag */
1762  int eflags; /* capability flags to pass to tuplestore */
1763  bool eof_underlying; /* reached end of underlying plan? */
1765 } MaterialState;
1766 
1767 /* ----------------
1768  * Shared memory container for per-worker sort information
1769  * ----------------
1770  */
1771 typedef struct SharedSortInfo
1772 {
1774  TuplesortInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER];
1775 } SharedSortInfo;
1776 
1777 /* ----------------
1778  * SortState information
1779  * ----------------
1780  */
1781 typedef struct SortState
1782 {
1783  ScanState ss; /* its first field is NodeTag */
1784  bool randomAccess; /* need random access to sort output? */
1785  bool bounded; /* is the result set bounded? */
1786  int64 bound; /* if bounded, how many tuples are needed */
1787  bool sort_Done; /* sort completed yet? */
1788  bool bounded_Done; /* value of bounded we did the sort with */
1789  int64 bound_Done; /* value of bound we did the sort with */
1790  void *tuplesortstate; /* private state of tuplesort.c */
1791  bool am_worker; /* are we a worker? */
1792  SharedSortInfo *shared_info; /* one entry per worker */
1793 } SortState;
1794 
1795 /* ---------------------
1796  * GroupState information
1797  * ---------------------
1798  */
1799 typedef struct GroupState
1800 {
1801  ScanState ss; /* its first field is NodeTag */
1802  ExprState *eqfunction; /* equality function */
1803  bool grp_done; /* indicates completion of Group scan */
1804 } GroupState;
1805 
1806 /* ---------------------
1807  * AggState information
1808  *
1809  * ss.ss_ScanTupleSlot refers to output of underlying plan.
1810  *
1811  * Note: ss.ps.ps_ExprContext contains ecxt_aggvalues and
1812  * ecxt_aggnulls arrays, which hold the computed agg values for the current
1813  * input group during evaluation of an Agg node's output tuple(s). We
1814  * create a second ExprContext, tmpcontext, in which to evaluate input
1815  * expressions and run the aggregate transition functions.
1816  * ---------------------
1817  */
1818 /* these structs are private in nodeAgg.c: */
1824 
1825 typedef struct AggState
1826 {
1827  ScanState ss; /* its first field is NodeTag */
1828  List *aggs; /* all Aggref nodes in targetlist & quals */
1829  int numaggs; /* length of list (could be zero!) */
1830  int numtrans; /* number of pertrans items */
1831  AggStrategy aggstrategy; /* strategy mode */
1832  AggSplit aggsplit; /* agg-splitting mode, see nodes.h */
1833  AggStatePerPhase phase; /* pointer to current phase data */
1834  int numphases; /* number of phases (including phase 0) */
1835  int current_phase; /* current phase number */
1836  AggStatePerAgg peragg; /* per-Aggref information */
1837  AggStatePerTrans pertrans; /* per-Trans state information */
1838  ExprContext *hashcontext; /* econtexts for long-lived data (hashtable) */
1839  ExprContext **aggcontexts; /* econtexts for long-lived data (per GS) */
1840  ExprContext *tmpcontext; /* econtext for input expressions */
1841  ExprContext *curaggcontext; /* currently active aggcontext */
1842  AggStatePerAgg curperagg; /* currently active aggregate, if any */
1843  AggStatePerTrans curpertrans; /* currently active trans state, if any */
1844  bool input_done; /* indicates end of input */
1845  bool agg_done; /* indicates completion of Agg scan */
1846  int projected_set; /* The last projected grouping set */
1847  int current_set; /* The current grouping set being evaluated */
1848  Bitmapset *grouped_cols; /* grouped cols in current projection */
1849  List *all_grouped_cols; /* list of all grouped cols in DESC order */
1850  /* These fields are for grouping set phase data */
1851  int maxsets; /* The max number of sets in any phase */
1852  AggStatePerPhase phases; /* array of all phases */
1853  Tuplesortstate *sort_in; /* sorted input to phases > 1 */
1854  Tuplesortstate *sort_out; /* input is copied here for next phase */
1855  TupleTableSlot *sort_slot; /* slot for sort results */
1856  /* these fields are used in AGG_PLAIN and AGG_SORTED modes: */
1857  AggStatePerGroup *pergroups; /* grouping set indexed array of per-group
1858  * pointers */
1859  HeapTuple grp_firstTuple; /* copy of first tuple of current group */
1860  /* these fields are used in AGG_HASHED and AGG_MIXED modes: */
1861  bool table_filled; /* hash table filled yet? */
1863  AggStatePerHash perhash; /* array of per-hashtable data */
1864  AggStatePerGroup *hash_pergroup; /* grouping set indexed array of
1865  * per-group pointers */
1866 
1867  /* support for evaluation of agg input expressions: */
1868  AggStatePerGroup *all_pergroups; /* array of first ->pergroups, than
1869  * ->hash_pergroup */
1870  ProjectionInfo *combinedproj; /* projection machinery */
1871 } AggState;
1872 
1873 /* ----------------
1874  * WindowAggState information
1875  * ----------------
1876  */
1877 /* these structs are private in nodeWindowAgg.c: */
1880 
1881 typedef struct WindowAggState
1882 {
1883  ScanState ss; /* its first field is NodeTag */
1884 
1885  /* these fields are filled in by ExecInitExpr: */
1886  List *funcs; /* all WindowFunc nodes in targetlist */
1887  int numfuncs; /* total number of window functions */
1888  int numaggs; /* number that are plain aggregates */
1889 
1890  WindowStatePerFunc perfunc; /* per-window-function information */
1891  WindowStatePerAgg peragg; /* per-plain-aggregate information */
1892  ExprState *partEqfunction; /* equality funcs for partition columns */
1893  ExprState *ordEqfunction; /* equality funcs for ordering columns */
1894  Tuplestorestate *buffer; /* stores rows of current partition */
1895  int current_ptr; /* read pointer # for current row */
1896  int framehead_ptr; /* read pointer # for frame head, if used */
1897  int frametail_ptr; /* read pointer # for frame tail, if used */
1898  int grouptail_ptr; /* read pointer # for group tail, if used */
1899  int64 spooled_rows; /* total # of rows in buffer */
1900  int64 currentpos; /* position of current row in partition */
1901  int64 frameheadpos; /* current frame head position */
1902  int64 frametailpos; /* current frame tail position (frame end+1) */
1903  /* use struct pointer to avoid including windowapi.h here */
1904  struct WindowObjectData *agg_winobj; /* winobj for aggregate fetches */
1905  int64 aggregatedbase; /* start row for current aggregates */
1906  int64 aggregatedupto; /* rows before this one are aggregated */
1907 
1908  int frameOptions; /* frame_clause options, see WindowDef */
1909  ExprState *startOffset; /* expression for starting bound offset */
1910  ExprState *endOffset; /* expression for ending bound offset */
1911  Datum startOffsetValue; /* result of startOffset evaluation */
1912  Datum endOffsetValue; /* result of endOffset evaluation */
1913 
1914  /* these fields are used with RANGE offset PRECEDING/FOLLOWING: */
1915  FmgrInfo startInRangeFunc; /* in_range function for startOffset */
1916  FmgrInfo endInRangeFunc; /* in_range function for endOffset */
1917  Oid inRangeColl; /* collation for in_range tests */
1918  bool inRangeAsc; /* use ASC sort order for in_range tests? */
1919  bool inRangeNullsFirst; /* nulls sort first for in_range tests? */
1920 
1921  /* these fields are used in GROUPS mode: */
1922  int64 currentgroup; /* peer group # of current row in partition */
1923  int64 frameheadgroup; /* peer group # of frame head row */
1924  int64 frametailgroup; /* peer group # of frame tail row */
1925  int64 groupheadpos; /* current row's peer group head position */
1926  int64 grouptailpos; /* " " " " tail position (group end+1) */
1927 
1928  MemoryContext partcontext; /* context for partition-lifespan data */
1929  MemoryContext aggcontext; /* shared context for aggregate working data */
1930  MemoryContext curaggcontext; /* current aggregate's working data */
1931  ExprContext *tmpcontext; /* short-term evaluation context */
1932 
1933  bool all_first; /* true if the scan is starting */
1934  bool all_done; /* true if the scan is finished */
1935  bool partition_spooled; /* true if all tuples in current partition
1936  * have been spooled into tuplestore */
1937  bool more_partitions; /* true if there's more partitions after
1938  * this one */
1939  bool framehead_valid; /* true if frameheadpos is known up to
1940  * date for current row */
1941  bool frametail_valid; /* true if frametailpos is known up to
1942  * date for current row */
1943  bool grouptail_valid; /* true if grouptailpos is known up to
1944  * date for current row */
1945 
1946  TupleTableSlot *first_part_slot; /* first tuple of current or next
1947  * partition */
1948  TupleTableSlot *framehead_slot; /* first tuple of current frame */
1949  TupleTableSlot *frametail_slot; /* first tuple after current frame */
1950 
1951  /* temporary slots for tuples fetched back from tuplestore */
1955 } WindowAggState;
1956 
1957 /* ----------------
1958  * UniqueState information
1959  *
1960  * Unique nodes are used "on top of" sort nodes to discard
1961  * duplicate tuples returned from the sort phase. Basically
1962  * all it does is compare the current tuple from the subplan
1963  * with the previously fetched tuple (stored in its result slot).
1964  * If the two are identical in all interesting fields, then
1965  * we just fetch another tuple from the sort and try again.
1966  * ----------------
1967  */
1968 typedef struct UniqueState
1969 {
1970  PlanState ps; /* its first field is NodeTag */
1971  ExprState *eqfunction; /* tuple equality qual */
1972 } UniqueState;
1973 
1974 /* ----------------
1975  * GatherState information
1976  *
1977  * Gather nodes launch 1 or more parallel workers, run a subplan
1978  * in those workers, and collect the results.
1979  * ----------------
1980  */
1981 typedef struct GatherState
1982 {
1983  PlanState ps; /* its first field is NodeTag */
1984  bool initialized; /* workers launched? */
1985  bool need_to_scan_locally; /* need to read from local plan? */
1986  int64 tuples_needed; /* tuple bound, see ExecSetTupleBound */
1987  /* these fields are set up once: */
1990  /* all remaining fields are reinitialized during a rescan: */
1991  int nworkers_launched; /* original number of workers */
1992  int nreaders; /* number of still-active workers */
1993  int nextreader; /* next one to try to read from */
1994  struct TupleQueueReader **reader; /* array with nreaders active entries */
1995 } GatherState;
1996 
1997 /* ----------------
1998  * GatherMergeState information
1999  *
2000  * Gather merge nodes launch 1 or more parallel workers, run a
2001  * subplan which produces sorted output in each worker, and then
2002  * merge the results into a single sorted stream.
2003  * ----------------
2004  */
2005 struct GMReaderTupleBuffer; /* private in nodeGatherMerge.c */
2006 
2007 typedef struct GatherMergeState
2008 {
2009  PlanState ps; /* its first field is NodeTag */
2010  bool initialized; /* workers launched? */
2011  bool gm_initialized; /* gather_merge_init() done? */
2012  bool need_to_scan_locally; /* need to read from local plan? */
2013  int64 tuples_needed; /* tuple bound, see ExecSetTupleBound */
2014  /* these fields are set up once: */
2015  TupleDesc tupDesc; /* descriptor for subplan result tuples */
2016  int gm_nkeys; /* number of sort columns */
2017  SortSupport gm_sortkeys; /* array of length gm_nkeys */
2019  /* all remaining fields are reinitialized during a rescan */
2020  /* (but the arrays are not reallocated, just cleared) */
2021  int nworkers_launched; /* original number of workers */
2022  int nreaders; /* number of active workers */
2023  TupleTableSlot **gm_slots; /* array with nreaders+1 entries */
2024  struct TupleQueueReader **reader; /* array with nreaders active entries */
2025  struct GMReaderTupleBuffer *gm_tuple_buffers; /* nreaders tuple buffers */
2026  struct binaryheap *gm_heap; /* binary heap of slot indices */
2028 
2029 /* ----------------
2030  * Values displayed by EXPLAIN ANALYZE
2031  * ----------------
2032  */
2033 typedef struct HashInstrumentation
2034 {
2035  int nbuckets; /* number of buckets at end of execution */
2036  int nbuckets_original; /* planned number of buckets */
2037  int nbatch; /* number of batches at end of execution */
2038  int nbatch_original; /* planned number of batches */
2039  size_t space_peak; /* speak memory usage in bytes */
2041 
2042 /* ----------------
2043  * Shared memory container for per-worker hash information
2044  * ----------------
2045  */
2046 typedef struct SharedHashInfo
2047 {
2049  HashInstrumentation hinstrument[FLEXIBLE_ARRAY_MEMBER];
2050 } SharedHashInfo;
2051 
2052 /* ----------------
2053  * HashState information
2054  * ----------------
2055  */
2056 typedef struct HashState
2057 {
2058  PlanState ps; /* its first field is NodeTag */
2059  HashJoinTable hashtable; /* hash table for the hashjoin */
2060  List *hashkeys; /* list of ExprState nodes */
2061  /* hashkeys is same as parent's hj_InnerHashKeys */
2062 
2063  SharedHashInfo *shared_info; /* one entry per worker */
2064  HashInstrumentation *hinstrument; /* this worker's entry */
2065 
2066  /* Parallel hash state. */
2068 } HashState;
2069 
2070 /* ----------------
2071  * SetOpState information
2072  *
2073  * Even in "sorted" mode, SetOp nodes are more complex than a simple
2074  * Unique, since we have to count how many duplicates to return. But
2075  * we also support hashing, so this is really more like a cut-down
2076  * form of Agg.
2077  * ----------------
2078  */
2079 /* this struct is private in nodeSetOp.c: */
2081 
2082 typedef struct SetOpState
2083 {
2084  PlanState ps; /* its first field is NodeTag */
2085  ExprState *eqfunction; /* equality comparator */
2086  Oid *eqfuncoids; /* per-grouping-field equality fns */
2087  FmgrInfo *hashfunctions; /* per-grouping-field hash fns */
2088  bool setop_done; /* indicates completion of output scan */
2089  long numOutput; /* number of dups left to output */
2090  /* these fields are used in SETOP_SORTED mode: */
2091  SetOpStatePerGroup pergroup; /* per-group working state */
2092  HeapTuple grp_firstTuple; /* copy of first tuple of current group */
2093  /* these fields are used in SETOP_HASHED mode: */
2094  TupleHashTable hashtable; /* hash table with one entry per group */
2095  MemoryContext tableContext; /* memory context containing hash table */
2096  bool table_filled; /* hash table filled yet? */
2097  TupleHashIterator hashiter; /* for iterating through hash table */
2098 } SetOpState;
2099 
2100 /* ----------------
2101  * LockRowsState information
2102  *
2103  * LockRows nodes are used to enforce FOR [KEY] UPDATE/SHARE locking.
2104  * ----------------
2105  */
2106 typedef struct LockRowsState
2107 {
2108  PlanState ps; /* its first field is NodeTag */
2109  List *lr_arowMarks; /* List of ExecAuxRowMarks */
2110  EPQState lr_epqstate; /* for evaluating EvalPlanQual rechecks */
2111  HeapTuple *lr_curtuples; /* locked tuples (one entry per RT entry) */
2112  int lr_ntables; /* length of lr_curtuples[] array */
2113 } LockRowsState;
2114 
2115 /* ----------------
2116  * LimitState information
2117  *
2118  * Limit nodes are used to enforce LIMIT/OFFSET clauses.
2119  * They just select the desired subrange of their subplan's output.
2120  *
2121  * offset is the number of initial tuples to skip (0 does nothing).
2122  * count is the number of tuples to return after skipping the offset tuples.
2123  * If no limit count was specified, count is undefined and noCount is true.
2124  * When lstate == LIMIT_INITIAL, offset/count/noCount haven't been set yet.
2125  * ----------------
2126  */
2127 typedef enum
2128 {
2129  LIMIT_INITIAL, /* initial state for LIMIT node */
2130  LIMIT_RESCAN, /* rescan after recomputing parameters */
2131  LIMIT_EMPTY, /* there are no returnable rows */
2132  LIMIT_INWINDOW, /* have returned a row in the window */
2133  LIMIT_SUBPLANEOF, /* at EOF of subplan (within window) */
2134  LIMIT_WINDOWEND, /* stepped off end of window */
2135  LIMIT_WINDOWSTART /* stepped off beginning of window */
2136 } LimitStateCond;
2137 
2138 typedef struct LimitState
2139 {
2140  PlanState ps; /* its first field is NodeTag */
2141  ExprState *limitOffset; /* OFFSET parameter, or NULL if none */
2142  ExprState *limitCount; /* COUNT parameter, or NULL if none */
2143  int64 offset; /* current OFFSET value */
2144  int64 count; /* current COUNT, if any */
2145  bool noCount; /* if true, ignore count */
2146  LimitStateCond lstate; /* state machine status, as above */
2147  int64 position; /* 1-based index of last tuple returned */
2148  TupleTableSlot *subSlot; /* tuple last obtained from subplan */
2149 } LimitState;
2150 
2151 #endif /* EXECNODES_H */
bool ioss_RuntimeKeysReady
Definition: execnodes.h:1262
Datum * elem_values
Definition: execnodes.h:1176
JoinType jointype
Definition: execnodes.h:1622
ExprContext * exprcontext
Definition: execnodes.h:638
signed short int16
Definition: c.h:301
struct AggStatePerTransData * AggStatePerTrans
Definition: execnodes.h:1820
FmgrInfo func
Definition: execnodes.h:722
AttrNumber jf_junkAttNo
Definition: execnodes.h:350
int ri_NumIndices
Definition: execnodes.h:371
int slock_t
Definition: s_lock.h:912
struct ParallelHashJoinState * parallel_state
Definition: execnodes.h:2067
AggStatePerGroup * hash_pergroup
Definition: execnodes.h:1864
Size pstate_len
Definition: execnodes.h:1028
struct GroupState GroupState
uint32 CommandId
Definition: c.h:477
HeapTuple * lr_curtuples
Definition: execnodes.h:2111
Node tag
Definition: execnodes.h:59
ScanState ss
Definition: execnodes.h:1575
IndexRuntimeKeyInfo * biss_RuntimeKeys
Definition: execnodes.h:1293
struct TupleHashTableData TupleHashTableData
struct AggStatePerGroupData * AggStatePerGroup
Definition: execnodes.h:1821
JunkFilter * ri_junkFilter
Definition: execnodes.h:410
MemoryContext ii_Context
Definition: execnodes.h:165
Definition: fmgr.h:56
AttrNumber * jf_cleanMap
Definition: execnodes.h:348
MemoryContext curaggcontext
Definition: execnodes.h:1930
HeapTuple * es_epqTuple
Definition: execnodes.h:523
struct TransitionCaptureState * mt_oc_transition_capture
Definition: execnodes.h:1002
JunkFilter * es_junkFilter
Definition: execnodes.h:449
struct dsa_area * es_query_dsa
Definition: execnodes.h:530
uint16 * ii_UniqueStrats
Definition: execnodes.h:157
NodeTag type
Definition: execnodes.h:866
bool rs_done
Definition: execnodes.h:952
Relation ri_RelationDesc
Definition: execnodes.h:368
ExprState * endOffset
Definition: execnodes.h:1910
AggStatePerPhase phases
Definition: execnodes.h:1852
struct WindowFuncExprState WindowFuncExprState
struct GMReaderTupleBuffer * gm_tuple_buffers
Definition: execnodes.h:2025
ProjectionInfo * projLeft
Definition: execnodes.h:786
int nworkers_launched
Definition: execnodes.h:1991
HeapTuple curTuple
Definition: execnodes.h:782
ExprState * ri_onConflictSetWhere
Definition: execnodes.h:419
bool nl_MatchedOuter
Definition: execnodes.h:1640
Datum * ecxt_aggvalues
Definition: execnodes.h:227
WorkerInstrumentation * worker_instrument
Definition: execnodes.h:879
struct WindowStatePerAggData * WindowStatePerAgg
Definition: execnodes.h:1879
TupleHashTable hashtable
Definition: execnodes.h:788
struct PlanState * parent
Definition: execnodes.h:100
ExprState * bitmapqualorig
Definition: execnodes.h:1375
MemoryContext tableContext
Definition: execnodes.h:2095
MemoryContext argcontext
Definition: execnodes.h:970
NodeTag type
Definition: execnodes.h:308
TupleTableSlot * hj_NullInnerTupleSlot
Definition: execnodes.h:1737
Datum startOffsetValue
Definition: execnodes.h:1911
TupleTableSlot ** ms_slots
Definition: execnodes.h:1050
ExprState * aggfilter
Definition: execnodes.h:690
ExprContext * innerecontext
Definition: execnodes.h:794
ExprState * joinqual
Definition: execnodes.h:1625
List * ii_Predicate
Definition: execnodes.h:150
struct ScanState ScanState
CommandId es_output_cid
Definition: execnodes.h:452
ProjectionInfo * ri_onConflictSetProj
Definition: execnodes.h:416
PlanState ps
Definition: execnodes.h:965
Tuplestorestate * tuplestorestate
Definition: execnodes.h:1764
ProjectionInfo * ps_ProjInfo
Definition: execnodes.h:903
SortSupport ms_sortkeys
Definition: execnodes.h:1049
Instrumentation * instrument
Definition: execnodes.h:878
struct SetOpStatePerGroupData * SetOpStatePerGroup
Definition: execnodes.h:2080
PlanState ps
Definition: execnodes.h:1098
NodeTag type
Definition: execnodes.h:208
ExprContext * mj_InnerEContext
Definition: execnodes.h:1688
bool bounded_Done
Definition: execnodes.h:1788
ExprState * eqfunction
Definition: execnodes.h:2085
Tuplestorestate * intermediate_table
Definition: execnodes.h:1072
EPQState lr_epqstate
Definition: execnodes.h:2110
bool mj_ConstFalseJoin
Definition: execnodes.h:1677
struct PartitionTupleRouting * mt_partition_tuple_routing
Definition: execnodes.h:998
int numaggs
Definition: execnodes.h:1829
TupleTableSlot * es_trig_newtup_slot
Definition: execnodes.h:479
Oid es_lastoid
Definition: execnodes.h:495
bool noCount
Definition: execnodes.h:2145
DomainConstraintType constrainttype
Definition: execnodes.h:832
Oid * eqfuncoids
Definition: execnodes.h:2086
bool agg_done
Definition: execnodes.h:1845
PlanState ps
Definition: execnodes.h:1621
struct WindowAggState WindowAggState
ScanState ss
Definition: execnodes.h:1883
bool nl_NeedNewOuter
Definition: execnodes.h:1639
struct SetExprState SetExprState
TupleTableSlot * inputslot
Definition: execnodes.h:634
Relation relation
Definition: execnodes.h:553
IndexRuntimeKeyInfo * iss_RuntimeKeys
Definition: execnodes.h:1215
int64 groupheadpos
Definition: execnodes.h:1925
bool bounded
Definition: execnodes.h:1785
NodeTag type
Definition: execnodes.h:278
TupleTableSlot * sort_slot
Definition: execnodes.h:1855
List * initPlan
Definition: execnodes.h:889
List * all_grouped_cols
Definition: execnodes.h:1849
ResultRelInfo * resultRelInfo
Definition: execnodes.h:986
Tuplesortstate * sort_out
Definition: execnodes.h:1854
struct ExprEvalStep * steps
Definition: execnodes.h:78
bool shutdown_reg
Definition: execnodes.h:760
ScanState ss
Definition: execnodes.h:1827
int16 * iss_OrderByTypLens
Definition: execnodes.h:1229
bool * innermost_casenull
Definition: execnodes.h:104
FmgrInfo * hashfunctions
Definition: execnodes.h:1075
ExprState * ii_PredicateState
Definition: execnodes.h:151
Relation ri_PartitionRoot
Definition: execnodes.h:428
ExprContext * ps_ExprContext
Definition: execnodes.h:902
MinimalTuple firstTuple
Definition: execnodes.h:608
SortSupport iss_SortSupport
Definition: execnodes.h:1227
MemoryContext ecxt_per_tuple_memory
Definition: execnodes.h:217
LimitStateCond
Definition: execnodes.h:2127
ExprState * ri_PartitionCheckExpr
Definition: execnodes.h:425
struct BitmapHeapScanState BitmapHeapScanState
tuplehash_iterator TupleHashIterator
Definition: execnodes.h:641
bool single_match
Definition: execnodes.h:1623
HashJoinTable hashtable
Definition: execnodes.h:2059
TIDBitmap * tbm
Definition: execnodes.h:1376
int64 bound
Definition: execnodes.h:1786
bool pending_srf_tuples
Definition: execnodes.h:969
struct TableFuncScanState TableFuncScanState
TupleTableSlot * mt_conflproj
Definition: execnodes.h:997
struct HashInstrumentation HashInstrumentation
Relation biss_RelationDesc
Definition: execnodes.h:1299
List * subPlan
Definition: execnodes.h:891
ParamListInfo ext_params
Definition: execnodes.h:101
void * tsm_state
Definition: execnodes.h:1151
TupleTableSlot * mj_MarkedTupleSlot
Definition: execnodes.h:1684
AttrNumber * keyColIdx
Definition: execnodes.h:626
unsigned char uint8
Definition: c.h:312
bool need_to_scan_locally
Definition: execnodes.h:2012
ExprState * tab_eq_func
Definition: execnodes.h:628
Instrumentation * ri_TrigInstrument
Definition: execnodes.h:389
PlannedStmt * es_plannedstmt
Definition: execnodes.h:446
PlanState ps
Definition: execnodes.h:2084
NodeTag type
Definition: execnodes.h:676
int64 currentgroup
Definition: execnodes.h:1922
SharedSortInfo * shared_info
Definition: execnodes.h:1792
int current_phase
Definition: execnodes.h:1835
ScanState ss
Definition: execnodes.h:1761
bool need_to_scan_locally
Definition: execnodes.h:1985
Definition: nodes.h:513
AggSplit aggsplit
Definition: execnodes.h:1832
Snapshot es_crosscheck_snapshot
Definition: execnodes.h:444
Oid * ii_ExclusionProcs
Definition: execnodes.h:153
struct CteScanState * leader
Definition: execnodes.h:1529
ScanState ss
Definition: execnodes.h:1524
int64 aggregatedupto
Definition: execnodes.h:1906
ExprState * cur_eq_func
Definition: execnodes.h:636
List * jf_targetList
Definition: execnodes.h:346
struct ExprState ExprState
TupleTableSlot * mj_NullInnerTupleSlot
Definition: execnodes.h:1686
bool ermActive
Definition: execnodes.h:561
TupleTableSlot * jf_resultSlot
Definition: execnodes.h:349
IndexRuntimeKeyInfo * ioss_RuntimeKeys
Definition: execnodes.h:1260
LockWaitPolicy waitPolicy
Definition: execnodes.h:560
bool hj_MatchedOuter
Definition: execnodes.h:1740
ExprContext * es_per_tuple_exprcontext
Definition: execnodes.h:512
struct NamedTuplestoreScanState NamedTuplestoreScanState
struct SubqueryScanState SubqueryScanState
struct TupleQueueReader ** reader
Definition: execnodes.h:1994
Oid * tab_eq_funcoids
Definition: execnodes.h:796
CmdType operation
Definition: execnodes.h:980
ScanState ss
Definition: execnodes.h:1136
Snapshot es_snapshot
Definition: execnodes.h:443
ResultRelInfo * rootResultRelInfo
Definition: execnodes.h:987
bool frametail_valid
Definition: execnodes.h:1941
TupleTableSlot ** gm_slots
Definition: execnodes.h:2023
HeapTuple grp_firstTuple
Definition: execnodes.h:2092
List * args
Definition: execnodes.h:708
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1127
bool am_worker
Definition: execnodes.h:1791
FunctionCallInfoData fcinfo_data
Definition: execnodes.h:767
struct AggStatePerPhaseData * AggStatePerPhase
Definition: execnodes.h:1822
struct WindowStatePerFuncData * WindowStatePerFunc
Definition: execnodes.h:1878
ExprState * testexpr
Definition: execnodes.h:780
int64 frametailgroup
Definition: execnodes.h:1924
MemoryContext argcontext
Definition: execnodes.h:1458
PlanState ** bitmapplans
Definition: execnodes.h:1088
Datum * innermost_domainval
Definition: execnodes.h:106
int64 grouptailpos
Definition: execnodes.h:1926
LockClauseStrength strength
Definition: execnodes.h:559
DomainConstraintType
Definition: execnodes.h:823
Relation ss_currentRelation
Definition: execnodes.h:1125
AggStatePerTrans pertrans
Definition: execnodes.h:1837
EState * state
Definition: execnodes.h:870
TupleTableSlot * hj_OuterTupleSlot
Definition: execnodes.h:1734
int projected_set
Definition: execnodes.h:1846
List * custom_ps
Definition: execnodes.h:1603
LimitStateCond lstate
Definition: execnodes.h:2146
TupleTableSlot * resultslot
Definition: execnodes.h:73
List * es_range_table
Definition: execnodes.h:445
ExprState * fdw_recheck_quals
Definition: execnodes.h:1576
struct PlanState * righttree
Definition: execnodes.h:888
unsigned int Oid
Definition: postgres_ext.h:31
Datum domainValue_datum
Definition: execnodes.h:235
NodeTag
Definition: nodes.h:26
List * hj_OuterHashKeys
Definition: execnodes.h:1726
struct ExecRowMark ExecRowMark
HeapTuple grp_firstTuple
Definition: execnodes.h:1859
ExprState * limitCount
Definition: execnodes.h:2142
TupleTableSlot * temp_slot_1
Definition: execnodes.h:1953
int current_set
Definition: execnodes.h:1847
WindowStatePerFunc perfunc
Definition: execnodes.h:1890
TupleTableSlot * hj_FirstOuterTupleSlot
Definition: execnodes.h:1738
Oid * ii_UniqueOps
Definition: execnodes.h:155
Datum(* ExprStateEvalFunc)(struct ExprState *expression, struct ExprContext *econtext, bool *isNull)
Definition: execnodes.h:49
bool grp_done
Definition: execnodes.h:1803
ExprState * indexqualorig
Definition: execnodes.h:1209
int64 position
Definition: execnodes.h:2147
SharedBitmapState
Definition: execnodes.h:1316
int numtrans
Definition: execnodes.h:1830
ScanKey iss_ScanKeys
Definition: execnodes.h:1211
Size pscan_len
Definition: execnodes.h:1137
TupleTableSlot *(* ExecProcNodeMtd)(struct PlanState *pstate)
Definition: execnodes.h:855
struct ModifyTableState ModifyTableState
PlanState * planstate
Definition: execnodes.h:936
ScanDirection es_direction
Definition: execnodes.h:442
List * indexorderbyorig
Definition: execnodes.h:1210
bool * innermost_domainnull
Definition: execnodes.h:107
PlanState ps
Definition: execnodes.h:2009
uint64 dsa_pointer
Definition: dsa.h:62
Index ri_RangeTableIndex
Definition: execnodes.h:365
ExprContext * tmpcontext
Definition: execnodes.h:1840
int64 count
Definition: execnodes.h:2144
char bool
Definition: c.h:265
PlanState ps
Definition: execnodes.h:1023
JoinType
Definition: nodes.h:677
struct PlanState * lefttree
Definition: execnodes.h:887
HeapTupleData tss_htup
Definition: execnodes.h:1415
struct HashJoinState HashJoinState
TupleTableSlot * first_part_slot
Definition: execnodes.h:1946
TupleTableSlot * mt_existing
Definition: execnodes.h:995
FmgrInfo * tab_hash_funcs
Definition: execnodes.h:627
ScanState ss
Definition: execnodes.h:1480
ExecRowMark * rowmark
Definition: execnodes.h:580
ItemPointerData curCtid
Definition: execnodes.h:562
bool es_use_parallel_mode
Definition: execnodes.h:527
SharedHashInfo * shared_info
Definition: execnodes.h:2063
const struct CustomExecMethods * methods
Definition: execnodes.h:1605
struct SharedSortInfo SharedSortInfo
List * ri_WithCheckOptionExprs
Definition: execnodes.h:404
FmgrInfo * tab_hash_funcs
Definition: execnodes.h:797
bool * iss_OrderByNulls
Definition: execnodes.h:1226
ScanState ss
Definition: execnodes.h:1801
MemoryContext perValueCxt
Definition: execnodes.h:1508
ExprContext * tmpcontext
Definition: execnodes.h:1931
PlanState ps
Definition: execnodes.h:1124
ScanKey ioss_ScanKeys
Definition: execnodes.h:1256
struct WindowObjectData * agg_winobj
Definition: execnodes.h:1904
bool inRangeNullsFirst
Definition: execnodes.h:1919
void * tuplesortstate
Definition: execnodes.h:1790
OnConflictAction mt_onconflict
Definition: execnodes.h:992
int64 frameheadpos
Definition: execnodes.h:1901
int maxsets
Definition: execnodes.h:1851
uint32 hj_CurHashValue
Definition: execnodes.h:1730
Tuplestorestate * funcResultStore
Definition: execnodes.h:729
const char * es_sourceText
Definition: execnodes.h:447
TupleDesc expectedDesc
Definition: execnodes.h:281
int hj_CurSkewBucketNo
Definition: execnodes.h:1732
List * ii_ExpressionsState
Definition: execnodes.h:149
struct ProjectSetState ProjectSetState
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:901
ParamExecData * es_param_exec_vals
Definition: execnodes.h:483
unsigned short uint16
Definition: c.h:313
MemoryContext es_query_cxt
Definition: execnodes.h:488
ExprState * cur_eq_comp
Definition: execnodes.h:801
ExprState * eqfunction
Definition: execnodes.h:1971
struct ParallelExecutorInfo * pei
Definition: execnodes.h:2018
struct FunctionScanState FunctionScanState
bool mj_MatchedOuter
Definition: execnodes.h:1680
PlanState ps
Definition: execnodes.h:1087
bool table_filled
Definition: execnodes.h:1861
AggStrategy aggstrategy
Definition: execnodes.h:1831
ExprState * partEqfunction
Definition: execnodes.h:1892
FmgrInfo * in_hash_funcs
Definition: execnodes.h:635
NodeTag type
Definition: execnodes.h:362
PlanState ps
Definition: execnodes.h:979
int64 offset
Definition: execnodes.h:2143
bool initialized
Definition: execnodes.h:1984
Bitmapset * notnulls
Definition: execnodes.h:1502
struct PlanState * planstate
Definition: execnodes.h:778
TupleTableSlot * hj_NullOuterTupleSlot
Definition: execnodes.h:1736
bool resnull
Definition: execnodes.h:67
ScanState ss
Definition: execnodes.h:1409
ParallelBitmapHeapState * pstate
Definition: execnodes.h:1393
struct CustomScanState CustomScanState
struct ResultRelInfo ResultRelInfo
Expr * expr
Definition: execnodes.h:87
FmgrInfo endInRangeFunc
Definition: execnodes.h:1916
List * args
Definition: execnodes.h:781
SubPlan * subplan
Definition: execnodes.h:777
ExprState * eqfunction
Definition: execnodes.h:1802
ParallelAppendState * as_pstate
Definition: execnodes.h:1027
struct ParallelExecutorInfo * pei
Definition: execnodes.h:1989
Datum caseValue_datum
Definition: execnodes.h:231
PlanState ** bitmapplans
Definition: execnodes.h:1099
ExprContext_CB * ecxt_callbacks
Definition: execnodes.h:242
List * tss_tidexprs
Definition: execnodes.h:1410
NodeTag type
Definition: execnodes.h:345
AlternativeSubPlan * subplan
Definition: execnodes.h:811
struct SeqScanState SeqScanState
bool iss_ReachedEnd
Definition: execnodes.h:1224
struct TupleHashEntryData TupleHashEntryData
List * arowMarks
Definition: execnodes.h:939
struct HashJoinTupleData * HashJoinTuple
Definition: execnodes.h:1719
ExprState * resconstantqual
Definition: execnodes.h:951
bool mj_MatchedInner
Definition: execnodes.h:1681
bool ri_usesFdwDirectModify
Definition: execnodes.h:398
ScanState ss
Definition: execnodes.h:1600
Tuplesortstate * sort_in
Definition: execnodes.h:1853
AttrNumber * keyColIdx
Definition: execnodes.h:795
MemoryContext tempContext
Definition: execnodes.h:1076
ItemPointerData * tss_TidList
Definition: execnodes.h:1414
NodeTag type
Definition: execnodes.h:706
ExprState ** ri_TrigWhenExprs
Definition: execnodes.h:386
TupleTableSlot * temp_slot_2
Definition: execnodes.h:1954
PlanState ps
Definition: execnodes.h:2108
ExprState * key_expr
Definition: execnodes.h:1166
bool funcReturnsSet
Definition: execnodes.h:743
Aggref * aggref
Definition: execnodes.h:677
struct BitmapAndState BitmapAndState
Datum endOffsetValue
Definition: execnodes.h:1912
Index rti
Definition: execnodes.h:555
WindowStatePerAgg peragg
Definition: execnodes.h:1891
struct TransitionCaptureState * mt_transition_capture
Definition: execnodes.h:1000
ExprContext * ioss_RuntimeContext
Definition: execnodes.h:1263
ExprStateEvalFunc evalfunc
Definition: execnodes.h:84
struct MergeJoinClauseData * MergeJoinClause
Definition: execnodes.h:1667
ExprState * ordEqfunction
Definition: execnodes.h:1893
struct EPQState EPQState
void * ermExtra
Definition: execnodes.h:563
Node ** elems
Definition: execnodes.h:966
const struct TableFuncRoutine * routine
Definition: execnodes.h:1504
int iss_NumRuntimeKeys
Definition: execnodes.h:1216
struct MergeJoinState MergeJoinState
ExprState * startOffset
Definition: execnodes.h:1909
int64 frameheadgroup
Definition: execnodes.h:1923
MemoryContext tablecxt
Definition: execnodes.h:629
struct ExecAuxRowMark ExecAuxRowMark
TupleDesc jf_cleanTupType
Definition: execnodes.h:347
AttrNumber wholeAttNo
Definition: execnodes.h:583
HashJoinTuple hj_CurTuple
Definition: execnodes.h:1733
Oid * ii_UniqueProcs
Definition: execnodes.h:156
PlanState ps
Definition: execnodes.h:1970
bool table_filled
Definition: execnodes.h:2096
ResultRelInfo * es_result_relations
Definition: execnodes.h:455
int64 aggregatedbase
Definition: execnodes.h:1905
Index prti
Definition: execnodes.h:556
struct ExprContext ExprContext
IndexScanDesc ioss_ScanDesc
Definition: execnodes.h:1265
ExprState * docexpr
Definition: execnodes.h:1496
ScanDirection
Definition: sdir.h:22
EPQState mt_epqstate
Definition: execnodes.h:990
bool * iss_OrderByTypByVals
Definition: execnodes.h:1228
struct TupleHashTableData * TupleHashTable
Definition: execnodes.h:604
long numOutput
Definition: execnodes.h:2089
bool tss_isCurrentOf
Definition: execnodes.h:1411
PlanState ** mergeplans
Definition: execnodes.h:1046
struct ValuesScanState ValuesScanState
struct AggStatePerHashData * AggStatePerHash
Definition: execnodes.h:1823
TupleTableSlot * ecxt_innertuple
Definition: execnodes.h:212
TupleTableSlot * es_trig_oldtup_slot
Definition: execnodes.h:478
bool havenullrows
Definition: execnodes.h:791
ParamExecData * ecxt_param_exec_vals
Definition: execnodes.h:220
ExprState * limitOffset
Definition: execnodes.h:2141
ExprState * check_exprstate
Definition: execnodes.h:835
struct MaterialState MaterialState
struct EState * ecxt_estate
Definition: execnodes.h:239
struct ProjectionInfo ProjectionInfo
List * hashkeys
Definition: execnodes.h:2060
struct HashState HashState
ProjectionInfo * ri_projectReturning
Definition: execnodes.h:413
bool eof_underlying
Definition: execnodes.h:1763
struct FdwRoutine * ri_FdwRoutine
Definition: execnodes.h:392
bool ii_BrokenHotChain
Definition: execnodes.h:161
unsigned int uint32
Definition: c.h:314
PlanState ps
Definition: execnodes.h:2058
int64 bound_Done
Definition: execnodes.h:1789
struct FdwRoutine * fdwroutine
Definition: execnodes.h:1579
AggStatePerAgg curperagg
Definition: execnodes.h:1842
struct PlanState * parent
Definition: execnodes.h:779
struct binaryheap * gm_heap
Definition: execnodes.h:2026
AggStatePerHash perhash
Definition: execnodes.h:1863
ScanState ss
Definition: execnodes.h:1783
PlanState ps
Definition: execnodes.h:1983
MergeJoinClause mj_Clauses
Definition: execnodes.h:1673
dsa_pointer tbmiterator
Definition: execnodes.h:1338
Tuplestorestate * buffer
Definition: execnodes.h:1894
int es_instrument
Definition: execnodes.h:498
struct GatherMergeState GatherMergeState
MemoryContext aggcontext
Definition: execnodes.h:1929
ExprState * repeatable
Definition: execnodes.h:1148
Datum * innermost_caseval
Definition: execnodes.h:103
bool iss_RuntimeKeysReady
Definition: execnodes.h:1217
TupleTableSlot * es_trig_tuple_slot
Definition: execnodes.h:477
TupleHashTable hashtable
Definition: execnodes.h:1077
PlanState * subplan
Definition: execnodes.h:1428
TupleTableSlot * origslot
Definition: execnodes.h:937
struct LockRowsState LockRowsState
struct RecursiveUnionState RecursiveUnionState
bool ii_ReadyForInserts
Definition: execnodes.h:159
HashInstrumentation * hinstrument
Definition: execnodes.h:2064
List * hj_HashOperators
Definition: execnodes.h:1728
Bitmapset * grouped_cols
Definition: execnodes.h:1848
struct HashJoinTableData * HashJoinTable
Definition: execnodes.h:1720
ExprState ** ri_ConstraintExprs
Definition: execnodes.h:407
TBMIterateResult * tbmres
Definition: execnodes.h:1378
TriggerDesc * ri_TrigDesc
Definition: execnodes.h:380
struct AggState AggState
ScanKey ioss_OrderByKeys
Definition: execnodes.h:1258
Index rowmarkId
Definition: execnodes.h:557
TupleHashIterator hashiter
Definition: execnodes.h:2097
void * evalfunc_private
Definition: execnodes.h:90
Bitmapset * chgParam
Definition: execnodes.h:896
struct AggrefExprState AggrefExprState
struct ExprContext_CB * next
Definition: execnodes.h:178
Tuplestorestate * working_table
Definition: execnodes.h:1071
bool rs_checkqual
Definition: execnodes.h:953
void * ii_AmCache
Definition: execnodes.h:164
struct AlternativeSubPlanState AlternativeSubPlanState
QueryEnvironment * es_queryEnv
Definition: execnodes.h:485
int es_num_root_result_relations
Definition: execnodes.h:467
int hj_CurBucketNo
Definition: execnodes.h:1731
RecursiveUnionState * rustate
Definition: execnodes.h:1564
PlanState ** mt_plans
Definition: execnodes.h:983
struct FunctionScanPerFuncState * funcstates
Definition: execnodes.h:1457
int num_hashes
Definition: execnodes.h:1862
SetFunctionReturnMode
Definition: execnodes.h:262
int64 spooled_rows
Definition: execnodes.h:1899
bool domainValue_isNull
Definition: execnodes.h:236
bool input_done
Definition: execnodes.h:1844
ExprDoneCond
Definition: execnodes.h:249
ProjectionInfo * combinedproj
Definition: execnodes.h:1870
ExprContext * curaggcontext
Definition: execnodes.h:1841
ExprContext * hashcontext
Definition: execnodes.h:1838
bool * ecxt_aggnulls
Definition: execnodes.h:228
bool mj_SkipMarkRestore
Definition: execnodes.h:1675
TupleConversionMap ** mt_per_subplan_tupconv_maps
Definition: execnodes.h:1004
struct NestLoopState NestLoopState
List * es_trig_target_relations
Definition: execnodes.h:476
Plan * plan
Definition: execnodes.h:938
List * es_tupleTable
Definition: execnodes.h:490
LockClauseStrength
Definition: lockoptions.h:21
AggStatePerPhase phase
Definition: execnodes.h:1833
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:874
List * es_auxmodifytables
Definition: execnodes.h:505
Datum curArray
Definition: execnodes.h:783
uintptr_t Datum
Definition: postgres.h:365
TupleDesc tupDesc
Definition: execnodes.h:2015
IndexScanDesc biss_ScanDesc
Definition: execnodes.h:1300
ExecProcNodeMtd ExecProcNodeReal
Definition: execnodes.h:875
ExprContext * rowcontext
Definition: execnodes.h:1481
int ii_NumIndexAttrs
Definition: execnodes.h:146
TupleTableSlot * funnel_slot
Definition: execnodes.h:1988
List * ri_WithCheckOptions
Definition: execnodes.h:401
TupleDesc funcResultDesc
Definition: execnodes.h:736
Expr * expr
Definition: execnodes.h:707
struct TupleHashEntryData * TupleHashEntry
Definition: execnodes.h:603
TupleTableSlot * agg_row_slot
Definition: execnodes.h:1952
int es_num_result_relations
Definition: execnodes.h:456
TIDBitmap * biss_result
Definition: execnodes.h:1290
List * ri_PartitionCheck
Definition: execnodes.h:422
unsigned int Index
Definition: c.h:431
struct TupleQueueReader ** reader
Definition: execnodes.h:2024
FmgrInfo * hashfunctions
Definition: execnodes.h:2087
TupleTableSlot * nl_NullInnerTupleSlot
Definition: execnodes.h:1641
Plan * plan
Definition: execnodes.h:868
TupleTableSlot * frametail_slot
Definition: execnodes.h:1949
MemoryContext hashtempcxt
Definition: execnodes.h:793
bool more_partitions
Definition: execnodes.h:1937
struct SampleScanState SampleScanState
List * es_tuple_routing_result_relations
Definition: execnodes.h:473
Relation ioss_RelationDesc
Definition: execnodes.h:1264
bool es_finished
Definition: execnodes.h:499
PlanState ps
Definition: execnodes.h:1045
void * ri_FdwState
Definition: execnodes.h:395
ExprState * array_expr
Definition: execnodes.h:1173
int allowedModes
Definition: execnodes.h:282
struct EState EState
JoinState js
Definition: execnodes.h:1671
MemoryContext hashtablecxt
Definition: execnodes.h:792
dsa_pointer prefetch_iterator
Definition: execnodes.h:1339
struct binaryheap * ms_heap
Definition: execnodes.h:1051
tuplehash_hash * hashtab
Definition: execnodes.h:624
ScanState ss
Definition: execnodes.h:1208
bool ii_Unique
Definition: execnodes.h:158
struct PlanState PlanState
SetFunctionReturnMode returnMode
Definition: execnodes.h:284
ExprContext ** aggcontexts
Definition: execnodes.h:1839
MemoryContext tableContext
Definition: execnodes.h:1078
TupleTableSlot * ecxt_outertuple
Definition: execnodes.h:213
bool hj_OuterNotEmpty
Definition: execnodes.h:1741
int64 frametailpos
Definition: execnodes.h:1902
List * ii_Expressions
Definition: execnodes.h:148
NodeTag type
Definition: execnodes.h:145
FmgrInfo * tab_eq_funcs
Definition: execnodes.h:798
TupleTableSlot * tableslot
Definition: execnodes.h:632
TupleTableSlot * mj_InnerTupleSlot
Definition: execnodes.h:1683
struct AggStatePerAggData * AggStatePerAgg
Definition: execnodes.h:1819
FmgrInfo startInRangeFunc
Definition: execnodes.h:1915
bool grouptail_valid
Definition: execnodes.h:1943
TupleTableSlot * framehead_slot
Definition: execnodes.h:1948
bool setop_done
Definition: execnodes.h:2088
struct UniqueState UniqueState
FmgrInfo * in_functions
Definition: execnodes.h:1505
TupleTableSlot * subSlot
Definition: execnodes.h:2148
RowMarkType markType
Definition: execnodes.h:558
uint64 es_processed
Definition: execnodes.h:494
void(* ExprContextCallbackFunction)(Datum arg)
Definition: execnodes.h:174
int as_whichplan
Definition: execnodes.h:1026
#define INDEX_MAX_KEYS
AggStatePerGroup * pergroups
Definition: execnodes.h:1857
int ii_ParallelWorkers
Definition: execnodes.h:162
size_t Size
Definition: c.h:422
AggSplit
Definition: nodes.h:761
bool funcReturnsTuple
Definition: execnodes.h:737
ExprContext * mj_OuterEContext
Definition: execnodes.h:1687
struct ParallelBitmapHeapState ParallelBitmapHeapState
bool randomAccess
Definition: execnodes.h:1784
RowMarkType
Definition: plannodes.h:972
struct SetOpState SetOpState
SharedBitmapState state
Definition: execnodes.h:1343
bool sort_Done
Definition: execnodes.h:1787
Tuplestorestate * relation
Definition: execnodes.h:1550
ExprState * indexqual
Definition: execnodes.h:1255
TupleTableSlot * ecxt_scantuple
Definition: execnodes.h:211
SetOpStatePerGroup pergroup
Definition: execnodes.h:2091
bool * es_epqTupleSet
Definition: execnodes.h:524
List * es_subplanstates
Definition: execnodes.h:503
struct TsmRoutine * tsmroutine
Definition: execnodes.h:1150
TBMSharedIterator * shared_tbmiterator
Definition: execnodes.h:1391
AttrNumber toidAttNo
Definition: execnodes.h:582
List * es_rowMarks
Definition: execnodes.h:492
ExprContext * iss_RuntimeContext
Definition: execnodes.h:1218
TBMIterator * tbmiterator
Definition: execnodes.h:1377
MemoryContext ecxt_per_query_memory
Definition: execnodes.h:216
TupleTableSlot * mj_NullOuterTupleSlot
Definition: execnodes.h:1685
int numphases
Definition: execnodes.h:1834
struct IndexInfo IndexInfo
bool ii_Concurrent
Definition: execnodes.h:160
FmgrInfo * lhs_hash_funcs
Definition: execnodes.h:799
int64 currentpos
Definition: execnodes.h:1900
ExprState * qual
Definition: execnodes.h:886
Tuplestorestate * setResult
Definition: execnodes.h:287
FmgrInfo * cur_eq_funcs
Definition: execnodes.h:800
List * mt_arbiterindexes
Definition: execnodes.h:993
bool setArgsValid
Definition: execnodes.h:752
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1126
PlanState * cteplanstate
Definition: execnodes.h:1527
ExprContext * econtext
Definition: execnodes.h:280
struct MergeAppendState MergeAppendState
JoinState js
Definition: execnodes.h:1638
IndexArrayKeyInfo * biss_ArrayKeys
Definition: execnodes.h:1295
List * mt_excludedtlist
Definition: execnodes.h:996
int nextreader
Definition: execnodes.h:1993
TupleTableSlot * funcResultSlot
Definition: execnodes.h:730
TupleTableSlot * hj_HashTupleSlot
Definition: execnodes.h:1735
List * hj_InnerHashKeys
Definition: execnodes.h:1727
Definition: dsa.c:354
bool caseValue_isNull
Definition: execnodes.h:232
bool partition_spooled
Definition: execnodes.h:1935
Oid * ii_ExclusionOps
Definition: execnodes.h:152
AggStrategy
Definition: nodes.h:739
struct TidScanState TidScanState
TupleDesc setDesc
Definition: execnodes.h:288
ConditionVariable cv
Definition: execnodes.h:1344
ExprState * elidedFuncState
Definition: execnodes.h:715
struct ReturnSetInfo ReturnSetInfo
int steps_alloc
Definition: execnodes.h:98
struct GatherState GatherState
HashJoinTable hj_HashTable
Definition: execnodes.h:1729
int es_top_eflags
Definition: execnodes.h:497
AggStatePerAgg peragg
Definition: execnodes.h:1836
bool framehead_valid
Definition: execnodes.h:1939
int steps_len
Definition: execnodes.h:97
PlanState ** appendplans
Definition: execnodes.h:1024
TBMIterator * prefetch_iterator
Definition: execnodes.h:1385
ResultRelInfo * es_root_result_relations
Definition: execnodes.h:466
TupleDesc descRight
Definition: execnodes.h:785
struct DomainConstraintState DomainConstraintState
IndexInfo ** ri_IndexRelationInfo
Definition: execnodes.h:377
List * lr_arowMarks
Definition: execnodes.h:2109
struct ExprContext_CB ExprContext_CB
NodeTag type
Definition: execnodes.h:776
bool * es_epqScanDone
Definition: execnodes.h:525
struct JunkFilter JunkFilter
ExprDoneCond * elemdone
Definition: execnodes.h:967
uint8 flags
Definition: execnodes.h:61
NodeTag type
Definition: execnodes.h:439
ExprState pi_state
Definition: execnodes.h:310
void * arg
AggStatePerTrans curpertrans
Definition: execnodes.h:1843
int epqParam
Definition: execnodes.h:940
ParamListInfo es_param_list_info
Definition: execnodes.h:482
List * es_exprcontexts
Definition: execnodes.h:501
MemoryContext tempcxt
Definition: execnodes.h:630
ProjectionInfo * projRight
Definition: execnodes.h:787
MemoryContext partcontext
Definition: execnodes.h:1928
struct CteScanState CteScanState
ExprDoneCond isDone
Definition: execnodes.h:285
struct ResultState ResultState
WindowFunc * wfunc
Definition: execnodes.h:688
List * aggs
Definition: execnodes.h:1828
ExprContext * biss_RuntimeContext
Definition: execnodes.h:1298
bool mj_ExtraMarks
Definition: execnodes.h:1676
EState * estate
Definition: execnodes.h:935
Datum * iss_OrderByValues
Definition: execnodes.h:1225
uint16 * ii_ExclusionStrats
Definition: execnodes.h:154
struct BitmapIndexScanState BitmapIndexScanState
ParamListInfo ecxt_param_list_info
Definition: execnodes.h:221
int iss_NumOrderByKeys
Definition: execnodes.h:1214
Tuplestorestate * cte_table
Definition: execnodes.h:1531
List ** exprlists
Definition: execnodes.h:1482
ExprContext * pi_exprContext
Definition: execnodes.h:312
IndexScanDesc iss_ScanDesc
Definition: execnodes.h:1220
struct SortState SortState
Definition: pg_list.h:45
Tuplestorestate * tupstore
Definition: execnodes.h:1509
int Buffer
Definition: buf.h:23
OnConflictAction
Definition: nodes.h:803
bool havehashrows
Definition: execnodes.h:790
Datum resvalue
Definition: execnodes.h:68
int16 AttrNumber
Definition: attnum.h:21
ExprState * rowexpr
Definition: execnodes.h:1497
JoinState js
Definition: execnodes.h:1724
struct IndexOnlyScanState IndexOnlyScanState
LockWaitPolicy
Definition: lockoptions.h:36
CmdType
Definition: nodes.h:653
TupleHashTable hashnulls
Definition: execnodes.h:789
AttrNumber ctidAttNo
Definition: execnodes.h:581
RelationPtr ri_IndexRelationDescs
Definition: execnodes.h:374
PlanState ps
Definition: execnodes.h:2140
struct SubPlanState SubPlanState
TBMSharedIterator * shared_prefetch_iterator
Definition: execnodes.h:1392
struct IndexScanState IndexScanState
TupleHashTable hashtable
Definition: execnodes.h:2094
ExprState * hashclauses
Definition: execnodes.h:1725
FmgrInfo * ri_TrigFunctions
Definition: execnodes.h:383
struct ForeignScanState ForeignScanState
struct BitmapOrState BitmapOrState
Relation iss_RelationDesc
Definition: execnodes.h:1219
List ** mt_arowmarks
Definition: execnodes.h:989
TupleTableSlot * mj_OuterTupleSlot
Definition: execnodes.h:1682
SortSupport gm_sortkeys
Definition: execnodes.h:2017
pairingheap * iss_ReorderQueue
Definition: execnodes.h:1223
struct SharedHashInfo SharedHashInfo
struct LimitState LimitState
int64 tuples_needed
Definition: execnodes.h:1986
AggStatePerGroup * all_pergroups
Definition: execnodes.h:1868
struct WorkTableScanState WorkTableScanState
struct JoinState JoinState
Oid ii_Am
Definition: execnodes.h:163
PlanState ps
Definition: execnodes.h:950
ScanState ss
Definition: execnodes.h:1146
ScanKey iss_OrderByKeys
Definition: execnodes.h:1213
ResultRelInfo * es_result_relation_info
Definition: execnodes.h:457