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