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