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