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