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