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