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