PostgreSQL Source Code  git master
execnodes.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * execnodes.h
4  * definitions for executor state nodes
5  *
6  *
7  * Portions Copyright (c) 1996-2022, 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/tupconvert.h"
18 #include "executor/instrument.h"
19 #include "fmgr.h"
20 #include "lib/ilist.h"
21 #include "lib/pairingheap.h"
22 #include "nodes/params.h"
23 #include "nodes/plannodes.h"
24 #include "nodes/tidbitmap.h"
25 #include "partitioning/partdefs.h"
27 #include "utils/hsearch.h"
28 #include "utils/queryenvironment.h"
29 #include "utils/reltrigger.h"
30 #include "utils/sharedtuplestore.h"
31 #include "utils/snapshot.h"
32 #include "utils/sortsupport.h"
33 #include "utils/tuplesort.h"
34 #include "utils/tuplestore.h"
35 
36 struct PlanState; /* forward references in this file */
38 struct ExecRowMark;
39 struct ExprState;
40 struct ExprContext;
41 struct RangeTblEntry; /* avoid including parsenodes.h here */
42 struct ExprEvalStep; /* avoid including execExpr.h everywhere */
44 struct LogicalTapeSet;
45 
46 
47 /* ----------------
48  * ExprState node
49  *
50  * ExprState is the top-level node for expression evaluation.
51  * It contains instructions (in ->steps) to evaluate the expression.
52  * ----------------
53  */
54 typedef Datum (*ExprStateEvalFunc) (struct ExprState *expression,
55  struct ExprContext *econtext,
56  bool *isNull);
57 
58 /* Bits in ExprState->flags (see also execExpr.h for private flag bits): */
59 /* expression is for use with ExecQual() */
60 #define EEO_FLAG_IS_QUAL (1 << 0)
61 
62 typedef struct ExprState
63 {
65 
66  uint8 flags; /* bitmask of EEO_FLAG_* bits, see above */
67 
68  /*
69  * Storage for result value of a scalar expression, or for individual
70  * column results within expressions built by ExecBuildProjectionInfo().
71  */
72 #define FIELDNO_EXPRSTATE_RESNULL 2
73  bool resnull;
74 #define FIELDNO_EXPRSTATE_RESVALUE 3
76 
77  /*
78  * If projecting a tuple result, this slot holds the result; else NULL.
79  */
80 #define FIELDNO_EXPRSTATE_RESULTSLOT 4
82 
83  /*
84  * Instructions to compute expression's return value.
85  */
87 
88  /*
89  * Function that actually evaluates the expression. This can be set to
90  * different values depending on the complexity of the expression.
91  */
93 
94  /* original expression tree, for debugging only */
96 
97  /* private state for an evalfunc */
99 
100  /*
101  * XXX: following fields only needed during "compilation" (ExecInitExpr);
102  * could be thrown away afterwards.
103  */
104 
105  int steps_len; /* number of steps currently */
106  int steps_alloc; /* allocated length of steps array */
107 
108 #define FIELDNO_EXPRSTATE_PARENT 11
109  struct PlanState *parent; /* parent PlanState node, if any */
110  ParamListInfo ext_params; /* for compiling PARAM_EXTERN nodes */
111 
114 
118 
119 
120 /* ----------------
121  * IndexInfo information
122  *
123  * this struct holds the information needed to construct new index
124  * entries for a particular index. Used for both index_build and
125  * retail creation of index entries.
126  *
127  * NumIndexAttrs total number of columns in this index
128  * NumIndexKeyAttrs number of key columns in index
129  * IndexAttrNumbers underlying-rel attribute numbers used as keys
130  * (zeroes indicate expressions). It also contains
131  * info about included columns.
132  * Expressions expr trees for expression entries, or NIL if none
133  * ExpressionsState exec state for expressions, or NIL if none
134  * Predicate partial-index predicate, or NIL if none
135  * PredicateState exec state for predicate, or NIL if none
136  * ExclusionOps Per-column exclusion operators, or NULL if none
137  * ExclusionProcs Underlying function OIDs for ExclusionOps
138  * ExclusionStrats Opclass strategy numbers for ExclusionOps
139  * UniqueOps These are like Exclusion*, but for unique indexes
140  * UniqueProcs
141  * UniqueStrats
142  * Unique is it a unique index?
143  * OpclassOptions opclass-specific options, or NULL if none
144  * ReadyForInserts is it valid for inserts?
145  * CheckedUnchanged IndexUnchanged status determined yet?
146  * IndexUnchanged aminsert hint, cached for retail inserts
147  * Concurrent are we doing a concurrent index build?
148  * BrokenHotChain did we detect any broken HOT chains?
149  * ParallelWorkers # of workers requested (excludes leader)
150  * Am Oid of index AM
151  * AmCache private cache area for index AM
152  * Context memory context holding this IndexInfo
153  *
154  * ii_Concurrent, ii_BrokenHotChain, and ii_ParallelWorkers are used only
155  * during index build; they're conventionally zeroed otherwise.
156  * ----------------
157  */
158 typedef struct IndexInfo
159 {
161  int ii_NumIndexAttrs; /* total number of columns in index */
162  int ii_NumIndexKeyAttrs; /* number of key columns in index */
164  List *ii_Expressions; /* list of Expr */
165  List *ii_ExpressionsState; /* list of ExprState */
166  List *ii_Predicate; /* list of Expr */
168  Oid *ii_ExclusionOps; /* array with one entry per column */
169  Oid *ii_ExclusionProcs; /* array with one entry per column */
170  uint16 *ii_ExclusionStrats; /* array with one entry per column */
171  Oid *ii_UniqueOps; /* array with one entry per column */
172  Oid *ii_UniqueProcs; /* array with one entry per column */
173  uint16 *ii_UniqueStrats; /* array with one entry per column */
174  Datum *ii_OpclassOptions; /* array with one entry per column */
175  bool ii_Unique;
184  void *ii_AmCache;
187 
188 /* ----------------
189  * ExprContext_CB
190  *
191  * List of callbacks to be called at ExprContext shutdown.
192  * ----------------
193  */
195 
196 typedef struct ExprContext_CB
197 {
202 
203 /* ----------------
204  * ExprContext
205  *
206  * This class holds the "current context" information
207  * needed to evaluate expressions for doing tuple qualifications
208  * and tuple projections. For example, if an expression refers
209  * to an attribute in the current inner tuple then we need to know
210  * what the current inner tuple is and so we look at the expression
211  * context.
212  *
213  * There are two memory contexts associated with an ExprContext:
214  * * ecxt_per_query_memory is a query-lifespan context, typically the same
215  * context the ExprContext node itself is allocated in. This context
216  * can be used for purposes such as storing function call cache info.
217  * * ecxt_per_tuple_memory is a short-term context for expression results.
218  * As the name suggests, it will typically be reset once per tuple,
219  * before we begin to evaluate expressions for that tuple. Each
220  * ExprContext normally has its very own per-tuple memory context.
221  *
222  * CurrentMemoryContext should be set to ecxt_per_tuple_memory before
223  * calling ExecEvalExpr() --- see ExecEvalExprSwitchContext().
224  * ----------------
225  */
226 typedef struct ExprContext
227 {
229 
230  /* Tuples that Var nodes in expression may refer to */
231 #define FIELDNO_EXPRCONTEXT_SCANTUPLE 1
233 #define FIELDNO_EXPRCONTEXT_INNERTUPLE 2
235 #define FIELDNO_EXPRCONTEXT_OUTERTUPLE 3
237 
238  /* Memory contexts for expression evaluation --- see notes above */
241 
242  /* Values to substitute for Param nodes in expression */
243  ParamExecData *ecxt_param_exec_vals; /* for PARAM_EXEC params */
244  ParamListInfo ecxt_param_list_info; /* for other param types */
245 
246  /*
247  * Values to substitute for Aggref nodes in the expressions of an Agg
248  * node, or for WindowFunc nodes within a WindowAgg node.
249  */
250 #define FIELDNO_EXPRCONTEXT_AGGVALUES 8
251  Datum *ecxt_aggvalues; /* precomputed values for aggs/windowfuncs */
252 #define FIELDNO_EXPRCONTEXT_AGGNULLS 9
253  bool *ecxt_aggnulls; /* null flags for aggs/windowfuncs */
254 
255  /* Value to substitute for CaseTestExpr nodes in expression */
256 #define FIELDNO_EXPRCONTEXT_CASEDATUM 10
258 #define FIELDNO_EXPRCONTEXT_CASENULL 11
260 
261  /* Value to substitute for CoerceToDomainValue nodes in expression */
262 #define FIELDNO_EXPRCONTEXT_DOMAINDATUM 12
264 #define FIELDNO_EXPRCONTEXT_DOMAINNULL 13
266 
267  /* Link to containing EState (NULL if a standalone ExprContext) */
269 
270  /* Functions to call back when ExprContext is shut down or rescanned */
273 
274 /*
275  * Set-result status used when evaluating functions potentially returning a
276  * set.
277  */
278 typedef enum
279 {
280  ExprSingleResult, /* expression does not return a set */
281  ExprMultipleResult, /* this result is an element of a set */
282  ExprEndResult /* there are no more elements in the set */
284 
285 /*
286  * Return modes for functions returning sets. Note values must be chosen
287  * as separate bits so that a bitmask can be formed to indicate supported
288  * modes. SFRM_Materialize_Random and SFRM_Materialize_Preferred are
289  * auxiliary flags about SFRM_Materialize mode, rather than separate modes.
290  */
291 typedef enum
292 {
293  SFRM_ValuePerCall = 0x01, /* one value returned per call */
294  SFRM_Materialize = 0x02, /* result set instantiated in Tuplestore */
295  SFRM_Materialize_Random = 0x04, /* Tuplestore needs randomAccess */
296  SFRM_Materialize_Preferred = 0x08 /* caller prefers Tuplestore */
298 
299 /*
300  * When calling a function that might return a set (multiple rows),
301  * a node of this type is passed as fcinfo->resultinfo to allow
302  * return status to be passed back. A function returning set should
303  * raise an error if no such resultinfo is provided.
304  */
305 typedef struct ReturnSetInfo
306 {
308  /* values set by caller: */
309  ExprContext *econtext; /* context function is being called in */
310  TupleDesc expectedDesc; /* tuple descriptor expected by caller */
311  int allowedModes; /* bitmask: return modes caller can handle */
312  /* result status from function (but pre-initialized by caller): */
313  SetFunctionReturnMode returnMode; /* actual return mode */
314  ExprDoneCond isDone; /* status for ValuePerCall mode */
315  /* fields filled by function in Materialize return mode: */
316  Tuplestorestate *setResult; /* holds the complete returned tuple set */
317  TupleDesc setDesc; /* actual descriptor for returned tuples */
319 
320 /* ----------------
321  * ProjectionInfo node information
322  *
323  * This is all the information needed to perform projections ---
324  * that is, form new tuples by evaluation of targetlist expressions.
325  * Nodes which need to do projections create one of these.
326  *
327  * The target tuple slot is kept in ProjectionInfo->pi_state.resultslot.
328  * ExecProject() evaluates the tlist, forms a tuple, and stores it
329  * in the given slot. Note that the result will be a "virtual" tuple
330  * unless ExecMaterializeSlot() is then called to force it to be
331  * converted to a physical tuple. The slot must have a tupledesc
332  * that matches the output of the tlist!
333  * ----------------
334  */
335 typedef struct ProjectionInfo
336 {
338  /* instructions to evaluate projection */
340  /* expression context in which to evaluate expression */
343 
344 /* ----------------
345  * JunkFilter
346  *
347  * This class is used to store information regarding junk attributes.
348  * A junk attribute is an attribute in a tuple that is needed only for
349  * storing intermediate information in the executor, and does not belong
350  * in emitted tuples. For example, when we do an UPDATE query,
351  * the planner adds a "junk" entry to the targetlist so that the tuples
352  * returned to ExecutePlan() contain an extra attribute: the ctid of
353  * the tuple to be updated. This is needed to do the update, but we
354  * don't want the ctid to be part of the stored new tuple! So, we
355  * apply a "junk filter" to remove the junk attributes and form the
356  * real output tuple. The junkfilter code also provides routines to
357  * extract the values of the junk attribute(s) from the input tuple.
358  *
359  * targetList: the original target list (including junk attributes).
360  * cleanTupType: the tuple descriptor for the "clean" tuple (with
361  * junk attributes removed).
362  * cleanMap: A map with the correspondence between the non-junk
363  * attribute numbers of the "original" tuple and the
364  * attribute numbers of the "clean" tuple.
365  * resultSlot: tuple slot used to hold cleaned tuple.
366  * ----------------
367  */
368 typedef struct JunkFilter
369 {
376 
377 /*
378  * OnConflictSetState
379  *
380  * Executor state of an ON CONFLICT DO UPDATE operation.
381  */
382 typedef struct OnConflictSetState
383 {
385 
386  TupleTableSlot *oc_Existing; /* slot to store existing target tuple in */
387  TupleTableSlot *oc_ProjSlot; /* CONFLICT ... SET ... projection target */
388  ProjectionInfo *oc_ProjInfo; /* for ON CONFLICT DO UPDATE SET */
389  ExprState *oc_WhereClause; /* state for the WHERE clause */
391 
392 /* ----------------
393  * MergeActionState information
394  *
395  * Executor state for a MERGE action.
396  * ----------------
397  */
398 typedef struct MergeActionState
399 {
401 
402  MergeAction *mas_action; /* associated MergeAction node */
403  ProjectionInfo *mas_proj; /* projection of the action's targetlist for
404  * this rel */
405  ExprState *mas_whenqual; /* WHEN [NOT] MATCHED AND conditions */
407 
408 /*
409  * ResultRelInfo
410  *
411  * Whenever we update an existing relation, we have to update indexes on the
412  * relation, and perhaps also fire triggers. ResultRelInfo holds all the
413  * information needed about a result relation, including indexes.
414  *
415  * Normally, a ResultRelInfo refers to a table that is in the query's range
416  * table; then ri_RangeTableIndex is the RT index and ri_RelationDesc is
417  * just a copy of the relevant es_relations[] entry. However, in some
418  * situations we create ResultRelInfos for relations that are not in the
419  * range table, namely for targets of tuple routing in a partitioned table,
420  * and when firing triggers in tables other than the target tables (See
421  * ExecGetTriggerResultRel). In these situations, ri_RangeTableIndex is 0
422  * and ri_RelationDesc is a separately-opened relcache pointer that needs to
423  * be separately closed.
424  */
425 typedef struct ResultRelInfo
426 {
428 
429  /* result relation's range table index, or 0 if not in range table */
431 
432  /* relation descriptor for result relation */
434 
435  /* # of indices existing on result relation */
437 
438  /* array of relation descriptors for indices */
440 
441  /* array of key/attr info for indices */
443 
444  /*
445  * For UPDATE/DELETE result relations, the attribute number of the row
446  * identity junk attribute in the source plan's output tuples
447  */
449 
450  /* Projection to generate new tuple in an INSERT/UPDATE */
452  /* Slot to hold that tuple */
454  /* Slot to hold the old tuple being updated */
456  /* Have the projection and the slots above been initialized? */
458 
459  /* triggers to be fired, if any */
461 
462  /* cached lookup info for trigger functions */
464 
465  /* array of trigger WHEN expr states */
467 
468  /* optional runtime measurements for triggers */
470 
471  /* On-demand created slots for triggers / returning processing */
472  TupleTableSlot *ri_ReturningSlot; /* for trigger output tuples */
473  TupleTableSlot *ri_TrigOldSlot; /* for a trigger's old tuple */
474  TupleTableSlot *ri_TrigNewSlot; /* for a trigger's new tuple */
475 
476  /* FDW callback functions, if foreign table */
478 
479  /* available to save private state of FDW */
480  void *ri_FdwState;
481 
482  /* true when modifying foreign table directly */
484 
485  /* batch insert stuff */
486  int ri_NumSlots; /* number of slots in the array */
487  int ri_NumSlotsInitialized; /* number of initialized slots */
488  int ri_BatchSize; /* max slots inserted in a single batch */
489  TupleTableSlot **ri_Slots; /* input tuples for batch insert */
491 
492  /* list of WithCheckOption's to be checked */
494 
495  /* list of WithCheckOption expr states */
497 
498  /* array of constraint-checking expr states */
500 
501  /* array of stored generated columns expr states */
503 
504  /* number of stored generated columns we need to compute */
506 
507  /* list of RETURNING expressions */
509 
510  /* for computing a RETURNING list */
512 
513  /* list of arbiter indexes to use to check conflicts */
515 
516  /* ON CONFLICT evaluation state */
518 
519  /* for MERGE, lists of MergeActionState */
522 
523  /* partition check expression state (NULL if not set up yet) */
525 
526  /*
527  * Information needed by tuple routing target relations
528  *
529  * RootResultRelInfo gives the target relation mentioned in the query, if
530  * it's a partitioned table. It is not set if the target relation
531  * mentioned in the query is an inherited table, nor when tuple routing is
532  * not needed.
533  *
534  * RootToPartitionMap and PartitionTupleSlot, initialized by
535  * ExecInitRoutingInfo, are non-NULL if partition has a different tuple
536  * format than the root table.
537  */
541 
542  /*
543  * Map to convert child result relation tuples to the format of the table
544  * actually mentioned in the query (called "root"). Computed only if
545  * needed. A NULL map value indicates that no conversion is needed, so we
546  * must have a separate flag to show if the map has been computed.
547  */
550 
551  /* for use by copyfrom.c when performing multi-inserts */
553 
554  /*
555  * Used when a leaf partition is involved in a cross-partition update of
556  * one of its ancestors; see ExecCrossPartitionUpdateForeignKey().
557  */
560 
561 /* ----------------
562  * AsyncRequest
563  *
564  * State for an asynchronous tuple request.
565  * ----------------
566  */
567 typedef struct AsyncRequest
568 {
569  struct PlanState *requestor; /* Node that wants a tuple */
570  struct PlanState *requestee; /* Node from which a tuple is wanted */
571  int request_index; /* Scratch space for requestor */
572  bool callback_pending; /* Callback is needed */
573  bool request_complete; /* Request complete, result valid */
574  TupleTableSlot *result; /* Result (NULL or an empty slot if no more
575  * tuples) */
577 
578 /* ----------------
579  * EState information
580  *
581  * Working state for an Executor invocation
582  * ----------------
583  */
584 typedef struct EState
585 {
587 
588  /* Basic state for all query types: */
589  ScanDirection es_direction; /* current scan direction */
590  Snapshot es_snapshot; /* time qual to use */
591  Snapshot es_crosscheck_snapshot; /* crosscheck time qual for RI */
592  List *es_range_table; /* List of RangeTblEntry */
593  Index es_range_table_size; /* size of the range table arrays */
594  Relation *es_relations; /* Array of per-range-table-entry Relation
595  * pointers, or NULL if not yet opened */
596  struct ExecRowMark **es_rowmarks; /* Array of per-range-table-entry
597  * ExecRowMarks, or NULL if none */
598  PlannedStmt *es_plannedstmt; /* link to top of plan tree */
599  const char *es_sourceText; /* Source text from QueryDesc */
600 
601  JunkFilter *es_junkFilter; /* top-level junk filter, if any */
602 
603  /* If query can insert/delete tuples, the command ID to mark them with */
605 
606  /* Info about target table(s) for insert/update/delete queries: */
607  ResultRelInfo **es_result_relations; /* Array of per-range-table-entry
608  * ResultRelInfo pointers, or NULL
609  * if not a target table */
610  List *es_opened_result_relations; /* List of non-NULL entries in
611  * es_result_relations in no
612  * specific order */
613 
614  PartitionDirectory es_partition_directory; /* for PartitionDesc lookup */
615 
616  /*
617  * The following list contains ResultRelInfos created by the tuple routing
618  * code for partitions that aren't found in the es_result_relations array.
619  */
621 
622  /* Stuff used for firing triggers: */
623  List *es_trig_target_relations; /* trigger-only ResultRelInfos */
624 
625  /* Parameter info: */
626  ParamListInfo es_param_list_info; /* values of external params */
627  ParamExecData *es_param_exec_vals; /* values of internal params */
628 
629  QueryEnvironment *es_queryEnv; /* query environment */
630 
631  /* Other working state: */
632  MemoryContext es_query_cxt; /* per-query context in which EState lives */
633 
634  List *es_tupleTable; /* List of TupleTableSlots */
635 
636  uint64 es_processed; /* # of tuples processed */
637 
638  int es_top_eflags; /* eflags passed to ExecutorStart */
639  int es_instrument; /* OR of InstrumentOption flags */
640  bool es_finished; /* true when ExecutorFinish is done */
641 
642  List *es_exprcontexts; /* List of ExprContexts within EState */
643 
644  List *es_subplanstates; /* List of PlanState for SubPlans */
645 
646  List *es_auxmodifytables; /* List of secondary ModifyTableStates */
647 
648  /*
649  * this ExprContext is for per-output-tuple operations, such as constraint
650  * checks and index-value computations. It will be reset for each output
651  * tuple. Note that it will be created only if needed.
652  */
654 
655  /*
656  * If not NULL, this is an EPQState's EState. This is a field in EState
657  * both to allow EvalPlanQual aware executor nodes to detect that they
658  * need to perform EPQ related work, and to provide necessary information
659  * to do so.
660  */
662 
663  bool es_use_parallel_mode; /* can we use parallel workers? */
664 
665  /* The per-query shared memory area to use for parallel execution. */
667 
668  /*
669  * JIT information. es_jit_flags indicates whether JIT should be performed
670  * and with which options. es_jit is created on-demand when JITing is
671  * performed.
672  *
673  * es_jit_worker_instr is the combined, on demand allocated,
674  * instrumentation from all workers. The leader's instrumentation is kept
675  * separate, and is combined on demand by ExplainPrintJITSummary().
676  */
681 
682 
683 /*
684  * ExecRowMark -
685  * runtime representation of FOR [KEY] UPDATE/SHARE clauses
686  *
687  * When doing UPDATE, DELETE, or SELECT FOR [KEY] UPDATE/SHARE, we will have an
688  * ExecRowMark for each non-target relation in the query (except inheritance
689  * parent RTEs, which can be ignored at runtime). Virtual relations such as
690  * subqueries-in-FROM will have an ExecRowMark with relation == NULL. See
691  * PlanRowMark for details about most of the fields. In addition to fields
692  * directly derived from PlanRowMark, we store an activity flag (to denote
693  * inactive children of inheritance trees), curCtid, which is used by the
694  * WHERE CURRENT OF code, and ermExtra, which is available for use by the plan
695  * node that sources the relation (e.g., for a foreign table the FDW can use
696  * ermExtra to hold information).
697  *
698  * EState->es_rowmarks is an array of these structs, indexed by RT index,
699  * with NULLs for irrelevant RT indexes. es_rowmarks itself is NULL if
700  * there are no rowmarks.
701  */
702 typedef struct ExecRowMark
703 {
704  Relation relation; /* opened and suitably locked relation */
705  Oid relid; /* its OID (or InvalidOid, if subquery) */
706  Index rti; /* its range table index */
707  Index prti; /* parent range table index, if child */
708  Index rowmarkId; /* unique identifier for resjunk columns */
709  RowMarkType markType; /* see enum in nodes/plannodes.h */
710  LockClauseStrength strength; /* LockingClause's strength, or LCS_NONE */
711  LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
712  bool ermActive; /* is this mark relevant for current tuple? */
713  ItemPointerData curCtid; /* ctid of currently locked tuple, if any */
714  void *ermExtra; /* available for use by relation source node */
716 
717 /*
718  * ExecAuxRowMark -
719  * additional runtime representation of FOR [KEY] UPDATE/SHARE clauses
720  *
721  * Each LockRows and ModifyTable node keeps a list of the rowmarks it needs to
722  * deal with. In addition to a pointer to the related entry in es_rowmarks,
723  * this struct carries the column number(s) of the resjunk columns associated
724  * with the rowmark (see comments for PlanRowMark for more detail).
725  */
726 typedef struct ExecAuxRowMark
727 {
728  ExecRowMark *rowmark; /* related entry in es_rowmarks */
729  AttrNumber ctidAttNo; /* resno of ctid junk attribute, if any */
730  AttrNumber toidAttNo; /* resno of tableoid junk attribute, if any */
731  AttrNumber wholeAttNo; /* resno of whole-row junk attribute, if any */
733 
734 
735 /* ----------------------------------------------------------------
736  * Tuple Hash Tables
737  *
738  * All-in-memory tuple hash tables are used for a number of purposes.
739  *
740  * Note: tab_hash_funcs are for the key datatype(s) stored in the table,
741  * and tab_eq_funcs are non-cross-type equality operators for those types.
742  * Normally these are the only functions used, but FindTupleHashEntry()
743  * supports searching a hashtable using cross-data-type hashing. For that,
744  * the caller must supply hash functions for the LHS datatype as well as
745  * the cross-type equality operators to use. in_hash_funcs and cur_eq_func
746  * are set to point to the caller's function arrays while doing such a search.
747  * During LookupTupleHashEntry(), they point to tab_hash_funcs and
748  * tab_eq_func respectively.
749  * ----------------------------------------------------------------
750  */
753 
754 typedef struct TupleHashEntryData
755 {
756  MinimalTuple firstTuple; /* copy of first tuple in this group */
757  void *additional; /* user data */
758  uint32 status; /* hash status */
759  uint32 hash; /* hash value (cached) */
761 
762 /* define parameters necessary to generate the tuple hash table interface */
763 #define SH_PREFIX tuplehash
764 #define SH_ELEMENT_TYPE TupleHashEntryData
765 #define SH_KEY_TYPE MinimalTuple
766 #define SH_SCOPE extern
767 #define SH_DECLARE
768 #include "lib/simplehash.h"
769 
770 typedef struct TupleHashTableData
771 {
772  tuplehash_hash *hashtab; /* underlying hash table */
773  int numCols; /* number of columns in lookup key */
774  AttrNumber *keyColIdx; /* attr numbers of key columns */
775  FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */
776  ExprState *tab_eq_func; /* comparator for table datatype(s) */
777  Oid *tab_collations; /* collations for hash and comparison */
778  MemoryContext tablecxt; /* memory context containing table */
779  MemoryContext tempcxt; /* context for function evaluations */
780  Size entrysize; /* actual size to make each hash entry */
781  TupleTableSlot *tableslot; /* slot for referencing table entries */
782  /* The following fields are set transiently for each table search: */
783  TupleTableSlot *inputslot; /* current input tuple's slot */
784  FmgrInfo *in_hash_funcs; /* hash functions for input datatype(s) */
785  ExprState *cur_eq_func; /* comparator for input vs. table */
786  uint32 hash_iv; /* hash-function IV */
787  ExprContext *exprcontext; /* expression context */
789 
790 typedef tuplehash_iterator TupleHashIterator;
791 
792 /*
793  * Use InitTupleHashIterator/TermTupleHashIterator for a read/write scan.
794  * Use ResetTupleHashIterator if the table can be frozen (in this case no
795  * explicit scan termination is needed).
796  */
797 #define InitTupleHashIterator(htable, iter) \
798  tuplehash_start_iterate(htable->hashtab, iter)
799 #define TermTupleHashIterator(iter) \
800  ((void) 0)
801 #define ResetTupleHashIterator(htable, iter) \
802  InitTupleHashIterator(htable, iter)
803 #define ScanTupleHashTable(htable, iter) \
804  tuplehash_iterate(htable->hashtab, iter)
805 
806 
807 /* ----------------------------------------------------------------
808  * Expression State Nodes
809  *
810  * Formerly, there was a separate executor expression state node corresponding
811  * to each node in a planned expression tree. That's no longer the case; for
812  * common expression node types, all the execution info is embedded into
813  * step(s) in a single ExprState node. But we still have a few executor state
814  * node types for selected expression node types, mostly those in which info
815  * has to be shared with other parts of the execution state tree.
816  * ----------------------------------------------------------------
817  */
818 
819 /* ----------------
820  * WindowFuncExprState node
821  * ----------------
822  */
823 typedef struct WindowFuncExprState
824 {
826  WindowFunc *wfunc; /* expression plan node */
827  List *args; /* ExprStates for argument expressions */
828  ExprState *aggfilter; /* FILTER expression */
829  int wfuncno; /* ID number for wfunc within its plan node */
831 
832 
833 /* ----------------
834  * SetExprState node
835  *
836  * State for evaluating a potentially set-returning expression (like FuncExpr
837  * or OpExpr). In some cases, like some of the expressions in ROWS FROM(...)
838  * the expression might not be a SRF, but nonetheless it uses the same
839  * machinery as SRFs; it will be treated as a SRF returning a single row.
840  * ----------------
841  */
842 typedef struct SetExprState
843 {
845  Expr *expr; /* expression plan node */
846  List *args; /* ExprStates for argument expressions */
847 
848  /*
849  * In ROWS FROM, functions can be inlined, removing the FuncExpr normally
850  * inside. In such a case this is the compiled expression (which cannot
851  * return a set), which'll be evaluated using regular ExecEvalExpr().
852  */
854 
855  /*
856  * Function manager's lookup info for the target function. If func.fn_oid
857  * is InvalidOid, we haven't initialized it yet (nor any of the following
858  * fields, except funcReturnsSet).
859  */
861 
862  /*
863  * For a set-returning function (SRF) that returns a tuplestore, we keep
864  * the tuplestore here and dole out the result rows one at a time. The
865  * slot holds the row currently being returned.
866  */
869 
870  /*
871  * In some cases we need to compute a tuple descriptor for the function's
872  * output. If so, it's stored here.
873  */
875  bool funcReturnsTuple; /* valid when funcResultDesc isn't NULL */
876 
877  /*
878  * Remember whether the function is declared to return a set. This is set
879  * by ExecInitExpr, and is valid even before the FmgrInfo is set up.
880  */
882 
883  /*
884  * setArgsValid is true when we are evaluating a set-returning function
885  * that uses value-per-call mode and we are in the middle of a call
886  * series; we want to pass the same argument values to the function again
887  * (and again, until it returns ExprEndResult). This indicates that
888  * fcinfo_data already contains valid argument data.
889  */
891 
892  /*
893  * Flag to remember whether we have registered a shutdown callback for
894  * this SetExprState. We do so only if funcResultStore or setArgsValid
895  * has been set at least once (since all the callback is for is to release
896  * the tuplestore or clear setArgsValid).
897  */
898  bool shutdown_reg; /* a shutdown callback is registered */
899 
900  /*
901  * Call parameter structure for the function. This has been initialized
902  * (by InitFunctionCallInfoData) if func.fn_oid is valid. It also saves
903  * argument values between calls, when setArgsValid is true.
904  */
907 
908 /* ----------------
909  * SubPlanState node
910  * ----------------
911  */
912 typedef struct SubPlanState
913 {
915  SubPlan *subplan; /* expression plan node */
916  struct PlanState *planstate; /* subselect plan's state tree */
917  struct PlanState *parent; /* parent plan node's state tree */
918  ExprState *testexpr; /* state of combining expression */
919  List *args; /* states of argument expression(s) */
920  HeapTuple curTuple; /* copy of most recent tuple from subplan */
921  Datum curArray; /* most recent array from ARRAY() subplan */
922  /* these are used when hashing the subselect's output: */
923  TupleDesc descRight; /* subselect desc after projection */
924  ProjectionInfo *projLeft; /* for projecting lefthand exprs */
925  ProjectionInfo *projRight; /* for projecting subselect output */
926  TupleHashTable hashtable; /* hash table for no-nulls subselect rows */
927  TupleHashTable hashnulls; /* hash table for rows with null(s) */
928  bool havehashrows; /* true if hashtable is not empty */
929  bool havenullrows; /* true if hashnulls is not empty */
930  MemoryContext hashtablecxt; /* memory context containing hash tables */
931  MemoryContext hashtempcxt; /* temp memory context for hash tables */
932  ExprContext *innerecontext; /* econtext for computing inner tuples */
933  int numCols; /* number of columns being hashed */
934  /* each of the remaining fields is an array of length numCols: */
935  AttrNumber *keyColIdx; /* control data for hash tables */
936  Oid *tab_eq_funcoids; /* equality func oids for table
937  * datatype(s) */
938  Oid *tab_collations; /* collations for hash and comparison */
939  FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */
940  FmgrInfo *tab_eq_funcs; /* equality functions for table datatype(s) */
941  FmgrInfo *lhs_hash_funcs; /* hash functions for lefthand datatype(s) */
942  FmgrInfo *cur_eq_funcs; /* equality functions for LHS vs. table */
943  ExprState *cur_eq_comp; /* equality comparator for LHS vs. table */
945 
946 /*
947  * DomainConstraintState - one item to check during CoerceToDomain
948  *
949  * Note: we consider this to be part of an ExprState tree, so we give it
950  * a name following the xxxState convention. But there's no directly
951  * associated plan-tree node.
952  */
954 {
958 
959 typedef struct DomainConstraintState
960 {
962  DomainConstraintType constrainttype; /* constraint type */
963  char *name; /* name of constraint (for error msgs) */
964  Expr *check_expr; /* for CHECK, a boolean expression */
965  ExprState *check_exprstate; /* check_expr's eval state, or NULL */
967 
968 
969 /* ----------------------------------------------------------------
970  * Executor State Trees
971  *
972  * An executing query has a PlanState tree paralleling the Plan tree
973  * that describes the plan.
974  * ----------------------------------------------------------------
975  */
976 
977 /* ----------------
978  * ExecProcNodeMtd
979  *
980  * This is the method called by ExecProcNode to return the next tuple
981  * from an executor node. It returns NULL, or an empty TupleTableSlot,
982  * if no more tuples are available.
983  * ----------------
984  */
985 typedef TupleTableSlot *(*ExecProcNodeMtd) (struct PlanState *pstate);
986 
987 /* ----------------
988  * PlanState node
989  *
990  * We never actually instantiate any PlanState nodes; this is just the common
991  * abstract superclass for all PlanState-type nodes.
992  * ----------------
993  */
994 typedef struct PlanState
995 {
997 
998  Plan *plan; /* associated Plan node */
999 
1000  EState *state; /* at execution time, states of individual
1001  * nodes point to one EState for the whole
1002  * top-level plan */
1003 
1004  ExecProcNodeMtd ExecProcNode; /* function to return next tuple */
1005  ExecProcNodeMtd ExecProcNodeReal; /* actual function, if above is a
1006  * wrapper */
1007 
1008  Instrumentation *instrument; /* Optional runtime stats for this node */
1009  WorkerInstrumentation *worker_instrument; /* per-worker instrumentation */
1010 
1011  /* Per-worker JIT instrumentation */
1013 
1014  /*
1015  * Common structural data for all Plan types. These links to subsidiary
1016  * state trees parallel links in the associated plan tree (except for the
1017  * subPlan list, which does not exist in the plan tree).
1018  */
1019  ExprState *qual; /* boolean qual condition */
1020  struct PlanState *lefttree; /* input plan tree(s) */
1022 
1023  List *initPlan; /* Init SubPlanState nodes (un-correlated expr
1024  * subselects) */
1025  List *subPlan; /* SubPlanState nodes in my expressions */
1026 
1027  /*
1028  * State for management of parameter-change-driven rescanning
1029  */
1030  Bitmapset *chgParam; /* set of IDs of changed Params */
1031 
1032  /*
1033  * Other run-time state needed by most if not all node types.
1034  */
1035  TupleDesc ps_ResultTupleDesc; /* node's return type */
1036  TupleTableSlot *ps_ResultTupleSlot; /* slot for my result tuples */
1037  ExprContext *ps_ExprContext; /* node's expression-evaluation context */
1038  ProjectionInfo *ps_ProjInfo; /* info for doing tuple projection */
1039 
1040  bool async_capable; /* true if node is async-capable */
1041 
1042  /*
1043  * Scanslot's descriptor if known. This is a bit of a hack, but otherwise
1044  * it's hard for expression compilation to optimize based on the
1045  * descriptor, without encoding knowledge about all executor nodes.
1046  */
1048 
1049  /*
1050  * Define the slot types for inner, outer and scanslots for expression
1051  * contexts with this state as a parent. If *opsset is set, then
1052  * *opsfixed indicates whether *ops is guaranteed to be the type of slot
1053  * used. That means that every slot in the corresponding
1054  * ExprContext.ecxt_*tuple will point to a slot of that type, while
1055  * evaluating the expression. If *opsfixed is false, but *ops is set,
1056  * that indicates the most likely type of slot.
1057  *
1058  * The scan* fields are set by ExecInitScanTupleSlot(). If that's not
1059  * called, nodes can initialize the fields themselves.
1060  *
1061  * If outer/inneropsset is false, the information is inferred on-demand
1062  * using ExecGetResultSlotOps() on ->righttree/lefttree, using the
1063  * corresponding node's resultops* fields.
1064  *
1065  * The result* fields are automatically set when ExecInitResultSlot is
1066  * used (be it directly or when the slot is created by
1067  * ExecAssignScanProjectionInfo() /
1068  * ExecConditionalAssignProjectionInfo()). If no projection is necessary
1069  * ExecConditionalAssignProjectionInfo() defaults those fields to the scan
1070  * operations.
1071  */
1085 
1086 /* ----------------
1087  * these are defined to avoid confusion problems with "left"
1088  * and "right" and "inner" and "outer". The convention is that
1089  * the "left" plan is the "outer" plan and the "right" plan is
1090  * the inner plan, but these make the code more readable.
1091  * ----------------
1092  */
1093 #define innerPlanState(node) (((PlanState *)(node))->righttree)
1094 #define outerPlanState(node) (((PlanState *)(node))->lefttree)
1095 
1096 /* Macros for inline access to certain instrumentation counters */
1097 #define InstrCountTuples2(node, delta) \
1098  do { \
1099  if (((PlanState *)(node))->instrument) \
1100  ((PlanState *)(node))->instrument->ntuples2 += (delta); \
1101  } while (0)
1102 #define InstrCountFiltered1(node, delta) \
1103  do { \
1104  if (((PlanState *)(node))->instrument) \
1105  ((PlanState *)(node))->instrument->nfiltered1 += (delta); \
1106  } while(0)
1107 #define InstrCountFiltered2(node, delta) \
1108  do { \
1109  if (((PlanState *)(node))->instrument) \
1110  ((PlanState *)(node))->instrument->nfiltered2 += (delta); \
1111  } while(0)
1112 
1113 /*
1114  * EPQState is state for executing an EvalPlanQual recheck on a candidate
1115  * tuples e.g. in ModifyTable or LockRows.
1116  *
1117  * To execute EPQ a separate EState is created (stored in ->recheckestate),
1118  * which shares some resources, like the rangetable, with the main query's
1119  * EState (stored in ->parentestate). The (sub-)tree of the plan that needs to
1120  * be rechecked (in ->plan), is separately initialized (into
1121  * ->recheckplanstate), but shares plan nodes with the corresponding nodes in
1122  * the main query. The scan nodes in that separate executor tree are changed
1123  * to return only the current tuple of interest for the respective
1124  * table. Those tuples are either provided by the caller (using
1125  * EvalPlanQualSlot), and/or found using the rowmark mechanism (non-locking
1126  * rowmarks by the EPQ machinery itself, locking ones by the caller).
1127  *
1128  * While the plan to be checked may be changed using EvalPlanQualSetPlan(),
1129  * all such plans need to share the same EState.
1130  */
1131 typedef struct EPQState
1132 {
1133  /* Initialized at EvalPlanQualInit() time: */
1134 
1135  EState *parentestate; /* main query's EState */
1136  int epqParam; /* ID of Param to force scan node re-eval */
1137 
1138  /*
1139  * Tuples to be substituted by scan nodes. They need to set up, before
1140  * calling EvalPlanQual()/EvalPlanQualNext(), into the slot returned by
1141  * EvalPlanQualSlot(scanrelid). The array is indexed by scanrelid - 1.
1142  */
1143  List *tuple_table; /* tuple table for relsubs_slot */
1145 
1146  /*
1147  * Initialized by EvalPlanQualInit(), may be changed later with
1148  * EvalPlanQualSetPlan():
1149  */
1150 
1151  Plan *plan; /* plan tree to be executed */
1152  List *arowMarks; /* ExecAuxRowMarks (non-locking only) */
1153 
1154 
1155  /*
1156  * The original output tuple to be rechecked. Set by
1157  * EvalPlanQualSetSlot(), before EvalPlanQualNext() or EvalPlanQual() may
1158  * be called.
1159  */
1161 
1162 
1163  /* Initialized or reset by EvalPlanQualBegin(): */
1164 
1165  EState *recheckestate; /* EState for EPQ execution, see above */
1166 
1167  /*
1168  * Rowmarks that can be fetched on-demand using
1169  * EvalPlanQualFetchRowMark(), indexed by scanrelid - 1. Only non-locking
1170  * rowmarks.
1171  */
1173 
1174  /*
1175  * True if a relation's EPQ tuple has been fetched for relation, indexed
1176  * by scanrelid - 1.
1177  */
1179 
1180  PlanState *recheckplanstate; /* EPQ specific exec nodes, for ->plan */
1182 
1183 
1184 /* ----------------
1185  * ResultState information
1186  * ----------------
1187  */
1188 typedef struct ResultState
1189 {
1190  PlanState ps; /* its first field is NodeTag */
1192  bool rs_done; /* are we done? */
1193  bool rs_checkqual; /* do we need to check the qual? */
1195 
1196 /* ----------------
1197  * ProjectSetState information
1198  *
1199  * Note: at least one of the "elems" will be a SetExprState; the rest are
1200  * regular ExprStates.
1201  * ----------------
1202  */
1203 typedef struct ProjectSetState
1204 {
1205  PlanState ps; /* its first field is NodeTag */
1206  Node **elems; /* array of expression states */
1207  ExprDoneCond *elemdone; /* array of per-SRF is-done states */
1208  int nelems; /* length of elemdone[] array */
1209  bool pending_srf_tuples; /* still evaluating srfs in tlist? */
1210  MemoryContext argcontext; /* context for SRF arguments */
1212 
1213 
1214 /* flags for mt_merge_subcommands */
1215 #define MERGE_INSERT 0x01
1216 #define MERGE_UPDATE 0x02
1217 #define MERGE_DELETE 0x04
1218 
1219 /* ----------------
1220  * ModifyTableState information
1221  * ----------------
1222  */
1223 typedef struct ModifyTableState
1224 {
1225  PlanState ps; /* its first field is NodeTag */
1226  CmdType operation; /* INSERT, UPDATE, DELETE, or MERGE */
1227  bool canSetTag; /* do we set the command tag/es_processed? */
1228  bool mt_done; /* are we done? */
1229  int mt_nrels; /* number of entries in resultRelInfo[] */
1230  ResultRelInfo *resultRelInfo; /* info about target relation(s) */
1231 
1232  /*
1233  * Target relation mentioned in the original statement, used to fire
1234  * statement-level triggers and as the root for tuple routing. (This
1235  * might point to one of the resultRelInfo[] entries, but it can also be a
1236  * distinct struct.)
1237  */
1239 
1240  EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */
1241  bool fireBSTriggers; /* do we need to fire stmt triggers? */
1242 
1243  /*
1244  * These fields are used for inherited UPDATE and DELETE, to track which
1245  * target relation a given tuple is from. If there are a lot of target
1246  * relations, we use a hash table to translate table OIDs to
1247  * resultRelInfo[] indexes; otherwise mt_resultOidHash is NULL.
1248  */
1249  int mt_resultOidAttno; /* resno of "tableoid" junk attr */
1250  Oid mt_lastResultOid; /* last-seen value of tableoid */
1251  int mt_lastResultIndex; /* corresponding index in resultRelInfo[] */
1252  HTAB *mt_resultOidHash; /* optional hash table to speed lookups */
1253 
1254  /*
1255  * Slot for storing tuples in the root partitioned table's rowtype during
1256  * an UPDATE of a partitioned table.
1257  */
1259 
1260  /* Tuple-routing support info */
1262 
1263  /* controls transition table population for specified operation */
1265 
1266  /* controls transition table population for INSERT...ON CONFLICT UPDATE */
1268 
1269  /* Flags showing which subcommands are present INS/UPD/DEL/DO NOTHING */
1271 
1272  /* tuple counters for MERGE */
1277 
1278 /* ----------------
1279  * AppendState information
1280  *
1281  * nplans how many plans are in the array
1282  * whichplan which synchronous plan is being executed (0 .. n-1)
1283  * or a special negative value. See nodeAppend.c.
1284  * prune_state details required to allow partitions to be
1285  * eliminated from the scan, or NULL if not possible.
1286  * valid_subplans for runtime pruning, valid synchronous appendplans
1287  * indexes to scan.
1288  * ----------------
1289  */
1290 
1291 struct AppendState;
1292 typedef struct AppendState AppendState;
1293 struct ParallelAppendState;
1295 struct PartitionPruneState;
1296 
1298 {
1299  PlanState ps; /* its first field is NodeTag */
1300  PlanState **appendplans; /* array of PlanStates for my inputs */
1303  bool as_begun; /* false means need to initialize */
1304  Bitmapset *as_asyncplans; /* asynchronous plans indexes */
1305  int as_nasyncplans; /* # of asynchronous plans */
1306  AsyncRequest **as_asyncrequests; /* array of AsyncRequests */
1307  TupleTableSlot **as_asyncresults; /* unreturned results of async plans */
1308  int as_nasyncresults; /* # of valid entries in as_asyncresults */
1309  bool as_syncdone; /* true if all synchronous plans done in
1310  * asynchronous mode, else false */
1311  int as_nasyncremain; /* # of remaining asynchronous plans */
1312  Bitmapset *as_needrequest; /* asynchronous plans needing a new request */
1313  struct WaitEventSet *as_eventset; /* WaitEventSet used to configure file
1314  * descriptor wait events */
1315  int as_first_partial_plan; /* Index of 'appendplans' containing
1316  * the first partial plan */
1317  ParallelAppendState *as_pstate; /* parallel coordination info */
1318  Size pstate_len; /* size of parallel coordination info */
1321  Bitmapset *as_valid_asyncplans; /* valid asynchronous plans indexes */
1323 };
1324 
1325 /* ----------------
1326  * MergeAppendState information
1327  *
1328  * nplans how many plans are in the array
1329  * nkeys number of sort key columns
1330  * sortkeys sort keys in SortSupport representation
1331  * slots current output tuple of each subplan
1332  * heap heap of active tuples
1333  * initialized true if we have fetched first tuple from each subplan
1334  * prune_state details required to allow partitions to be
1335  * eliminated from the scan, or NULL if not possible.
1336  * valid_subplans for runtime pruning, valid mergeplans indexes to
1337  * scan.
1338  * ----------------
1339  */
1340 typedef struct MergeAppendState
1341 {
1342  PlanState ps; /* its first field is NodeTag */
1343  PlanState **mergeplans; /* array of PlanStates for my inputs */
1346  SortSupport ms_sortkeys; /* array of length ms_nkeys */
1347  TupleTableSlot **ms_slots; /* array of length ms_nplans */
1348  struct binaryheap *ms_heap; /* binary heap of slot indices */
1349  bool ms_initialized; /* are subplans started? */
1353 
1354 /* ----------------
1355  * RecursiveUnionState information
1356  *
1357  * RecursiveUnionState is used for performing a recursive union.
1358  *
1359  * recursing T when we're done scanning the non-recursive term
1360  * intermediate_empty T if intermediate_table is currently empty
1361  * working_table working table (to be scanned by recursive term)
1362  * intermediate_table current recursive output (next generation of WT)
1363  * ----------------
1364  */
1365 typedef struct RecursiveUnionState
1366 {
1367  PlanState ps; /* its first field is NodeTag */
1372  /* Remaining fields are unused in UNION ALL case */
1373  Oid *eqfuncoids; /* per-grouping-field equality fns */
1374  FmgrInfo *hashfunctions; /* per-grouping-field hash fns */
1375  MemoryContext tempContext; /* short-term context for comparisons */
1376  TupleHashTable hashtable; /* hash table for tuples already seen */
1377  MemoryContext tableContext; /* memory context containing hash table */
1379 
1380 /* ----------------
1381  * BitmapAndState information
1382  * ----------------
1383  */
1384 typedef struct BitmapAndState
1385 {
1386  PlanState ps; /* its first field is NodeTag */
1387  PlanState **bitmapplans; /* array of PlanStates for my inputs */
1388  int nplans; /* number of input plans */
1390 
1391 /* ----------------
1392  * BitmapOrState information
1393  * ----------------
1394  */
1395 typedef struct BitmapOrState
1396 {
1397  PlanState ps; /* its first field is NodeTag */
1398  PlanState **bitmapplans; /* array of PlanStates for my inputs */
1399  int nplans; /* number of input plans */
1401 
1402 /* ----------------------------------------------------------------
1403  * Scan State Information
1404  * ----------------------------------------------------------------
1405  */
1406 
1407 /* ----------------
1408  * ScanState information
1409  *
1410  * ScanState extends PlanState for node types that represent
1411  * scans of an underlying relation. It can also be used for nodes
1412  * that scan the output of an underlying plan node --- in that case,
1413  * only ScanTupleSlot is actually useful, and it refers to the tuple
1414  * retrieved from the subplan.
1415  *
1416  * currentRelation relation being scanned (NULL if none)
1417  * currentScanDesc current scan descriptor for scan (NULL if none)
1418  * ScanTupleSlot pointer to slot in tuple table holding scan tuple
1419  * ----------------
1420  */
1421 typedef struct ScanState
1422 {
1423  PlanState ps; /* its first field is NodeTag */
1428 
1429 /* ----------------
1430  * SeqScanState information
1431  * ----------------
1432  */
1433 typedef struct SeqScanState
1434 {
1435  ScanState ss; /* its first field is NodeTag */
1436  Size pscan_len; /* size of parallel heap scan descriptor */
1438 
1439 /* ----------------
1440  * SampleScanState information
1441  * ----------------
1442  */
1443 typedef struct SampleScanState
1444 {
1446  List *args; /* expr states for TABLESAMPLE params */
1447  ExprState *repeatable; /* expr state for REPEATABLE expr */
1448  /* use struct pointer to avoid including tsmapi.h here */
1449  struct TsmRoutine *tsmroutine; /* descriptor for tablesample method */
1450  void *tsm_state; /* tablesample method can keep state here */
1451  bool use_bulkread; /* use bulkread buffer access strategy? */
1452  bool use_pagemode; /* use page-at-a-time visibility checking? */
1453  bool begun; /* false means need to call BeginSampleScan */
1454  uint32 seed; /* random seed */
1455  int64 donetuples; /* number of tuples already returned */
1456  bool haveblock; /* has a block for sampling been determined */
1457  bool done; /* exhausted all tuples? */
1459 
1460 /*
1461  * These structs store information about index quals that don't have simple
1462  * constant right-hand sides. See comments for ExecIndexBuildScanKeys()
1463  * for discussion.
1464  */
1465 typedef struct
1466 {
1467  struct ScanKeyData *scan_key; /* scankey to put value into */
1468  ExprState *key_expr; /* expr to evaluate to get value */
1469  bool key_toastable; /* is expr's result a toastable datatype? */
1471 
1472 typedef struct
1473 {
1474  struct ScanKeyData *scan_key; /* scankey to put value into */
1475  ExprState *array_expr; /* expr to evaluate to get array value */
1476  int next_elem; /* next array element to use */
1477  int num_elems; /* number of elems in current array value */
1478  Datum *elem_values; /* array of num_elems Datums */
1479  bool *elem_nulls; /* array of num_elems is-null flags */
1481 
1482 /* ----------------
1483  * IndexScanState information
1484  *
1485  * indexqualorig execution state for indexqualorig expressions
1486  * indexorderbyorig execution state for indexorderbyorig expressions
1487  * ScanKeys Skey structures for index quals
1488  * NumScanKeys number of ScanKeys
1489  * OrderByKeys Skey structures for index ordering operators
1490  * NumOrderByKeys number of OrderByKeys
1491  * RuntimeKeys info about Skeys that must be evaluated at runtime
1492  * NumRuntimeKeys number of RuntimeKeys
1493  * RuntimeKeysReady true if runtime Skeys have been computed
1494  * RuntimeContext expr context for evaling runtime Skeys
1495  * RelationDesc index relation descriptor
1496  * ScanDesc index scan descriptor
1497  *
1498  * ReorderQueue tuples that need reordering due to re-check
1499  * ReachedEnd have we fetched all tuples from index already?
1500  * OrderByValues values of ORDER BY exprs of last fetched tuple
1501  * OrderByNulls null flags for OrderByValues
1502  * SortSupport for reordering ORDER BY exprs
1503  * OrderByTypByVals is the datatype of order by expression pass-by-value?
1504  * OrderByTypLens typlens of the datatypes of order by expressions
1505  * PscanLen size of parallel index scan descriptor
1506  * ----------------
1507  */
1508 typedef struct IndexScanState
1509 {
1510  ScanState ss; /* its first field is NodeTag */
1523 
1524  /* These are needed for re-checking ORDER BY expr ordering */
1534 
1535 /* ----------------
1536  * IndexOnlyScanState information
1537  *
1538  * recheckqual execution state for recheckqual expressions
1539  * ScanKeys Skey structures for index quals
1540  * NumScanKeys number of ScanKeys
1541  * OrderByKeys Skey structures for index ordering operators
1542  * NumOrderByKeys number of OrderByKeys
1543  * RuntimeKeys info about Skeys that must be evaluated at runtime
1544  * NumRuntimeKeys number of RuntimeKeys
1545  * RuntimeKeysReady true if runtime Skeys have been computed
1546  * RuntimeContext expr context for evaling runtime Skeys
1547  * RelationDesc index relation descriptor
1548  * ScanDesc index scan descriptor
1549  * TableSlot slot for holding tuples fetched from the table
1550  * VMBuffer buffer in use for visibility map testing, if any
1551  * PscanLen size of parallel index-only scan descriptor
1552  * ----------------
1553  */
1554 typedef struct IndexOnlyScanState
1555 {
1556  ScanState ss; /* its first field is NodeTag */
1572 
1573 /* ----------------
1574  * BitmapIndexScanState information
1575  *
1576  * result bitmap to return output into, or NULL
1577  * ScanKeys Skey structures for index quals
1578  * NumScanKeys number of ScanKeys
1579  * RuntimeKeys info about Skeys that must be evaluated at runtime
1580  * NumRuntimeKeys number of RuntimeKeys
1581  * ArrayKeys info about Skeys that come from ScalarArrayOpExprs
1582  * NumArrayKeys number of ArrayKeys
1583  * RuntimeKeysReady true if runtime Skeys have been computed
1584  * RuntimeContext expr context for evaling runtime Skeys
1585  * RelationDesc index relation descriptor
1586  * ScanDesc index scan descriptor
1587  * ----------------
1588  */
1589 typedef struct BitmapIndexScanState
1590 {
1591  ScanState ss; /* its first field is NodeTag */
1604 
1605 /* ----------------
1606  * SharedBitmapState information
1607  *
1608  * BM_INITIAL TIDBitmap creation is not yet started, so first worker
1609  * to see this state will set the state to BM_INPROGRESS
1610  * and that process will be responsible for creating
1611  * TIDBitmap.
1612  * BM_INPROGRESS TIDBitmap creation is in progress; workers need to
1613  * sleep until it's finished.
1614  * BM_FINISHED TIDBitmap creation is done, so now all workers can
1615  * proceed to iterate over TIDBitmap.
1616  * ----------------
1617  */
1618 typedef enum
1619 {
1622  BM_FINISHED
1624 
1625 /* ----------------
1626  * ParallelBitmapHeapState information
1627  * tbmiterator iterator for scanning current pages
1628  * prefetch_iterator iterator for prefetching ahead of current page
1629  * mutex mutual exclusion for the prefetching variable
1630  * and state
1631  * prefetch_pages # pages prefetch iterator is ahead of current
1632  * prefetch_target current target prefetch distance
1633  * state current state of the TIDBitmap
1634  * cv conditional wait variable
1635  * phs_snapshot_data snapshot data shared to workers
1636  * ----------------
1637  */
1639 {
1649 
1650 /* ----------------
1651  * BitmapHeapScanState information
1652  *
1653  * bitmapqualorig execution state for bitmapqualorig expressions
1654  * tbm bitmap obtained from child index scan(s)
1655  * tbmiterator iterator for scanning current pages
1656  * tbmres current-page data
1657  * can_skip_fetch can we potentially skip tuple fetches in this scan?
1658  * return_empty_tuples number of empty tuples to return
1659  * vmbuffer buffer for visibility-map lookups
1660  * pvmbuffer ditto, for prefetched pages
1661  * exact_pages total number of exact pages retrieved
1662  * lossy_pages total number of lossy pages retrieved
1663  * prefetch_iterator iterator for prefetching ahead of current page
1664  * prefetch_pages # pages prefetch iterator is ahead of current
1665  * prefetch_target current target prefetch distance
1666  * prefetch_maximum maximum value for prefetch_target
1667  * pscan_len size of the shared memory for parallel bitmap
1668  * initialized is node is ready to iterate
1669  * shared_tbmiterator shared iterator
1670  * shared_prefetch_iterator shared iterator for prefetching
1671  * pstate shared state for parallel bitmap scan
1672  * ----------------
1673  */
1674 typedef struct BitmapHeapScanState
1675 {
1676  ScanState ss; /* its first field is NodeTag */
1697 
1698 /* ----------------
1699  * TidScanState information
1700  *
1701  * tidexprs list of TidExpr structs (see nodeTidscan.c)
1702  * isCurrentOf scan has a CurrentOfExpr qual
1703  * NumTids number of tids in this scan
1704  * TidPtr index of currently fetched tid
1705  * TidList evaluated item pointers (array of size NumTids)
1706  * htup currently-fetched tuple, if any
1707  * ----------------
1708  */
1709 typedef struct TidScanState
1710 {
1711  ScanState ss; /* its first field is NodeTag */
1719 
1720 /* ----------------
1721  * TidRangeScanState information
1722  *
1723  * trss_tidexprs list of TidOpExpr structs (see nodeTidrangescan.c)
1724  * trss_mintid the lowest TID in the scan range
1725  * trss_maxtid the highest TID in the scan range
1726  * trss_inScan is a scan currently in progress?
1727  * ----------------
1728  */
1729 typedef struct TidRangeScanState
1730 {
1731  ScanState ss; /* its first field is NodeTag */
1737 
1738 /* ----------------
1739  * SubqueryScanState information
1740  *
1741  * SubqueryScanState is used for scanning a sub-query in the range table.
1742  * ScanTupleSlot references the current output tuple of the sub-query.
1743  * ----------------
1744  */
1745 typedef struct SubqueryScanState
1746 {
1747  ScanState ss; /* its first field is NodeTag */
1750 
1751 /* ----------------
1752  * FunctionScanState information
1753  *
1754  * Function nodes are used to scan the results of a
1755  * function appearing in FROM (typically a function returning set).
1756  *
1757  * eflags node's capability flags
1758  * ordinality is this scan WITH ORDINALITY?
1759  * simple true if we have 1 function and no ordinality
1760  * ordinal current ordinal column value
1761  * nfuncs number of functions being executed
1762  * funcstates per-function execution states (private in
1763  * nodeFunctionscan.c)
1764  * argcontext memory context to evaluate function arguments in
1765  * ----------------
1766  */
1768 
1769 typedef struct FunctionScanState
1770 {
1771  ScanState ss; /* its first field is NodeTag */
1772  int eflags;
1774  bool simple;
1775  int64 ordinal;
1776  int nfuncs;
1777  struct FunctionScanPerFuncState *funcstates; /* array of length nfuncs */
1780 
1781 /* ----------------
1782  * ValuesScanState information
1783  *
1784  * ValuesScan nodes are used to scan the results of a VALUES list
1785  *
1786  * rowcontext per-expression-list context
1787  * exprlists array of expression lists being evaluated
1788  * exprstatelists array of expression state lists, for SubPlans only
1789  * array_len size of above arrays
1790  * curr_idx current array index (0-based)
1791  *
1792  * Note: ss.ps.ps_ExprContext is used to evaluate any qual or projection
1793  * expressions attached to the node. We create a second ExprContext,
1794  * rowcontext, in which to build the executor expression state for each
1795  * Values sublist. Resetting this context lets us get rid of expression
1796  * state for each row, avoiding major memory leakage over a long values list.
1797  * However, that doesn't work for sublists containing SubPlans, because a
1798  * SubPlan has to be connected up to the outer plan tree to work properly.
1799  * Therefore, for only those sublists containing SubPlans, we do expression
1800  * state construction at executor start, and store those pointers in
1801  * exprstatelists[]. NULL entries in that array correspond to simple
1802  * subexpressions that are handled as described above.
1803  * ----------------
1804  */
1805 typedef struct ValuesScanState
1806 {
1807  ScanState ss; /* its first field is NodeTag */
1814 
1815 /* ----------------
1816  * TableFuncScanState node
1817  *
1818  * Used in table-expression functions like XMLTABLE.
1819  * ----------------
1820  */
1821 typedef struct TableFuncScanState
1822 {
1823  ScanState ss; /* its first field is NodeTag */
1824  ExprState *docexpr; /* state for document expression */
1825  ExprState *rowexpr; /* state for row-generating expression */
1826  List *colexprs; /* state for column-generating expression */
1827  List *coldefexprs; /* state for column default expressions */
1828  List *ns_names; /* same as TableFunc.ns_names */
1829  List *ns_uris; /* list of states of namespace URI exprs */
1830  Bitmapset *notnulls; /* nullability flag for each output column */
1831  void *opaque; /* table builder private space */
1832  const struct TableFuncRoutine *routine; /* table builder methods */
1833  FmgrInfo *in_functions; /* input function for each column */
1834  Oid *typioparams; /* typioparam for each column */
1835  int64 ordinal; /* row number to be output next */
1836  MemoryContext perTableCxt; /* per-table context */
1837  Tuplestorestate *tupstore; /* output tuple store */
1839 
1840 /* ----------------
1841  * CteScanState information
1842  *
1843  * CteScan nodes are used to scan a CommonTableExpr query.
1844  *
1845  * Multiple CteScan nodes can read out from the same CTE query. We use
1846  * a tuplestore to hold rows that have been read from the CTE query but
1847  * not yet consumed by all readers.
1848  * ----------------
1849  */
1850 typedef struct CteScanState
1851 {
1852  ScanState ss; /* its first field is NodeTag */
1853  int eflags; /* capability flags to pass to tuplestore */
1854  int readptr; /* index of my tuplestore read pointer */
1855  PlanState *cteplanstate; /* PlanState for the CTE query itself */
1856  /* Link to the "leader" CteScanState (possibly this same node) */
1858  /* The remaining fields are only valid in the "leader" CteScanState */
1859  Tuplestorestate *cte_table; /* rows already read from the CTE query */
1860  bool eof_cte; /* reached end of CTE query? */
1862 
1863 /* ----------------
1864  * NamedTuplestoreScanState information
1865  *
1866  * NamedTuplestoreScan nodes are used to scan a Tuplestore created and
1867  * named prior to execution of the query. An example is a transition
1868  * table for an AFTER trigger.
1869  *
1870  * Multiple NamedTuplestoreScan nodes can read out from the same Tuplestore.
1871  * ----------------
1872  */
1874 {
1875  ScanState ss; /* its first field is NodeTag */
1876  int readptr; /* index of my tuplestore read pointer */
1877  TupleDesc tupdesc; /* format of the tuples in the tuplestore */
1878  Tuplestorestate *relation; /* the rows */
1880 
1881 /* ----------------
1882  * WorkTableScanState information
1883  *
1884  * WorkTableScan nodes are used to scan the work table created by
1885  * a RecursiveUnion node. We locate the RecursiveUnion node
1886  * during executor startup.
1887  * ----------------
1888  */
1889 typedef struct WorkTableScanState
1890 {
1891  ScanState ss; /* its first field is NodeTag */
1894 
1895 /* ----------------
1896  * ForeignScanState information
1897  *
1898  * ForeignScan nodes are used to scan foreign-data tables.
1899  * ----------------
1900  */
1901 typedef struct ForeignScanState
1902 {
1903  ScanState ss; /* its first field is NodeTag */
1904  ExprState *fdw_recheck_quals; /* original quals not in ss.ps.qual */
1905  Size pscan_len; /* size of parallel coordination information */
1906  ResultRelInfo *resultRelInfo; /* result rel info, if UPDATE or DELETE */
1907  /* use struct pointer to avoid including fdwapi.h here */
1909  void *fdw_state; /* foreign-data wrapper can keep state here */
1911 
1912 /* ----------------
1913  * CustomScanState information
1914  *
1915  * CustomScan nodes are used to execute custom code within executor.
1916  *
1917  * Core code must avoid assuming that the CustomScanState is only as large as
1918  * the structure declared here; providers are allowed to make it the first
1919  * element in a larger structure, and typically would need to do so. The
1920  * struct is actually allocated by the CreateCustomScanState method associated
1921  * with the plan node. Any additional fields can be initialized there, or in
1922  * the BeginCustomScan method.
1923  * ----------------
1924  */
1925 struct CustomExecMethods;
1926 
1927 typedef struct CustomScanState
1928 {
1930  uint32 flags; /* mask of CUSTOMPATH_* flags, see
1931  * nodes/extensible.h */
1932  List *custom_ps; /* list of child PlanState nodes, if any */
1933  Size pscan_len; /* size of parallel coordination information */
1936 
1937 /* ----------------------------------------------------------------
1938  * Join State Information
1939  * ----------------------------------------------------------------
1940  */
1941 
1942 /* ----------------
1943  * JoinState information
1944  *
1945  * Superclass for state nodes of join plans.
1946  * ----------------
1947  */
1948 typedef struct JoinState
1949 {
1952  bool single_match; /* True if we should skip to next outer tuple
1953  * after finding one inner match */
1954  ExprState *joinqual; /* JOIN quals (in addition to ps.qual) */
1956 
1957 /* ----------------
1958  * NestLoopState information
1959  *
1960  * NeedNewOuter true if need new outer tuple on next call
1961  * MatchedOuter true if found a join match for current outer tuple
1962  * NullInnerTupleSlot prepared null tuple for left outer joins
1963  * ----------------
1964  */
1965 typedef struct NestLoopState
1966 {
1967  JoinState js; /* its first field is NodeTag */
1972 
1973 /* ----------------
1974  * MergeJoinState information
1975  *
1976  * NumClauses number of mergejoinable join clauses
1977  * Clauses info for each mergejoinable clause
1978  * JoinState current state of ExecMergeJoin state machine
1979  * SkipMarkRestore true if we may skip Mark and Restore operations
1980  * ExtraMarks true to issue extra Mark operations on inner scan
1981  * ConstFalseJoin true if we have a constant-false joinqual
1982  * FillOuter true if should emit unjoined outer tuples anyway
1983  * FillInner true if should emit unjoined inner tuples anyway
1984  * MatchedOuter true if found a join match for current outer tuple
1985  * MatchedInner true if found a join match for current inner tuple
1986  * OuterTupleSlot slot in tuple table for cur outer tuple
1987  * InnerTupleSlot slot in tuple table for cur inner tuple
1988  * MarkedTupleSlot slot in tuple table for marked tuple
1989  * NullOuterTupleSlot prepared null tuple for right outer joins
1990  * NullInnerTupleSlot prepared null tuple for left outer joins
1991  * OuterEContext workspace for computing outer tuple's join values
1992  * InnerEContext workspace for computing inner tuple's join values
1993  * ----------------
1994  */
1995 /* private in nodeMergejoin.c: */
1997 
1998 typedef struct MergeJoinState
1999 {
2000  JoinState js; /* its first field is NodeTag */
2002  MergeJoinClause mj_Clauses; /* array of length mj_NumClauses */
2019 
2020 /* ----------------
2021  * HashJoinState information
2022  *
2023  * hashclauses original form of the hashjoin condition
2024  * hj_OuterHashKeys the outer hash keys in the hashjoin condition
2025  * hj_HashOperators the join operators in the hashjoin condition
2026  * hj_HashTable hash table for the hashjoin
2027  * (NULL if table not built yet)
2028  * hj_CurHashValue hash value for current outer tuple
2029  * hj_CurBucketNo regular bucket# for current outer tuple
2030  * hj_CurSkewBucketNo skew bucket# for current outer tuple
2031  * hj_CurTuple last inner tuple matched to current outer
2032  * tuple, or NULL if starting search
2033  * (hj_CurXXX variables are undefined if
2034  * OuterTupleSlot is empty!)
2035  * hj_OuterTupleSlot tuple slot for outer tuples
2036  * hj_HashTupleSlot tuple slot for inner (hashed) tuples
2037  * hj_NullOuterTupleSlot prepared null tuple for right/full outer joins
2038  * hj_NullInnerTupleSlot prepared null tuple for left/full outer joins
2039  * hj_FirstOuterTupleSlot first tuple retrieved from outer plan
2040  * hj_JoinState current state of ExecHashJoin state machine
2041  * hj_MatchedOuter true if found a join match for current outer
2042  * hj_OuterNotEmpty true if outer relation known not empty
2043  * ----------------
2044  */
2045 
2046 /* these structs are defined in executor/hashjoin.h: */
2049 
2050 typedef struct HashJoinState
2051 {
2052  JoinState js; /* its first field is NodeTag */
2054  List *hj_OuterHashKeys; /* list of ExprState nodes */
2055  List *hj_HashOperators; /* list of operator OIDs */
2071 
2072 
2073 /* ----------------------------------------------------------------
2074  * Materialization State Information
2075  * ----------------------------------------------------------------
2076  */
2077 
2078 /* ----------------
2079  * MaterialState information
2080  *
2081  * materialize nodes are used to materialize the results
2082  * of a subplan into a temporary file.
2083  *
2084  * ss.ss_ScanTupleSlot refers to output of underlying plan.
2085  * ----------------
2086  */
2087 typedef struct MaterialState
2088 {
2089  ScanState ss; /* its first field is NodeTag */
2090  int eflags; /* capability flags to pass to tuplestore */
2091  bool eof_underlying; /* reached end of underlying plan? */
2094 
2095 struct MemoizeEntry;
2096 struct MemoizeTuple;
2097 struct MemoizeKey;
2098 
2100 {
2101  uint64 cache_hits; /* number of rescans where we've found the
2102  * scan parameter values to be cached */
2103  uint64 cache_misses; /* number of rescans where we've not found the
2104  * scan parameter values to be cached. */
2105  uint64 cache_evictions; /* number of cache entries removed due to
2106  * the need to free memory */
2107  uint64 cache_overflows; /* number of times we've had to bypass the
2108  * cache when filling it due to not being
2109  * able to free enough space to store the
2110  * current scan's tuples. */
2111  uint64 mem_peak; /* peak memory usage in bytes */
2113 
2114 /* ----------------
2115  * Shared memory container for per-worker memoize information
2116  * ----------------
2117  */
2118 typedef struct SharedMemoizeInfo
2119 {
2123 
2124 /* ----------------
2125  * MemoizeState information
2126  *
2127  * memoize nodes are used to cache recent and commonly seen results from
2128  * a parameterized scan.
2129  * ----------------
2130  */
2131 typedef struct MemoizeState
2132 {
2133  ScanState ss; /* its first field is NodeTag */
2134  int mstatus; /* value of ExecMemoize state machine */
2135  int nkeys; /* number of cache keys */
2136  struct memoize_hash *hashtable; /* hash table for cache entries */
2137  TupleDesc hashkeydesc; /* tuple descriptor for cache keys */
2138  TupleTableSlot *tableslot; /* min tuple slot for existing cache entries */
2139  TupleTableSlot *probeslot; /* virtual slot used for hash lookups */
2140  ExprState *cache_eq_expr; /* Compare exec params to hash key */
2141  ExprState **param_exprs; /* exprs containing the parameters to this
2142  * node */
2143  FmgrInfo *hashfunctions; /* lookup data for hash funcs nkeys in size */
2144  Oid *collations; /* collation for comparisons nkeys in size */
2145  uint64 mem_used; /* bytes of memory used by cache */
2146  uint64 mem_limit; /* memory limit in bytes for the cache */
2147  MemoryContext tableContext; /* memory context to store cache data */
2148  dlist_head lru_list; /* least recently used entry list */
2149  struct MemoizeTuple *last_tuple; /* Used to point to the last tuple
2150  * returned during a cache hit and the
2151  * tuple we last stored when
2152  * populating the cache. */
2153  struct MemoizeEntry *entry; /* the entry that 'last_tuple' belongs to or
2154  * NULL if 'last_tuple' is NULL. */
2155  bool singlerow; /* true if the cache entry is to be marked as
2156  * complete after caching the first tuple. */
2157  bool binary_mode; /* true when cache key should be compared bit
2158  * by bit, false when using hash equality ops */
2159  MemoizeInstrumentation stats; /* execution statistics */
2160  SharedMemoizeInfo *shared_info; /* statistics for parallel workers */
2161  Bitmapset *keyparamids; /* Param->paramids of expressions belonging to
2162  * param_exprs */
2164 
2165 /* ----------------
2166  * When performing sorting by multiple keys, it's possible that the input
2167  * dataset is already sorted on a prefix of those keys. We call these
2168  * "presorted keys".
2169  * PresortedKeyData represents information about one such key.
2170  * ----------------
2171  */
2172 typedef struct PresortedKeyData
2173 {
2174  FmgrInfo flinfo; /* comparison function info */
2175  FunctionCallInfo fcinfo; /* comparison function call info */
2176  OffsetNumber attno; /* attribute number in tuple */
2178 
2179 /* ----------------
2180  * Shared memory container for per-worker sort information
2181  * ----------------
2182  */
2183 typedef struct SharedSortInfo
2184 {
2188 
2189 /* ----------------
2190  * SortState information
2191  * ----------------
2192  */
2193 typedef struct SortState
2194 {
2195  ScanState ss; /* its first field is NodeTag */
2196  bool randomAccess; /* need random access to sort output? */
2197  bool bounded; /* is the result set bounded? */
2198  int64 bound; /* if bounded, how many tuples are needed */
2199  bool sort_Done; /* sort completed yet? */
2200  bool bounded_Done; /* value of bounded we did the sort with */
2201  int64 bound_Done; /* value of bound we did the sort with */
2202  void *tuplesortstate; /* private state of tuplesort.c */
2203  bool am_worker; /* are we a worker? */
2204  bool datumSort; /* Datum sort instead of tuple sort? */
2205  SharedSortInfo *shared_info; /* one entry per worker */
2207 
2208 /* ----------------
2209  * Instrumentation information for IncrementalSort
2210  * ----------------
2211  */
2213 {
2214  int64 groupCount;
2219  bits32 sortMethods; /* bitmask of TuplesortMethod */
2221 
2222 typedef struct IncrementalSortInfo
2223 {
2227 
2228 /* ----------------
2229  * Shared memory container for per-worker incremental sort information
2230  * ----------------
2231  */
2233 {
2237 
2238 /* ----------------
2239  * IncrementalSortState information
2240  * ----------------
2241  */
2242 typedef enum
2243 {
2249 
2250 typedef struct IncrementalSortState
2251 {
2252  ScanState ss; /* its first field is NodeTag */
2253  bool bounded; /* is the result set bounded? */
2254  int64 bound; /* if bounded, how many tuples are needed */
2255  bool outerNodeDone; /* finished fetching tuples from outer node */
2256  int64 bound_Done; /* value of bound we did the sort with */
2259  Tuplesortstate *fullsort_state; /* private state of tuplesort.c */
2260  Tuplesortstate *prefixsort_state; /* private state of tuplesort.c */
2261  /* the keys by which the input path is already sorted */
2263 
2265 
2266  /* slot for pivot tuple defining values of presorted keys within group */
2269  bool am_worker; /* are we a worker? */
2270  SharedIncrementalSortInfo *shared_info; /* one entry per worker */
2272 
2273 /* ---------------------
2274  * GroupState information
2275  * ---------------------
2276  */
2277 typedef struct GroupState
2278 {
2279  ScanState ss; /* its first field is NodeTag */
2280  ExprState *eqfunction; /* equality function */
2281  bool grp_done; /* indicates completion of Group scan */
2283 
2284 /* ---------------------
2285  * per-worker aggregate information
2286  * ---------------------
2287  */
2289 {
2290  Size hash_mem_peak; /* peak hash table memory usage */
2291  uint64 hash_disk_used; /* kB of disk space used */
2292  int hash_batches_used; /* batches used during entire execution */
2294 
2295 /* ----------------
2296  * Shared memory container for per-worker aggregate information
2297  * ----------------
2298  */
2299 typedef struct SharedAggInfo
2300 {
2304 
2305 /* ---------------------
2306  * AggState information
2307  *
2308  * ss.ss_ScanTupleSlot refers to output of underlying plan.
2309  *
2310  * Note: ss.ps.ps_ExprContext contains ecxt_aggvalues and
2311  * ecxt_aggnulls arrays, which hold the computed agg values for the current
2312  * input group during evaluation of an Agg node's output tuple(s). We
2313  * create a second ExprContext, tmpcontext, in which to evaluate input
2314  * expressions and run the aggregate transition functions.
2315  * ---------------------
2316  */
2317 /* these structs are private in nodeAgg.c: */
2323 
2324 typedef struct AggState
2325 {
2326  ScanState ss; /* its first field is NodeTag */
2327  List *aggs; /* all Aggref nodes in targetlist & quals */
2328  int numaggs; /* length of list (could be zero!) */
2329  int numtrans; /* number of pertrans items */
2330  AggStrategy aggstrategy; /* strategy mode */
2331  AggSplit aggsplit; /* agg-splitting mode, see nodes.h */
2332  AggStatePerPhase phase; /* pointer to current phase data */
2333  int numphases; /* number of phases (including phase 0) */
2334  int current_phase; /* current phase number */
2335  AggStatePerAgg peragg; /* per-Aggref information */
2336  AggStatePerTrans pertrans; /* per-Trans state information */
2337  ExprContext *hashcontext; /* econtexts for long-lived data (hashtable) */
2338  ExprContext **aggcontexts; /* econtexts for long-lived data (per GS) */
2339  ExprContext *tmpcontext; /* econtext for input expressions */
2340 #define FIELDNO_AGGSTATE_CURAGGCONTEXT 14
2341  ExprContext *curaggcontext; /* currently active aggcontext */
2342  AggStatePerAgg curperagg; /* currently active aggregate, if any */
2343 #define FIELDNO_AGGSTATE_CURPERTRANS 16
2344  AggStatePerTrans curpertrans; /* currently active trans state, if any */
2345  bool input_done; /* indicates end of input */
2346  bool agg_done; /* indicates completion of Agg scan */
2347  int projected_set; /* The last projected grouping set */
2348 #define FIELDNO_AGGSTATE_CURRENT_SET 20
2349  int current_set; /* The current grouping set being evaluated */
2350  Bitmapset *grouped_cols; /* grouped cols in current projection */
2351  List *all_grouped_cols; /* list of all grouped cols in DESC order */
2352  Bitmapset *colnos_needed; /* all columns needed from the outer plan */
2353  int max_colno_needed; /* highest colno needed from outer plan */
2354  bool all_cols_needed; /* are all cols from outer plan needed? */
2355  /* These fields are for grouping set phase data */
2356  int maxsets; /* The max number of sets in any phase */
2357  AggStatePerPhase phases; /* array of all phases */
2358  Tuplesortstate *sort_in; /* sorted input to phases > 1 */
2359  Tuplesortstate *sort_out; /* input is copied here for next phase */
2360  TupleTableSlot *sort_slot; /* slot for sort results */
2361  /* these fields are used in AGG_PLAIN and AGG_SORTED modes: */
2362  AggStatePerGroup *pergroups; /* grouping set indexed array of per-group
2363  * pointers */
2364  HeapTuple grp_firstTuple; /* copy of first tuple of current group */
2365  /* these fields are used in AGG_HASHED and AGG_MIXED modes: */
2366  bool table_filled; /* hash table filled yet? */
2368  MemoryContext hash_metacxt; /* memory for hash table itself */
2369  struct LogicalTapeSet *hash_tapeset; /* tape set for hash spill tapes */
2370  struct HashAggSpill *hash_spills; /* HashAggSpill for each grouping set,
2371  * exists only during first pass */
2372  TupleTableSlot *hash_spill_rslot; /* for reading spill files */
2373  TupleTableSlot *hash_spill_wslot; /* for writing spill files */
2374  List *hash_batches; /* hash batches remaining to be processed */
2375  bool hash_ever_spilled; /* ever spilled during this execution? */
2376  bool hash_spill_mode; /* we hit a limit during the current batch
2377  * and we must not create new groups */
2378  Size hash_mem_limit; /* limit before spilling hash table */
2379  uint64 hash_ngroups_limit; /* limit before spilling hash table */
2380  int hash_planned_partitions; /* number of partitions planned
2381  * for first pass */
2382  double hashentrysize; /* estimate revised during execution */
2383  Size hash_mem_peak; /* peak hash table memory usage */
2384  uint64 hash_ngroups_current; /* number of groups currently in
2385  * memory in all hash tables */
2386  uint64 hash_disk_used; /* kB of disk space used */
2387  int hash_batches_used; /* batches used during entire execution */
2388 
2389  AggStatePerHash perhash; /* array of per-hashtable data */
2390  AggStatePerGroup *hash_pergroup; /* grouping set indexed array of
2391  * per-group pointers */
2392 
2393  /* support for evaluation of agg input expressions: */
2394 #define FIELDNO_AGGSTATE_ALL_PERGROUPS 53
2395  AggStatePerGroup *all_pergroups; /* array of first ->pergroups, than
2396  * ->hash_pergroup */
2397  ProjectionInfo *combinedproj; /* projection machinery */
2398  SharedAggInfo *shared_info; /* one entry per worker */
2400 
2401 /* ----------------
2402  * WindowAggState information
2403  * ----------------
2404  */
2405 /* these structs are private in nodeWindowAgg.c: */
2408 
2409 /*
2410  * WindowAggStatus -- Used to track the status of WindowAggState
2411  */
2412 typedef enum WindowAggStatus
2413 {
2414  WINDOWAGG_DONE, /* No more processing to do */
2415  WINDOWAGG_RUN, /* Normal processing of window funcs */
2416  WINDOWAGG_PASSTHROUGH, /* Don't eval window funcs */
2417  WINDOWAGG_PASSTHROUGH_STRICT /* Pass-through plus don't store new
2418  * tuples during spool */
2420 
2421 typedef struct WindowAggState
2422 {
2423  ScanState ss; /* its first field is NodeTag */
2424 
2425  /* these fields are filled in by ExecInitExpr: */
2426  List *funcs; /* all WindowFunc nodes in targetlist */
2427  int numfuncs; /* total number of window functions */
2428  int numaggs; /* number that are plain aggregates */
2429 
2430  WindowStatePerFunc perfunc; /* per-window-function information */
2431  WindowStatePerAgg peragg; /* per-plain-aggregate information */
2432  ExprState *partEqfunction; /* equality funcs for partition columns */
2433  ExprState *ordEqfunction; /* equality funcs for ordering columns */
2434  Tuplestorestate *buffer; /* stores rows of current partition */
2435  int current_ptr; /* read pointer # for current row */
2436  int framehead_ptr; /* read pointer # for frame head, if used */
2437  int frametail_ptr; /* read pointer # for frame tail, if used */
2438  int grouptail_ptr; /* read pointer # for group tail, if used */
2439  int64 spooled_rows; /* total # of rows in buffer */
2440  int64 currentpos; /* position of current row in partition */
2441  int64 frameheadpos; /* current frame head position */
2442  int64 frametailpos; /* current frame tail position (frame end+1) */
2443  /* use struct pointer to avoid including windowapi.h here */
2444  struct WindowObjectData *agg_winobj; /* winobj for aggregate fetches */
2445  int64 aggregatedbase; /* start row for current aggregates */
2446  int64 aggregatedupto; /* rows before this one are aggregated */
2447  WindowAggStatus status; /* run status of WindowAggState */
2448 
2449  int frameOptions; /* frame_clause options, see WindowDef */
2450  ExprState *startOffset; /* expression for starting bound offset */
2451  ExprState *endOffset; /* expression for ending bound offset */
2452  Datum startOffsetValue; /* result of startOffset evaluation */
2453  Datum endOffsetValue; /* result of endOffset evaluation */
2454 
2455  /* these fields are used with RANGE offset PRECEDING/FOLLOWING: */
2456  FmgrInfo startInRangeFunc; /* in_range function for startOffset */
2457  FmgrInfo endInRangeFunc; /* in_range function for endOffset */
2458  Oid inRangeColl; /* collation for in_range tests */
2459  bool inRangeAsc; /* use ASC sort order for in_range tests? */
2460  bool inRangeNullsFirst; /* nulls sort first for in_range tests? */
2461 
2462  /* these fields are used in GROUPS mode: */
2463  int64 currentgroup; /* peer group # of current row in partition */
2464  int64 frameheadgroup; /* peer group # of frame head row */
2465  int64 frametailgroup; /* peer group # of frame tail row */
2466  int64 groupheadpos; /* current row's peer group head position */
2467  int64 grouptailpos; /* " " " " tail position (group end+1) */
2468 
2469  MemoryContext partcontext; /* context for partition-lifespan data */
2470  MemoryContext aggcontext; /* shared context for aggregate working data */
2471  MemoryContext curaggcontext; /* current aggregate's working data */
2472  ExprContext *tmpcontext; /* short-term evaluation context */
2473 
2474  ExprState *runcondition; /* Condition which must remain true otherwise
2475  * execution of the WindowAgg will finish or
2476  * go into pass-through mode. NULL when there
2477  * is no such condition. */
2478 
2479  bool use_pass_through; /* When false, stop execution when
2480  * runcondition is no longer true. Else
2481  * just stop evaluating window funcs. */
2482  bool top_window; /* true if this is the top-most WindowAgg or
2483  * the only WindowAgg in this query level */
2484  bool all_first; /* true if the scan is starting */
2485  bool partition_spooled; /* true if all tuples in current partition
2486  * have been spooled into tuplestore */
2487  bool more_partitions; /* true if there's more partitions after
2488  * this one */
2489  bool framehead_valid; /* true if frameheadpos is known up to
2490  * date for current row */
2491  bool frametail_valid; /* true if frametailpos is known up to
2492  * date for current row */
2493  bool grouptail_valid; /* true if grouptailpos is known up to
2494  * date for current row */
2495 
2496  TupleTableSlot *first_part_slot; /* first tuple of current or next
2497  * partition */
2498  TupleTableSlot *framehead_slot; /* first tuple of current frame */
2499  TupleTableSlot *frametail_slot; /* first tuple after current frame */
2500 
2501  /* temporary slots for tuples fetched back from tuplestore */
2506 
2507 /* ----------------
2508  * UniqueState information
2509  *
2510  * Unique nodes are used "on top of" sort nodes to discard
2511  * duplicate tuples returned from the sort phase. Basically
2512  * all it does is compare the current tuple from the subplan
2513  * with the previously fetched tuple (stored in its result slot).
2514  * If the two are identical in all interesting fields, then
2515  * we just fetch another tuple from the sort and try again.
2516  * ----------------
2517  */
2518 typedef struct UniqueState
2519 {
2520  PlanState ps; /* its first field is NodeTag */
2521  ExprState *eqfunction; /* tuple equality qual */
2523 
2524 /* ----------------
2525  * GatherState information
2526  *
2527  * Gather nodes launch 1 or more parallel workers, run a subplan
2528  * in those workers, and collect the results.
2529  * ----------------
2530  */
2531 typedef struct GatherState
2532 {
2533  PlanState ps; /* its first field is NodeTag */
2534  bool initialized; /* workers launched? */
2535  bool need_to_scan_locally; /* need to read from local plan? */
2536  int64 tuples_needed; /* tuple bound, see ExecSetTupleBound */
2537  /* these fields are set up once: */
2540  /* all remaining fields are reinitialized during a rescan: */
2541  int nworkers_launched; /* original number of workers */
2542  int nreaders; /* number of still-active workers */
2543  int nextreader; /* next one to try to read from */
2544  struct TupleQueueReader **reader; /* array with nreaders active entries */
2546 
2547 /* ----------------
2548  * GatherMergeState information
2549  *
2550  * Gather merge nodes launch 1 or more parallel workers, run a
2551  * subplan which produces sorted output in each worker, and then
2552  * merge the results into a single sorted stream.
2553  * ----------------
2554  */
2555 struct GMReaderTupleBuffer; /* private in nodeGatherMerge.c */
2556 
2557 typedef struct GatherMergeState
2558 {
2559  PlanState ps; /* its first field is NodeTag */
2560  bool initialized; /* workers launched? */
2561  bool gm_initialized; /* gather_merge_init() done? */
2562  bool need_to_scan_locally; /* need to read from local plan? */
2563  int64 tuples_needed; /* tuple bound, see ExecSetTupleBound */
2564  /* these fields are set up once: */
2565  TupleDesc tupDesc; /* descriptor for subplan result tuples */
2566  int gm_nkeys; /* number of sort columns */
2567  SortSupport gm_sortkeys; /* array of length gm_nkeys */
2569  /* all remaining fields are reinitialized during a rescan */
2570  /* (but the arrays are not reallocated, just cleared) */
2571  int nworkers_launched; /* original number of workers */
2572  int nreaders; /* number of active workers */
2573  TupleTableSlot **gm_slots; /* array with nreaders+1 entries */
2574  struct TupleQueueReader **reader; /* array with nreaders active entries */
2575  struct GMReaderTupleBuffer *gm_tuple_buffers; /* nreaders tuple buffers */
2576  struct binaryheap *gm_heap; /* binary heap of slot indices */
2578 
2579 /* ----------------
2580  * Values displayed by EXPLAIN ANALYZE
2581  * ----------------
2582  */
2583 typedef struct HashInstrumentation
2584 {
2585  int nbuckets; /* number of buckets at end of execution */
2586  int nbuckets_original; /* planned number of buckets */
2587  int nbatch; /* number of batches at end of execution */
2588  int nbatch_original; /* planned number of batches */
2589  Size space_peak; /* peak memory usage in bytes */
2591 
2592 /* ----------------
2593  * Shared memory container for per-worker hash information
2594  * ----------------
2595  */
2596 typedef struct SharedHashInfo
2597 {
2601 
2602 /* ----------------
2603  * HashState information
2604  * ----------------
2605  */
2606 typedef struct HashState
2607 {
2608  PlanState ps; /* its first field is NodeTag */
2609  HashJoinTable hashtable; /* hash table for the hashjoin */
2610  List *hashkeys; /* list of ExprState nodes */
2611 
2612  /*
2613  * In a parallelized hash join, the leader retains a pointer to the
2614  * shared-memory stats area in its shared_info field, and then copies the
2615  * shared-memory info back to local storage before DSM shutdown. The
2616  * shared_info field remains NULL in workers, or in non-parallel joins.
2617  */
2619 
2620  /*
2621  * If we are collecting hash stats, this points to an initially-zeroed
2622  * collection area, which could be either local storage or in shared
2623  * memory; either way it's for just one process.
2624  */
2626 
2627  /* Parallel hash state. */
2630 
2631 /* ----------------
2632  * SetOpState information
2633  *
2634  * Even in "sorted" mode, SetOp nodes are more complex than a simple
2635  * Unique, since we have to count how many duplicates to return. But
2636  * we also support hashing, so this is really more like a cut-down
2637  * form of Agg.
2638  * ----------------
2639  */
2640 /* this struct is private in nodeSetOp.c: */
2642 
2643 typedef struct SetOpState
2644 {
2645  PlanState ps; /* its first field is NodeTag */
2646  ExprState *eqfunction; /* equality comparator */
2647  Oid *eqfuncoids; /* per-grouping-field equality fns */
2648  FmgrInfo *hashfunctions; /* per-grouping-field hash fns */
2649  bool setop_done; /* indicates completion of output scan */
2650  long numOutput; /* number of dups left to output */
2651  /* these fields are used in SETOP_SORTED mode: */
2652  SetOpStatePerGroup pergroup; /* per-group working state */
2653  HeapTuple grp_firstTuple; /* copy of first tuple of current group */
2654  /* these fields are used in SETOP_HASHED mode: */
2655  TupleHashTable hashtable; /* hash table with one entry per group */
2656  MemoryContext tableContext; /* memory context containing hash table */
2657  bool table_filled; /* hash table filled yet? */
2658  TupleHashIterator hashiter; /* for iterating through hash table */
2660 
2661 /* ----------------
2662  * LockRowsState information
2663  *
2664  * LockRows nodes are used to enforce FOR [KEY] UPDATE/SHARE locking.
2665  * ----------------
2666  */
2667 typedef struct LockRowsState
2668 {
2669  PlanState ps; /* its first field is NodeTag */
2670  List *lr_arowMarks; /* List of ExecAuxRowMarks */
2671  EPQState lr_epqstate; /* for evaluating EvalPlanQual rechecks */
2673 
2674 /* ----------------
2675  * LimitState information
2676  *
2677  * Limit nodes are used to enforce LIMIT/OFFSET clauses.
2678  * They just select the desired subrange of their subplan's output.
2679  *
2680  * offset is the number of initial tuples to skip (0 does nothing).
2681  * count is the number of tuples to return after skipping the offset tuples.
2682  * If no limit count was specified, count is undefined and noCount is true.
2683  * When lstate == LIMIT_INITIAL, offset/count/noCount haven't been set yet.
2684  * ----------------
2685  */
2686 typedef enum
2687 {
2688  LIMIT_INITIAL, /* initial state for LIMIT node */
2689  LIMIT_RESCAN, /* rescan after recomputing parameters */
2690  LIMIT_EMPTY, /* there are no returnable rows */
2691  LIMIT_INWINDOW, /* have returned a row in the window */
2692  LIMIT_WINDOWEND_TIES, /* have returned a tied row */
2693  LIMIT_SUBPLANEOF, /* at EOF of subplan (within window) */
2694  LIMIT_WINDOWEND, /* stepped off end of window */
2695  LIMIT_WINDOWSTART /* stepped off beginning of window */
2697 
2698 typedef struct LimitState
2699 {
2700  PlanState ps; /* its first field is NodeTag */
2701  ExprState *limitOffset; /* OFFSET parameter, or NULL if none */
2702  ExprState *limitCount; /* COUNT parameter, or NULL if none */
2703  LimitOption limitOption; /* limit specification type */
2704  int64 offset; /* current OFFSET value */
2705  int64 count; /* current COUNT, if any */
2706  bool noCount; /* if true, ignore count */
2707  LimitStateCond lstate; /* state machine status, as above */
2708  int64 position; /* 1-based index of last tuple returned */
2709  TupleTableSlot *subSlot; /* tuple last obtained from subplan */
2710  ExprState *eqfunction; /* tuple equality qual in case of WITH TIES
2711  * option */
2712  TupleTableSlot *last_slot; /* slot for evaluation of ties */
2714 
2715 #endif /* EXECNODES_H */
int16 AttrNumber
Definition: attnum.h:21
int Buffer
Definition: buf.h:23
unsigned short uint16
Definition: c.h:440
unsigned int uint32
Definition: c.h:441
signed short int16
Definition: c.h:428
#define FLEXIBLE_ARRAY_MEMBER
Definition: c.h:350
unsigned char bool
Definition: c.h:391
uint32 bits32
Definition: c.h:450
unsigned int Index
Definition: c.h:549
unsigned char uint8
Definition: c.h:439
uint32 CommandId
Definition: c.h:601
size_t Size
Definition: c.h:540
uint64 dsa_pointer
Definition: dsa.h:62
void(* ExprContextCallbackFunction)(Datum arg)
Definition: execnodes.h:194
struct WindowStatePerAggData * WindowStatePerAgg
Definition: execnodes.h:2407
struct IndexScanState IndexScanState
struct ExprContext ExprContext
struct ModifyTableState ModifyTableState
struct ResultState ResultState
struct SubPlanState SubPlanState
struct SharedIncrementalSortInfo SharedIncrementalSortInfo
struct CteScanState CteScanState
TupleTableSlot *(* ExecProcNodeMtd)(struct PlanState *pstate)
Definition: execnodes.h:985
struct PlanState PlanState
struct UniqueState UniqueState
struct SetOpState SetOpState
struct SharedMemoizeInfo SharedMemoizeInfo
struct HashState HashState
struct MemoizeState MemoizeState
struct IndexOnlyScanState IndexOnlyScanState
IncrementalSortExecutionStatus
Definition: execnodes.h:2243
@ INCSORT_READFULLSORT
Definition: execnodes.h:2246
@ INCSORT_LOADPREFIXSORT
Definition: execnodes.h:2245
@ INCSORT_READPREFIXSORT
Definition: execnodes.h:2247
@ INCSORT_LOADFULLSORT
Definition: execnodes.h:2244
struct EPQState EPQState
struct GatherMergeState GatherMergeState
struct LimitState LimitState
struct ExprState ExprState
WindowAggStatus
Definition: execnodes.h:2413
@ WINDOWAGG_PASSTHROUGH
Definition: execnodes.h:2416
@ WINDOWAGG_RUN
Definition: execnodes.h:2415
@ WINDOWAGG_DONE
Definition: execnodes.h:2414
@ WINDOWAGG_PASSTHROUGH_STRICT
Definition: execnodes.h:2417
struct JunkFilter JunkFilter
struct ResultRelInfo ResultRelInfo
struct CustomScanState CustomScanState
struct OnConflictSetState OnConflictSetState
struct BitmapOrState BitmapOrState
struct IncrementalSortInfo IncrementalSortInfo
struct WindowFuncExprState WindowFuncExprState
struct HashJoinState HashJoinState
struct HashJoinTableData * HashJoinTable
Definition: execnodes.h:2048
struct SeqScanState SeqScanState
struct HashJoinTupleData * HashJoinTuple
Definition: execnodes.h:2047
struct TupleHashEntryData * TupleHashEntry
Definition: execnodes.h:751
struct SortState SortState
struct BitmapAndState BitmapAndState
struct AggState AggState
SharedBitmapState
Definition: execnodes.h:1619
@ BM_INITIAL
Definition: execnodes.h:1620
@ BM_FINISHED
Definition: execnodes.h:1622
@ BM_INPROGRESS
Definition: execnodes.h:1621
struct NestLoopState NestLoopState
struct MemoizeInstrumentation MemoizeInstrumentation
struct SetExprState SetExprState
struct GroupState GroupState
struct MaterialState MaterialState
struct WindowStatePerFuncData * WindowStatePerFunc
Definition: execnodes.h:2406
struct ExprContext_CB ExprContext_CB
struct TidRangeScanState TidRangeScanState
struct AggStatePerHashData * AggStatePerHash
Definition: execnodes.h:2322
struct TupleHashTableData * TupleHashTable
Definition: execnodes.h:752
struct SampleScanState SampleScanState
LimitStateCond
Definition: execnodes.h:2687
@ LIMIT_WINDOWEND_TIES
Definition: execnodes.h:2692
@ LIMIT_WINDOWEND
Definition: execnodes.h:2694
@ LIMIT_INWINDOW
Definition: execnodes.h:2691
@ LIMIT_SUBPLANEOF
Definition: execnodes.h:2693
@ LIMIT_WINDOWSTART
Definition: execnodes.h:2695
@ LIMIT_EMPTY
Definition: execnodes.h:2690
@ LIMIT_INITIAL
Definition: execnodes.h:2688
@ LIMIT_RESCAN
Definition: execnodes.h:2689
struct GatherState GatherState
struct MergeJoinClauseData * MergeJoinClause
Definition: execnodes.h:1996
struct ParallelBitmapHeapState ParallelBitmapHeapState
struct MergeJoinState MergeJoinState
struct SetOpStatePerGroupData * SetOpStatePerGroup
Definition: execnodes.h:2641
ExprDoneCond
Definition: execnodes.h:279
@ ExprSingleResult
Definition: execnodes.h:280
@ ExprMultipleResult
Definition: execnodes.h:281
@ ExprEndResult
Definition: execnodes.h:282
struct AggStatePerGroupData * AggStatePerGroup
Definition: execnodes.h:2320
struct ForeignScanState ForeignScanState
struct FunctionScanState FunctionScanState
struct AggStatePerPhaseData * AggStatePerPhase
Definition: execnodes.h:2321
struct WindowAggState WindowAggState
struct AggStatePerTransData * AggStatePerTrans
Definition: execnodes.h:2319
struct NamedTuplestoreScanState NamedTuplestoreScanState
struct SubqueryScanState SubqueryScanState
DomainConstraintType
Definition: execnodes.h:954
@ DOM_CONSTRAINT_CHECK
Definition: execnodes.h:956
@ DOM_CONSTRAINT_NOTNULL
Definition: execnodes.h:955
struct TableFuncScanState TableFuncScanState
struct RecursiveUnionState RecursiveUnionState
struct TupleHashEntryData TupleHashEntryData
struct SharedSortInfo SharedSortInfo
struct ScanState ScanState
tuplehash_iterator TupleHashIterator
Definition: execnodes.h:790
struct MergeActionState MergeActionState
struct AggregateInstrumentation AggregateInstrumentation
struct TidScanState TidScanState
struct SharedHashInfo SharedHashInfo
struct ProjectSetState ProjectSetState
struct IncrementalSortState IncrementalSortState
struct ReturnSetInfo ReturnSetInfo
struct AggStatePerAggData * AggStatePerAgg
Definition: execnodes.h:2318
SetFunctionReturnMode
Definition: execnodes.h:292
@ SFRM_Materialize_Preferred
Definition: execnodes.h:296
@ SFRM_ValuePerCall
Definition: execnodes.h:293
@ SFRM_Materialize_Random
Definition: execnodes.h:295
@ SFRM_Materialize
Definition: execnodes.h:294
struct IndexInfo IndexInfo
struct ProjectionInfo ProjectionInfo
struct EState EState
struct DomainConstraintState DomainConstraintState
struct PresortedKeyData PresortedKeyData
struct HashInstrumentation HashInstrumentation
struct AsyncRequest AsyncRequest
struct IncrementalSortGroupInfo IncrementalSortGroupInfo
struct TupleHashTableData TupleHashTableData
struct JoinState JoinState
struct WorkTableScanState WorkTableScanState
struct BitmapHeapScanState BitmapHeapScanState
struct BitmapIndexScanState BitmapIndexScanState
struct SharedAggInfo SharedAggInfo
struct LockRowsState LockRowsState
struct ExecRowMark ExecRowMark
struct MergeAppendState MergeAppendState
Datum(* ExprStateEvalFunc)(struct ExprState *expression, struct ExprContext *econtext, bool *isNull)
Definition: execnodes.h:54
struct ExecAuxRowMark ExecAuxRowMark
struct ValuesScanState ValuesScanState
LockWaitPolicy
Definition: lockoptions.h:37
LockClauseStrength
Definition: lockoptions.h:22
CmdType
Definition: nodes.h:719
AggStrategy
Definition: nodes.h:806
NodeTag
Definition: nodes.h:27
AggSplit
Definition: nodes.h:828
LimitOption
Definition: nodes.h:883
JoinType
Definition: nodes.h:744
uint16 OffsetNumber
Definition: off.h:24
void * arg
#define INDEX_MAX_KEYS
RowMarkType
Definition: plannodes.h:1106
uintptr_t Datum
Definition: postgres.h:411
unsigned int Oid
Definition: postgres_ext.h:31
int slock_t
Definition: s_lock.h:975
ScanDirection
Definition: sdir.h:23
MemoryContext hash_metacxt
Definition: execnodes.h:2368
ScanState ss
Definition: execnodes.h:2326
Tuplesortstate * sort_out
Definition: execnodes.h:2359
uint64 hash_disk_used
Definition: execnodes.h:2386
AggStatePerGroup * all_pergroups
Definition: execnodes.h:2395
AggStatePerGroup * hash_pergroup
Definition: execnodes.h:2390
AggStatePerPhase phase
Definition: execnodes.h:2332
List * aggs
Definition: execnodes.h:2327
ExprContext * tmpcontext
Definition: execnodes.h:2339
int max_colno_needed
Definition: execnodes.h:2353
int hash_planned_partitions
Definition: execnodes.h:2380
HeapTuple grp_firstTuple
Definition: execnodes.h:2364
Size hash_mem_limit
Definition: execnodes.h:2378
ExprContext * curaggcontext
Definition: execnodes.h:2341
AggStatePerTrans curpertrans
Definition: execnodes.h:2344
bool table_filled
Definition: execnodes.h:2366
AggStatePerTrans pertrans
Definition: execnodes.h:2336
int current_set
Definition: execnodes.h:2349
struct LogicalTapeSet * hash_tapeset
Definition: execnodes.h:2369
AggStrategy aggstrategy
Definition: execnodes.h:2330
int numtrans
Definition: execnodes.h:2329
ExprContext * hashcontext
Definition: execnodes.h:2337
AggSplit aggsplit
Definition: execnodes.h:2331
int projected_set
Definition: execnodes.h:2347
SharedAggInfo * shared_info
Definition: execnodes.h:2398
uint64 hash_ngroups_limit
Definition: execnodes.h:2379
bool input_done
Definition: execnodes.h:2345
AggStatePerPhase phases
Definition: execnodes.h:2357
List * all_grouped_cols
Definition: execnodes.h:2351
bool hash_spill_mode
Definition: execnodes.h:2376
AggStatePerGroup * pergroups
Definition: execnodes.h:2362
AggStatePerHash perhash
Definition: execnodes.h:2389
Size hash_mem_peak
Definition: execnodes.h:2383
double hashentrysize
Definition: execnodes.h:2382
int numphases
Definition: execnodes.h:2333
uint64 hash_ngroups_current
Definition: execnodes.h:2384
int hash_batches_used
Definition: execnodes.h:2387
Tuplesortstate * sort_in
Definition: execnodes.h:2358
TupleTableSlot * hash_spill_wslot
Definition: execnodes.h:2373
AggStatePerAgg curperagg
Definition: execnodes.h:2342
struct HashAggSpill * hash_spills
Definition: execnodes.h:2370
TupleTableSlot * sort_slot
Definition: execnodes.h:2360
bool hash_ever_spilled
Definition: execnodes.h:2375
int numaggs
Definition: execnodes.h:2328
ProjectionInfo * combinedproj
Definition: execnodes.h:2397
int num_hashes
Definition: execnodes.h:2367
AggStatePerAgg peragg
Definition: execnodes.h:2335
List * hash_batches
Definition: execnodes.h:2374
TupleTableSlot * hash_spill_rslot
Definition: execnodes.h:2372
int maxsets
Definition: execnodes.h:2356
ExprContext ** aggcontexts
Definition: execnodes.h:2338
Bitmapset * colnos_needed
Definition: execnodes.h:2352
int current_phase
Definition: execnodes.h:2334
bool all_cols_needed
Definition: execnodes.h:2354
bool agg_done
Definition: execnodes.h:2346
Bitmapset * grouped_cols
Definition: execnodes.h:2350
struct PartitionPruneState * as_prune_state
Definition: execnodes.h:1319
Bitmapset * as_valid_asyncplans
Definition: execnodes.h:1321
Bitmapset * as_needrequest
Definition: execnodes.h:1312
bool as_syncdone
Definition: execnodes.h:1309
AsyncRequest ** as_asyncrequests
Definition: execnodes.h:1306
bool as_begun
Definition: execnodes.h:1303
Bitmapset * as_asyncplans
Definition: execnodes.h:1304
int as_whichplan
Definition: execnodes.h:1302
int as_nasyncresults
Definition: execnodes.h:1308
struct WaitEventSet * as_eventset
Definition: execnodes.h:1313
bool(* choose_next_subplan)(AppendState *)
Definition: execnodes.h:1322
PlanState ** appendplans
Definition: execnodes.h:1300
int as_first_partial_plan
Definition: execnodes.h:1315
PlanState ps
Definition: execnodes.h:1299
int as_nasyncremain
Definition: execnodes.h:1311
ParallelAppendState * as_pstate
Definition: execnodes.h:1317
Bitmapset * as_valid_subplans
Definition: execnodes.h:1320
Size pstate_len
Definition: execnodes.h:1318
TupleTableSlot ** as_asyncresults
Definition: execnodes.h:1307
int as_nasyncplans
Definition: execnodes.h:1305
struct PlanState * requestor
Definition: execnodes.h:569
TupleTableSlot * result
Definition: execnodes.h:574
bool request_complete
Definition: execnodes.h:573
int request_index
Definition: execnodes.h:571
bool callback_pending
Definition: execnodes.h:572
struct PlanState * requestee
Definition: execnodes.h:570
PlanState ps
Definition: execnodes.h:1386
PlanState ** bitmapplans
Definition: execnodes.h:1387
ParallelBitmapHeapState * pstate
Definition: execnodes.h:1695
ExprState * bitmapqualorig
Definition: execnodes.h:1677
TBMIterateResult * tbmres
Definition: execnodes.h:1680
TBMIterator * tbmiterator
Definition: execnodes.h:1679
TIDBitmap * tbm
Definition: execnodes.h:1678
TBMIterator * prefetch_iterator
Definition: execnodes.h:1687
TBMSharedIterator * shared_prefetch_iterator
Definition: execnodes.h:1694
TBMSharedIterator * shared_tbmiterator
Definition: execnodes.h:1693
ExprContext * biss_RuntimeContext
Definition: execnodes.h:1600
IndexArrayKeyInfo * biss_ArrayKeys
Definition: execnodes.h:1597
IndexRuntimeKeyInfo * biss_RuntimeKeys
Definition: execnodes.h:1595
TIDBitmap * biss_result
Definition: execnodes.h:1592
struct ScanKeyData * biss_ScanKeys
Definition: execnodes.h:1593
struct IndexScanDescData * biss_ScanDesc
Definition: execnodes.h:1602
Relation biss_RelationDesc
Definition: execnodes.h:1601
PlanState ps
Definition: execnodes.h:1397
PlanState ** bitmapplans
Definition: execnodes.h:1398
Tuplestorestate * cte_table
Definition: execnodes.h:1859
ScanState ss
Definition: execnodes.h:1852
PlanState * cteplanstate
Definition: execnodes.h:1855
struct CteScanState * leader
Definition: execnodes.h:1857
const struct CustomExecMethods * methods
Definition: execnodes.h:1934
List * custom_ps
Definition: execnodes.h:1932
ScanState ss
Definition: execnodes.h:1929
DomainConstraintType constrainttype
Definition: execnodes.h:962
ExprState * check_exprstate
Definition: execnodes.h:965
ExecAuxRowMark ** relsubs_rowmark
Definition: execnodes.h:1172
TupleTableSlot * origslot
Definition: execnodes.h:1160
TupleTableSlot ** relsubs_slot
Definition: execnodes.h:1144
Plan * plan
Definition: execnodes.h:1151
int epqParam
Definition: execnodes.h:1136
EState * parentestate
Definition: execnodes.h:1135
EState * recheckestate
Definition: execnodes.h:1165
PlanState * recheckplanstate
Definition: execnodes.h:1180
List * arowMarks
Definition: execnodes.h:1152
List * tuple_table
Definition: execnodes.h:1143
bool * relsubs_done
Definition: execnodes.h:1178
uint64 es_processed
Definition: execnodes.h:636
struct dsa_area * es_query_dsa
Definition: execnodes.h:666
NodeTag type
Definition: execnodes.h:586
struct ExecRowMark ** es_rowmarks
Definition: execnodes.h:596
List * es_tuple_routing_result_relations
Definition: execnodes.h:620
int es_top_eflags
Definition: execnodes.h:638
struct JitContext * es_jit
Definition: execnodes.h:678
int es_instrument
Definition: execnodes.h:639
PlannedStmt * es_plannedstmt
Definition: execnodes.h:598
QueryEnvironment * es_queryEnv
Definition: execnodes.h:629
ResultRelInfo ** es_result_relations
Definition: execnodes.h:607
struct JitInstrumentation * es_jit_worker_instr
Definition: execnodes.h:679
ParamExecData * es_param_exec_vals
Definition: execnodes.h:627
List * es_range_table
Definition: execnodes.h:592
List * es_exprcontexts
Definition: execnodes.h:642
ParamListInfo es_param_list_info
Definition: execnodes.h:626
bool es_finished
Definition: execnodes.h:640
MemoryContext es_query_cxt
Definition: execnodes.h:632
List * es_tupleTable
Definition: execnodes.h:634
ScanDirection es_direction
Definition: execnodes.h:589
struct EPQState * es_epq_active
Definition: execnodes.h:661
PartitionDirectory es_partition_directory
Definition: execnodes.h:614
List * es_trig_target_relations
Definition: execnodes.h:623
int es_jit_flags
Definition: execnodes.h:677
List * es_opened_result_relations
Definition: execnodes.h:610
bool es_use_parallel_mode
Definition: execnodes.h:663
Relation * es_relations
Definition: execnodes.h:594
List * es_subplanstates
Definition: execnodes.h:644
ExprContext * es_per_tuple_exprcontext
Definition: execnodes.h:653
CommandId es_output_cid
Definition: execnodes.h:604
Index es_range_table_size
Definition: execnodes.h:593
const char * es_sourceText
Definition: execnodes.h:599
Snapshot es_snapshot
Definition: execnodes.h:590
List * es_auxmodifytables
Definition: execnodes.h:646
JunkFilter * es_junkFilter
Definition: execnodes.h:601
Snapshot es_crosscheck_snapshot
Definition: execnodes.h:591
AttrNumber wholeAttNo
Definition: execnodes.h:731
ExecRowMark * rowmark
Definition: execnodes.h:728
AttrNumber toidAttNo
Definition: execnodes.h:730
AttrNumber ctidAttNo
Definition: execnodes.h:729
Index rowmarkId
Definition: execnodes.h:708
ItemPointerData curCtid
Definition: execnodes.h:713
LockClauseStrength strength
Definition: execnodes.h:710
Index rti
Definition: execnodes.h:706
bool ermActive
Definition: execnodes.h:712
Index prti
Definition: execnodes.h:707
Relation relation
Definition: execnodes.h:704
LockWaitPolicy waitPolicy
Definition: execnodes.h:711
void * ermExtra
Definition: execnodes.h:714
RowMarkType markType
Definition: execnodes.h:709
struct ExprContext_CB * next
Definition: execnodes.h:198
Datum domainValue_datum
Definition: execnodes.h:263
ParamListInfo ecxt_param_list_info
Definition: execnodes.h:244
MemoryContext ecxt_per_tuple_memory
Definition: execnodes.h:240
TupleTableSlot * ecxt_innertuple
Definition: execnodes.h:234
ParamExecData * ecxt_param_exec_vals
Definition: execnodes.h:243
Datum * ecxt_aggvalues
Definition: execnodes.h:251
bool caseValue_isNull
Definition: execnodes.h:259
TupleTableSlot * ecxt_scantuple
Definition: execnodes.h:232
Datum caseValue_datum
Definition: execnodes.h:257
bool * ecxt_aggnulls
Definition: execnodes.h:253
MemoryContext ecxt_per_query_memory
Definition: execnodes.h:239
ExprContext_CB * ecxt_callbacks
Definition: execnodes.h:271
bool domainValue_isNull
Definition: execnodes.h:265
NodeTag type
Definition: execnodes.h:228
struct EState * ecxt_estate
Definition: execnodes.h:268
TupleTableSlot * ecxt_outertuple
Definition: execnodes.h:236
Expr * expr
Definition: execnodes.h:95
NodeTag type
Definition: execnodes.h:64
Datum resvalue
Definition: execnodes.h:75
struct ExprEvalStep * steps
Definition: execnodes.h:86
int steps_alloc
Definition: execnodes.h:106
bool resnull
Definition: execnodes.h:73
ExprStateEvalFunc evalfunc
Definition: execnodes.h:92
Datum * innermost_domainval
Definition: execnodes.h:115
bool * innermost_domainnull
Definition: execnodes.h:116
TupleTableSlot * resultslot
Definition: execnodes.h:81
ParamListInfo ext_params
Definition: execnodes.h:110
void * evalfunc_private
Definition: execnodes.h:98
uint8 flags
Definition: execnodes.h:66
struct PlanState * parent
Definition: execnodes.h:109
bool * innermost_casenull
Definition: execnodes.h:113
Datum * innermost_caseval
Definition: execnodes.h:112
int steps_len
Definition: execnodes.h:105
Definition: fmgr.h:57
struct FdwRoutine * fdwroutine
Definition: execnodes.h:1908
ExprState * fdw_recheck_quals
Definition: execnodes.h:1904
ResultRelInfo * resultRelInfo
Definition: execnodes.h:1906
ScanState ss
Definition: execnodes.h:1903
struct FunctionScanPerFuncState * funcstates
Definition: execnodes.h:1777
MemoryContext argcontext
Definition: execnodes.h:1778
struct ParallelExecutorInfo * pei
Definition: execnodes.h:2568
TupleDesc tupDesc
Definition: execnodes.h:2565
struct TupleQueueReader ** reader
Definition: execnodes.h:2574
SortSupport gm_sortkeys
Definition: execnodes.h:2567
struct GMReaderTupleBuffer * gm_tuple_buffers
Definition: execnodes.h:2575
TupleTableSlot ** gm_slots
Definition: execnodes.h:2573
bool need_to_scan_locally
Definition: execnodes.h:2562
struct binaryheap * gm_heap
Definition: execnodes.h:2576
PlanState ps
Definition: execnodes.h:2559
bool initialized
Definition: execnodes.h:2534
TupleTableSlot * funnel_slot
Definition: execnodes.h:2538
struct ParallelExecutorInfo * pei
Definition: execnodes.h:2539
int nextreader
Definition: execnodes.h:2543
int nworkers_launched
Definition: execnodes.h:2541
PlanState ps
Definition: execnodes.h:2533
struct TupleQueueReader ** reader
Definition: execnodes.h:2544
int64 tuples_needed
Definition: execnodes.h:2536
bool need_to_scan_locally
Definition: execnodes.h:2535
ExprState * eqfunction
Definition: execnodes.h:2280
ScanState ss
Definition: execnodes.h:2279
bool grp_done
Definition: execnodes.h:2281
Definition: dynahash.c:220
HashJoinTuple hj_CurTuple
Definition: execnodes.h:2061
int hj_CurSkewBucketNo
Definition: execnodes.h:2060
List * hj_OuterHashKeys
Definition: execnodes.h:2054
TupleTableSlot * hj_NullOuterTupleSlot
Definition: execnodes.h:2064
TupleTableSlot * hj_OuterTupleSlot
Definition: execnodes.h:2062
bool hj_OuterNotEmpty
Definition: execnodes.h:2069
TupleTableSlot * hj_NullInnerTupleSlot
Definition: execnodes.h:2065
List * hj_HashOperators
Definition: execnodes.h:2055
ExprState * hashclauses
Definition: execnodes.h:2053
JoinState js
Definition: execnodes.h:2052
TupleTableSlot * hj_FirstOuterTupleSlot
Definition: execnodes.h:2066
bool hj_MatchedOuter
Definition: execnodes.h:2068
uint32 hj_CurHashValue
Definition: execnodes.h:2058
List * hj_Collations
Definition: execnodes.h:2056
int hj_CurBucketNo
Definition: execnodes.h:2059
HashJoinTable hj_HashTable
Definition: execnodes.h:2057
TupleTableSlot * hj_HashTupleSlot
Definition: execnodes.h:2063
struct ParallelHashJoinState * parallel_state
Definition: execnodes.h:2628
HashJoinTable hashtable
Definition: execnodes.h:2609
List * hashkeys
Definition: execnodes.h:2610
SharedHashInfo * shared_info
Definition: execnodes.h:2618
PlanState ps
Definition: execnodes.h:2608
HashInstrumentation * hinstrument
Definition: execnodes.h:2625
IncrementalSortGroupInfo prefixsortGroupInfo
Definition: execnodes.h:2225
IncrementalSortGroupInfo fullsortGroupInfo
Definition: execnodes.h:2224
Tuplesortstate * prefixsort_state
Definition: execnodes.h:2260
TupleTableSlot * group_pivot
Definition: execnodes.h:2267
TupleTableSlot * transfer_tuple
Definition: execnodes.h:2268
Tuplesortstate * fullsort_state
Definition: execnodes.h:2259
SharedIncrementalSortInfo * shared_info
Definition: execnodes.h:2270
IncrementalSortExecutionStatus execution_status
Definition: execnodes.h:2257
PresortedKeyData * presorted_keys
Definition: execnodes.h:2262
IncrementalSortInfo incsort_info
Definition: execnodes.h:2264
Datum * elem_values
Definition: execnodes.h:1478
ExprState * array_expr
Definition: execnodes.h:1475
struct ScanKeyData * scan_key
Definition: execnodes.h:1474
bool ii_Unique
Definition: execnodes.h:175
uint16 * ii_ExclusionStrats
Definition: execnodes.h:170
bool ii_BrokenHotChain
Definition: execnodes.h:181
NodeTag type
Definition: execnodes.h:160
int ii_NumIndexAttrs
Definition: execnodes.h:161
void * ii_AmCache
Definition: execnodes.h:184
bool ii_CheckedUnchanged
Definition: execnodes.h:178
Datum * ii_OpclassOptions
Definition: execnodes.h:174
Oid * ii_UniqueOps
Definition: execnodes.h:171
ExprState * ii_PredicateState
Definition: execnodes.h:167
Oid * ii_ExclusionOps
Definition: execnodes.h:168
bool ii_NullsNotDistinct
Definition: execnodes.h:176
int ii_ParallelWorkers
Definition: execnodes.h:182
bool ii_Concurrent
Definition: execnodes.h:180
uint16 * ii_UniqueStrats
Definition: execnodes.h:173
int ii_NumIndexKeyAttrs
Definition: execnodes.h:162
List * ii_ExpressionsState
Definition: execnodes.h:165
List * ii_Expressions
Definition: execnodes.h:164
bool ii_IndexUnchanged
Definition: execnodes.h:179
Oid * ii_ExclusionProcs
Definition: execnodes.h:169
Oid ii_Am
Definition: execnodes.h:183
AttrNumber ii_IndexAttrNumbers[INDEX_MAX_KEYS]
Definition: execnodes.h:163
Oid * ii_UniqueProcs
Definition: execnodes.h:172
MemoryContext ii_Context
Definition: execnodes.h:185
bool ii_ReadyForInserts
Definition: execnodes.h:177
List * ii_Predicate
Definition: execnodes.h:166
TupleTableSlot * ioss_TableSlot
Definition: execnodes.h:1568
bool ioss_RuntimeKeysReady
Definition: execnodes.h:1564
struct ScanKeyData * ioss_ScanKeys
Definition: execnodes.h:1558
ExprState * recheckqual
Definition: execnodes.h:1557
struct ScanKeyData * ioss_OrderByKeys
Definition: execnodes.h:1560
struct IndexScanDescData * ioss_ScanDesc
Definition: execnodes.h:1567
ExprContext * ioss_RuntimeContext
Definition: execnodes.h:1565
Relation ioss_RelationDesc
Definition: execnodes.h:1566
IndexRuntimeKeyInfo * ioss_RuntimeKeys
Definition: execnodes.h:1562
ExprState * key_expr
Definition: execnodes.h:1468
struct ScanKeyData * scan_key
Definition: execnodes.h:1467
bool iss_ReachedEnd
Definition: execnodes.h:1526
List * indexorderbyorig
Definition: execnodes.h:1512
bool * iss_OrderByTypByVals
Definition: execnodes.h:1530
int iss_NumRuntimeKeys
Definition: execnodes.h:1518
struct IndexScanDescData * iss_ScanDesc
Definition: execnodes.h:1522
ExprState * indexqualorig
Definition: execnodes.h:1511
Relation iss_RelationDesc
Definition: execnodes.h:1521
pairingheap * iss_ReorderQueue
Definition: execnodes.h:1525
ScanState ss
Definition: execnodes.h:1510
bool * iss_OrderByNulls
Definition: execnodes.h:1528
bool iss_RuntimeKeysReady
Definition: execnodes.h:1519
SortSupport iss_SortSupport
Definition: execnodes.h:1529
struct ScanKeyData * iss_ScanKeys
Definition: execnodes.h:1513
int iss_NumOrderByKeys
Definition: execnodes.h:1516
ExprContext * iss_RuntimeContext
Definition: execnodes.h:1520
struct ScanKeyData * iss_OrderByKeys
Definition: execnodes.h:1515
Datum * iss_OrderByValues
Definition: execnodes.h:1527
int16 * iss_OrderByTypLens
Definition: execnodes.h:1531
IndexRuntimeKeyInfo * iss_RuntimeKeys
Definition: execnodes.h:1517
Definition: jit.h:55
JoinType jointype
Definition: execnodes.h:1951
PlanState ps
Definition: execnodes.h:1950
ExprState * joinqual
Definition: execnodes.h:1954
bool single_match
Definition: execnodes.h:1952
TupleDesc jf_cleanTupType
Definition: execnodes.h:372
TupleTableSlot * jf_resultSlot
Definition: execnodes.h:374
AttrNumber * jf_cleanMap
Definition: execnodes.h:373
List * jf_targetList
Definition: execnodes.h:371
NodeTag type
Definition: execnodes.h:370
PlanState ps
Definition: execnodes.h:2700
ExprState * limitOffset
Definition: execnodes.h:2701
ExprState * limitCount
Definition: execnodes.h:2702
LimitOption limitOption
Definition: execnodes.h:2703
bool noCount
Definition: execnodes.h:2706
int64 position
Definition: execnodes.h:2708
TupleTableSlot * last_slot
Definition: execnodes.h:2712
int64 offset
Definition: execnodes.h:2704
ExprState * eqfunction
Definition: execnodes.h:2710
int64 count
Definition: execnodes.h:2705
LimitStateCond lstate
Definition: execnodes.h:2707
TupleTableSlot * subSlot
Definition: execnodes.h:2709
Definition: pg_list.h:51
PlanState ps
Definition: execnodes.h:2669
List * lr_arowMarks
Definition: execnodes.h:2670
EPQState lr_epqstate
Definition: execnodes.h:2671
bool eof_underlying
Definition: execnodes.h:2091
Tuplestorestate * tuplestorestate
Definition: execnodes.h:2092
ScanState ss
Definition: execnodes.h:2089
TupleDesc hashkeydesc
Definition: execnodes.h:2137
uint64 mem_used
Definition: execnodes.h:2145
FmgrInfo * hashfunctions
Definition: execnodes.h:2143
Oid * collations
Definition: execnodes.h:2144
TupleTableSlot * probeslot
Definition: execnodes.h:2139
SharedMemoizeInfo * shared_info
Definition: execnodes.h:2160
struct MemoizeEntry * entry
Definition: execnodes.h:2153
ExprState * cache_eq_expr
Definition: execnodes.h:2140
MemoizeInstrumentation stats
Definition: execnodes.h:2159
bool singlerow
Definition: execnodes.h:2155
dlist_head lru_list
Definition: execnodes.h:2148
MemoryContext tableContext
Definition: execnodes.h:2147
bool binary_mode
Definition: execnodes.h:2157
Bitmapset * keyparamids
Definition: execnodes.h:2161
ScanState ss
Definition: execnodes.h:2133
uint64 mem_limit
Definition: execnodes.h:2146
ExprState ** param_exprs
Definition: execnodes.h:2141
struct memoize_hash * hashtable
Definition: execnodes.h:2136
TupleTableSlot * tableslot
Definition: execnodes.h:2138
struct MemoizeTuple * last_tuple
Definition: execnodes.h:2149
MergeAction * mas_action
Definition: execnodes.h:402
ProjectionInfo * mas_proj
Definition: execnodes.h:403
ExprState * mas_whenqual
Definition: execnodes.h:405
PlanState ** mergeplans
Definition: execnodes.h:1343
SortSupport ms_sortkeys
Definition: execnodes.h:1346
Bitmapset * ms_valid_subplans
Definition: execnodes.h:1351
PlanState ps
Definition: execnodes.h:1342
struct binaryheap * ms_heap
Definition: execnodes.h:1348
TupleTableSlot ** ms_slots
Definition: execnodes.h:1347
struct PartitionPruneState * ms_prune_state
Definition: execnodes.h:1350
bool mj_MatchedOuter
Definition: execnodes.h:2009
bool mj_SkipMarkRestore
Definition: execnodes.h:2004
bool mj_ConstFalseJoin
Definition: execnodes.h:2006
TupleTableSlot * mj_MarkedTupleSlot
Definition: execnodes.h:2013
TupleTableSlot * mj_NullInnerTupleSlot
Definition: execnodes.h:2015
ExprContext * mj_InnerEContext
Definition: execnodes.h:2017
TupleTableSlot * mj_NullOuterTupleSlot
Definition: execnodes.h:2014
bool mj_ExtraMarks
Definition: execnodes.h:2005
MergeJoinClause mj_Clauses
Definition: execnodes.h:2002
bool mj_MatchedInner
Definition: execnodes.h:2010
TupleTableSlot * mj_InnerTupleSlot
Definition: execnodes.h:2012
ExprContext * mj_OuterEContext
Definition: execnodes.h:2016
JoinState js
Definition: execnodes.h:2000
TupleTableSlot * mj_OuterTupleSlot
Definition: execnodes.h:2011
CmdType operation
Definition: execnodes.h:1226
ResultRelInfo * resultRelInfo
Definition: execnodes.h:1230
double mt_merge_deleted
Definition: execnodes.h:1275
struct PartitionTupleRouting * mt_partition_tuple_routing
Definition: execnodes.h:1261
double mt_merge_inserted
Definition: execnodes.h:1273
TupleTableSlot * mt_root_tuple_slot
Definition: execnodes.h:1258
EPQState mt_epqstate
Definition: execnodes.h:1240
int mt_merge_subcommands
Definition: execnodes.h:1270
double mt_merge_updated
Definition: execnodes.h:1274
PlanState ps
Definition: execnodes.h:1225
HTAB * mt_resultOidHash
Definition: execnodes.h:1252
ResultRelInfo * rootResultRelInfo
Definition: execnodes.h:1238
struct TransitionCaptureState * mt_transition_capture
Definition: execnodes.h:1264
struct TransitionCaptureState * mt_oc_transition_capture
Definition: execnodes.h:1267
Tuplestorestate * relation
Definition: execnodes.h:1878
TupleTableSlot * nl_NullInnerTupleSlot
Definition: execnodes.h:1970
bool nl_NeedNewOuter
Definition: execnodes.h:1968
JoinState js
Definition: execnodes.h:1967
bool nl_MatchedOuter
Definition: execnodes.h:1969
Definition: nodes.h:574
TupleTableSlot * oc_ProjSlot
Definition: execnodes.h:387
TupleTableSlot * oc_Existing
Definition: execnodes.h:386
ExprState * oc_WhereClause
Definition: execnodes.h:389
ProjectionInfo * oc_ProjInfo
Definition: execnodes.h:388
SharedBitmapState state
Definition: execnodes.h:1645
dsa_pointer tbmiterator
Definition: execnodes.h:1640
ConditionVariable cv
Definition: execnodes.h:1646
dsa_pointer prefetch_iterator
Definition: execnodes.h:1641
char phs_snapshot_data[FLEXIBLE_ARRAY_MEMBER]
Definition: execnodes.h:1647
bool inneropsset
Definition: execnodes.h:1082
const TupleTableSlotOps * resultops
Definition: execnodes.h:1075
bool outeropsset
Definition: execnodes.h:1081
struct SharedJitInstrumentation * worker_jit_instrument
Definition: execnodes.h:1012
Instrumentation * instrument
Definition: execnodes.h:1008
NodeTag type
Definition: execnodes.h:996
ExecProcNodeMtd ExecProcNodeReal
Definition: execnodes.h:1005
const TupleTableSlotOps * outerops
Definition: execnodes.h:1073
const TupleTableSlotOps * innerops
Definition: execnodes.h:1074
bool resultopsset
Definition: execnodes.h:1083
struct PlanState * righttree
Definition: execnodes.h:1021
ExprState * qual
Definition: execnodes.h:1019
const TupleTableSlotOps * scanops
Definition: execnodes.h:1072
Plan * plan
Definition: execnodes.h:998
bool outeropsfixed
Definition: execnodes.h:1077
List * subPlan
Definition: execnodes.h:1025
EState * state
Definition: execnodes.h:1000
TupleDesc ps_ResultTupleDesc
Definition: execnodes.h:1035
WorkerInstrumentation * worker_instrument
Definition: execnodes.h:1009
List * initPlan
Definition: execnodes.h:1023
Bitmapset * chgParam
Definition: execnodes.h:1030
bool scanopsset
Definition: execnodes.h:1080
ExprContext * ps_ExprContext
Definition: execnodes.h:1037
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1036
TupleDesc scandesc
Definition: execnodes.h:1047
ProjectionInfo * ps_ProjInfo
Definition: execnodes.h:1038
bool scanopsfixed
Definition: execnodes.h:1076
bool async_capable
Definition: execnodes.h:1040
bool resultopsfixed
Definition: execnodes.h:1079
struct PlanState * lefttree
Definition: execnodes.h:1020
bool inneropsfixed
Definition: execnodes.h:1078
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1004
OffsetNumber attno
Definition: execnodes.h:2176
FmgrInfo flinfo
Definition: execnodes.h:2174
FunctionCallInfo fcinfo
Definition: execnodes.h:2175
PlanState ps
Definition: execnodes.h:1205
MemoryContext argcontext
Definition: execnodes.h:1210
bool pending_srf_tuples
Definition: execnodes.h:1209
ExprDoneCond * elemdone
Definition: execnodes.h:1207
ExprState pi_state
Definition: execnodes.h:339
ExprContext * pi_exprContext
Definition: execnodes.h:341
NodeTag type
Definition: execnodes.h:337
MemoryContext tempContext
Definition: execnodes.h:1375
MemoryContext tableContext
Definition: execnodes.h:1377
Tuplestorestate * working_table
Definition: execnodes.h:1370
FmgrInfo * hashfunctions
Definition: execnodes.h:1374
Tuplestorestate * intermediate_table
Definition: execnodes.h:1371
TupleHashTable hashtable
Definition: execnodes.h:1376
List * ri_matchedMergeAction
Definition: execnodes.h:520
TupleTableSlot * ri_PartitionTupleSlot
Definition: execnodes.h:540
List * ri_notMatchedMergeAction
Definition: execnodes.h:521
bool ri_projectNewInfoValid
Definition: execnodes.h:457
OnConflictSetState * ri_onConflict
Definition: execnodes.h:517
int ri_NumIndices
Definition: execnodes.h:436
List * ri_onConflictArbiterIndexes
Definition: execnodes.h:514
struct ResultRelInfo * ri_RootResultRelInfo
Definition: execnodes.h:538
ExprState ** ri_ConstraintExprs
Definition: execnodes.h:499
ExprState * ri_PartitionCheckExpr
Definition: execnodes.h:524
Instrumentation * ri_TrigInstrument
Definition: execnodes.h:469
TupleTableSlot ** ri_Slots
Definition: execnodes.h:489
Relation ri_RelationDesc
Definition: execnodes.h:433
RelationPtr ri_IndexRelationDescs
Definition: execnodes.h:439
TupleTableSlot * ri_ReturningSlot
Definition: execnodes.h:472
int ri_NumSlotsInitialized
Definition: execnodes.h:487
ExprState ** ri_GeneratedExprs
Definition: execnodes.h:502
List * ri_WithCheckOptions
Definition: execnodes.h:493
TupleTableSlot * ri_oldTupleSlot
Definition: execnodes.h:455
struct CopyMultiInsertBuffer * ri_CopyMultiInsertBuffer
Definition: execnodes.h:552
TriggerDesc * ri_TrigDesc
Definition: execnodes.h:460
Index ri_RangeTableIndex
Definition: execnodes.h:430
TupleConversionMap * ri_ChildToRootMap
Definition: execnodes.h:548
void * ri_FdwState
Definition: execnodes.h:480
bool ri_ChildToRootMapValid
Definition: execnodes.h:549
List * ri_ancestorResultRels
Definition: execnodes.h:558
TupleTableSlot * ri_newTupleSlot
Definition: execnodes.h:453
List * ri_WithCheckOptionExprs
Definition: execnodes.h:496
ProjectionInfo * ri_projectNew
Definition: execnodes.h:451
NodeTag type
Definition: execnodes.h:427
ProjectionInfo * ri_projectReturning
Definition: execnodes.h:511
struct FdwRoutine * ri_FdwRoutine
Definition: execnodes.h:477
ExprState ** ri_TrigWhenExprs
Definition: execnodes.h:466
List * ri_returningList
Definition: execnodes.h:508
int ri_NumGeneratedNeeded
Definition: execnodes.h:505
FmgrInfo * ri_TrigFunctions
Definition: execnodes.h:463
TupleConversionMap * ri_RootToPartitionMap
Definition: execnodes.h:539
TupleTableSlot ** ri_PlanSlots
Definition: execnodes.h:490
bool ri_usesFdwDirectModify
Definition: execnodes.h:483
AttrNumber ri_RowIdAttNo
Definition: execnodes.h:448
IndexInfo ** ri_IndexRelationInfo
Definition: execnodes.h:442
TupleTableSlot * ri_TrigNewSlot
Definition: execnodes.h:474
int ri_BatchSize
Definition: execnodes.h:488
TupleTableSlot * ri_TrigOldSlot
Definition: execnodes.h:473
ExprState * resconstantqual
Definition: execnodes.h:1191
bool rs_done
Definition: execnodes.h:1192
PlanState ps
Definition: execnodes.h:1190
bool rs_checkqual
Definition: execnodes.h:1193
NodeTag type
Definition: execnodes.h:307
SetFunctionReturnMode returnMode
Definition: execnodes.h:313
ExprContext * econtext
Definition: execnodes.h:309
TupleDesc setDesc
Definition: execnodes.h:317
Tuplestorestate * setResult
Definition: execnodes.h:316
TupleDesc expectedDesc
Definition: execnodes.h:310
int allowedModes
Definition: execnodes.h:311
ExprDoneCond isDone
Definition: execnodes.h:314
ExprState * repeatable
Definition: execnodes.h:1447
void * tsm_state
Definition: execnodes.h:1450
ScanState ss
Definition: execnodes.h:1445
struct TsmRoutine * tsmroutine
Definition: execnodes.h:1449
Relation ss_currentRelation
Definition: execnodes.h:1424
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1426
PlanState ps
Definition: execnodes.h:1423
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1425
ScanState ss
Definition: execnodes.h:1435
Size pscan_len
Definition: execnodes.h:1436
Expr * expr
Definition: execnodes.h:845
FunctionCallInfo fcinfo
Definition: execnodes.h:905
TupleTableSlot * funcResultSlot
Definition: execnodes.h:868
Tuplestorestate * funcResultStore
Definition: execnodes.h:867
bool funcReturnsSet
Definition: execnodes.h:881
bool shutdown_reg
Definition: execnodes.h:898
bool funcReturnsTuple
Definition: execnodes.h:875
ExprState * elidedFuncState
Definition: execnodes.h:853
TupleDesc funcResultDesc
Definition: execnodes.h:874
FmgrInfo func
Definition: execnodes.h:860
List * args
Definition: execnodes.h:846
NodeTag type
Definition: execnodes.h:844
bool setArgsValid
Definition: execnodes.h:890
long numOutput
Definition: execnodes.h:2650
HeapTuple grp_firstTuple
Definition: execnodes.h:2653
SetOpStatePerGroup pergroup
Definition: execnodes.h:2652
ExprState * eqfunction
Definition: execnodes.h:2646
TupleHashIterator hashiter
Definition: execnodes.h:2658
bool table_filled
Definition: execnodes.h:2657
MemoryContext tableContext
Definition: execnodes.h:2656
PlanState ps
Definition: execnodes.h:2645
Oid * eqfuncoids
Definition: execnodes.h:2647
TupleHashTable hashtable
Definition: execnodes.h:2655
FmgrInfo * hashfunctions
Definition: execnodes.h:2648
bool setop_done
Definition: execnodes.h:2649
AggregateInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]
Definition: execnodes.h:2302
HashInstrumentation hinstrument[FLEXIBLE_ARRAY_MEMBER]
Definition: execnodes.h:2599
IncrementalSortInfo sinfo[FLEXIBLE_ARRAY_MEMBER]
Definition: execnodes.h:2235
MemoizeInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]
Definition: execnodes.h:2121
TuplesortInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]
Definition: execnodes.h:2186
bool sort_Done
Definition: execnodes.h:2199
bool am_worker
Definition: execnodes.h:2203
int64 bound_Done
Definition: execnodes.h:2201
bool bounded_Done
Definition: execnodes.h:2200
void * tuplesortstate
Definition: execnodes.h:2202
bool randomAccess
Definition: execnodes.h:2196
SharedSortInfo * shared_info
Definition: execnodes.h:2205
bool datumSort
Definition: execnodes.h:2204
ScanState ss
Definition: execnodes.h:2195
bool bounded
Definition: execnodes.h:2197
int64 bound
Definition: execnodes.h:2198
TupleHashTable hashtable
Definition: execnodes.h:926
ExprState * cur_eq_comp
Definition: execnodes.h:943
FmgrInfo * tab_eq_funcs
Definition: execnodes.h:940
MemoryContext hashtablecxt
Definition: execnodes.h:930
Oid * tab_eq_funcoids
Definition: execnodes.h:936
NodeTag type
Definition: execnodes.h:914
ExprContext * innerecontext
Definition: execnodes.h:932
FmgrInfo * tab_hash_funcs
Definition: execnodes.h:939
FmgrInfo * cur_eq_funcs
Definition: execnodes.h:942
List * args
Definition: execnodes.h:919
MemoryContext hashtempcxt
Definition: execnodes.h:931
HeapTuple curTuple
Definition: execnodes.h:920
FmgrInfo * lhs_hash_funcs
Definition: execnodes.h:941
AttrNumber * keyColIdx
Definition: execnodes.h:935
struct PlanState * planstate
Definition: execnodes.h:916
TupleDesc descRight
Definition: execnodes.h:923
SubPlan * subplan
Definition: execnodes.h:915
ProjectionInfo * projLeft
Definition: execnodes.h:924
ProjectionInfo * projRight
Definition: execnodes.h:925
bool havenullrows
Definition: execnodes.h:929
ExprState * testexpr
Definition: execnodes.h:918
struct PlanState * parent
Definition: execnodes.h:917
Oid * tab_collations
Definition: execnodes.h:938
TupleHashTable hashnulls
Definition: execnodes.h:927
bool havehashrows
Definition: execnodes.h:928
Datum curArray
Definition: execnodes.h:921
PlanState * subplan
Definition: execnodes.h:1748
MemoryContext perTableCxt
Definition: execnodes.h:1836
Tuplestorestate * tupstore
Definition: execnodes.h:1837
Bitmapset * notnulls
Definition: execnodes.h:1830
const struct TableFuncRoutine * routine
Definition: execnodes.h:1832
ExprState * rowexpr
Definition: execnodes.h:1825
FmgrInfo * in_functions
Definition: execnodes.h:1833
ExprState * docexpr
Definition: execnodes.h:1824
ItemPointerData trss_maxtid
Definition: execnodes.h:1734
List * trss_tidexprs
Definition: execnodes.h:1732
ItemPointerData trss_mintid
Definition: execnodes.h:1733
ScanState ss
Definition: execnodes.h:1711
HeapTupleData tss_htup
Definition: execnodes.h:1717
bool tss_isCurrentOf
Definition: execnodes.h:1713
ItemPointerData * tss_TidList
Definition: execnodes.h:1716
List * tss_tidexprs
Definition: execnodes.h:1712
MinimalTuple firstTuple
Definition: execnodes.h:756
AttrNumber * keyColIdx
Definition: execnodes.h:774
FmgrInfo * tab_hash_funcs
Definition: execnodes.h:775
tuplehash_hash * hashtab
Definition: execnodes.h:772
MemoryContext tempcxt
Definition: execnodes.h:779
ExprState * tab_eq_func
Definition: execnodes.h:776
TupleTableSlot * tableslot
Definition: execnodes.h:781
ExprContext * exprcontext
Definition: execnodes.h:787
MemoryContext tablecxt
Definition: execnodes.h:778
TupleTableSlot * inputslot
Definition: execnodes.h:783
ExprState * cur_eq_func
Definition: execnodes.h:785
FmgrInfo * in_hash_funcs
Definition: execnodes.h:784
PlanState ps
Definition: execnodes.h:2520
ExprState * eqfunction
Definition: execnodes.h:2521
ScanState ss
Definition: execnodes.h:1807
List ** exprlists
Definition: execnodes.h:1809
List ** exprstatelists
Definition: execnodes.h:1810
ExprContext * rowcontext
Definition: execnodes.h:1808
ExprState * endOffset
Definition: execnodes.h:2451
MemoryContext aggcontext
Definition: execnodes.h:2470
ScanState ss
Definition: execnodes.h:2423
int64 aggregatedbase
Definition: execnodes.h:2445
int64 frametailgroup
Definition: execnodes.h:2465
int64 frameheadgroup
Definition: execnodes.h:2464
WindowStatePerAgg peragg
Definition: execnodes.h:2431
MemoryContext partcontext
Definition: execnodes.h:2469
FmgrInfo endInRangeFunc
Definition: execnodes.h:2457
TupleTableSlot * framehead_slot
Definition: execnodes.h:2498
bool frametail_valid
Definition: execnodes.h:2491
bool partition_spooled
Definition: execnodes.h:2485
FmgrInfo startInRangeFunc
Definition: execnodes.h:2456
int64 spooled_rows
Definition: execnodes.h:2439
int64 frameheadpos
Definition: execnodes.h:2441
bool more_partitions
Definition: execnodes.h:2487
Datum startOffsetValue
Definition: execnodes.h:2452
int64 grouptailpos
Definition: execnodes.h:2467
int64 currentgroup
Definition: execnodes.h:2463
TupleTableSlot * frametail_slot
Definition: execnodes.h:2499
ExprState * ordEqfunction
Definition: execnodes.h:2433
ExprState * runcondition
Definition: execnodes.h:2474
TupleTableSlot * temp_slot_2
Definition: execnodes.h:2504
Tuplestorestate * buffer
Definition: execnodes.h:2434
WindowAggStatus status
Definition: execnodes.h:2447
TupleTableSlot * agg_row_slot
Definition: execnodes.h:2502
struct WindowObjectData * agg_winobj
Definition: execnodes.h:2444
WindowStatePerFunc perfunc
Definition: execnodes.h:2430
bool framehead_valid
Definition: execnodes.h:2489
int64 groupheadpos
Definition: execnodes.h:2466
MemoryContext curaggcontext
Definition: execnodes.h:2471
bool inRangeNullsFirst
Definition: execnodes.h:2460
bool grouptail_valid
Definition: execnodes.h:2493
Datum endOffsetValue
Definition: execnodes.h:2453
int64 currentpos
Definition: execnodes.h:2440
ExprState * partEqfunction
Definition: execnodes.h:2432
int64 frametailpos
Definition: execnodes.h:2442
ExprState * startOffset
Definition: execnodes.h:2450
TupleTableSlot * first_part_slot
Definition: execnodes.h:2496
int64 aggregatedupto
Definition: execnodes.h:2446
ExprContext * tmpcontext
Definition: execnodes.h:2472
TupleTableSlot * temp_slot_1
Definition: execnodes.h:2503
bool use_pass_through
Definition: execnodes.h:2479
WindowFunc * wfunc
Definition: execnodes.h:826
ExprState * aggfilter
Definition: execnodes.h:828
RecursiveUnionState * rustate
Definition: execnodes.h:1892
Definition: dsa.c:355