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