PostgreSQL Source Code git master
Loading...
Searching...
No Matches
plannodes.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * plannodes.h
4 * definitions for query plan nodes
5 *
6 *
7 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/nodes/plannodes.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef PLANNODES_H
15#define PLANNODES_H
16
17#include "access/sdir.h"
18#include "access/stratnum.h"
19#include "common/relpath.h"
20#include "lib/stringinfo.h"
21#include "nodes/bitmapset.h"
22#include "nodes/lockoptions.h"
23#include "nodes/primnodes.h"
24
25
26/* ----------------------------------------------------------------
27 * node definitions
28 * ----------------------------------------------------------------
29 */
30
31/* ----------------
32 * PlannedStmtOrigin
33 *
34 * PlannedStmtOrigin identifies from where a PlannedStmt comes from.
35 * ----------------
36 */
38{
39 PLAN_STMT_UNKNOWN = 0, /* plan origin is not yet known */
40 PLAN_STMT_INTERNAL, /* generated internally by a query */
41 PLAN_STMT_STANDARD, /* standard planned statement */
42 PLAN_STMT_CACHE_GENERIC, /* Generic cached plan */
43 PLAN_STMT_CACHE_CUSTOM, /* Custom cached plan */
45
46/* ----------------
47 * PlannedStmt node
48 *
49 * The output of the planner is a Plan tree headed by a PlannedStmt node.
50 * PlannedStmt holds the "one time" information needed by the executor.
51 *
52 * For simplicity in APIs, we also wrap utility statements in PlannedStmt
53 * nodes; in such cases, commandType == CMD_UTILITY, the statement itself
54 * is in the utilityStmt field, and the rest of the struct is mostly dummy.
55 * (We do use canSetTag, stmt_location, stmt_len, and possibly queryId.)
56 *
57 * PlannedStmt, as well as all varieties of Plan, do not support equal(),
58 * not because it's not sensible but because we currently have no need.
59 * ----------------
60 */
61typedef struct PlannedStmt
62{
64
66
67 /* select|insert|update|delete|merge|utility */
69
70 /* query identifier (copied from Query) */
72
73 /* plan identifier (can be set by plugins) */
75
76 /* origin of plan */
78
79 /* is it insert|update|delete|merge RETURNING? */
81
82 /* has insert|update|delete|merge in WITH? */
84
85 /* do I set the command result tag? */
87
88 /* redo plan when TransactionXmin changes? */
90
91 /* is plan specific to current role? */
93
94 /* parallel mode required to execute? */
96
97 /* which forms of JIT should be performed */
99
100 /* tree of Plan nodes */
101 struct Plan *planTree;
102
103 /*
104 * List of PartitionPruneInfo contained in the plan
105 */
107
108 /* list of RangeTblEntry nodes */
110
111 /*
112 * RT indexes of relations that are not subject to runtime pruning or are
113 * needed to perform runtime pruning
114 */
116
117 /*
118 * list of RTEPermissionInfo nodes for rtable entries needing one
119 */
121
122 /* rtable indexes of target relations for INSERT/UPDATE/DELETE/MERGE */
123 /* integer list of RT indexes, or NIL */
125
126 /* list of AppendRelInfo nodes */
128
129 /*
130 * Plan trees for SubPlan expressions; note that some could be NULL
131 */
133
134 /* indices of subplans that require REWIND */
136
137 /* a list of PlanRowMark's */
139
140 /* OIDs of relations the plan depends on */
142
143 /* other dependencies, as PlanInvalItems */
145
146 /* type OIDs for PARAM_EXEC Params */
148
149 /* non-null if this is utility stmt */
151
152 /*
153 * DefElem objects added by extensions, e.g. using planner_shutdown_hook
154 *
155 * Set each DefElem's defname to the name of the plugin or extension, and
156 * the argument to a tree of nodes that all have copy and read/write
157 * support.
158 */
160
161 /* statement location in source string (copied from Query) */
162 /* start location, or -1 if unknown */
164 /* length in bytes; 0 means "rest of string" */
167
168/* macro for fetching the Plan associated with a SubPlan node */
169#define exec_subplan_get_plan(plannedstmt, subplan) \
170 ((Plan *) list_nth((plannedstmt)->subplans, (subplan)->plan_id - 1))
171
172
173/* ----------------
174 * Plan node
175 *
176 * All plan nodes "derive" from the Plan structure by having the
177 * Plan structure as the first field. This ensures that everything works
178 * when nodes are cast to Plan's. (node pointers are frequently cast to Plan*
179 * when passed around generically in the executor)
180 *
181 * We never actually instantiate any Plan nodes; this is just the common
182 * abstract superclass for all Plan-type nodes.
183 * ----------------
184 */
185typedef struct Plan
186{
188
190
191 /*
192 * estimated execution costs for plan (see costsize.c for more info)
193 */
194 /* count of disabled nodes */
196 /* cost expended before fetching any tuples */
198 /* total cost (assuming all tuples fetched) */
200
201 /*
202 * planner's estimate of result size of this plan step
203 */
204 /* number of rows plan is expected to emit */
206 /* average row width in bytes */
208
209 /*
210 * information needed for parallel query
211 */
212 /* engage parallel-aware logic? */
214 /* OK to use as part of parallel plan? */
216
217 /*
218 * information needed for asynchronous execution
219 */
220 /* engage asynchronous-capable logic? */
222
223 /*
224 * Common structural data for all Plan types.
225 */
226 /* unique across entire final plan tree */
228 /* target list to be computed at this node */
230 /* implicitly-ANDed qual conditions */
232 /* input plan tree(s) */
233 struct Plan *lefttree;
235 /* Init Plan nodes (un-correlated expr subselects) */
237
238 /*
239 * Information for management of parameter-change-driven rescanning
240 *
241 * extParam includes the paramIDs of all external PARAM_EXEC params
242 * affecting this plan node or its children. setParam params from the
243 * node's initPlans are not included, but their extParams are.
244 *
245 * allParam includes all the extParam paramIDs, plus the IDs of local
246 * params that affect the node (i.e., the setParams of its initplans).
247 * These are _all_ the PARAM_EXEC params that affect this node.
248 */
252
253/* ----------------
254 * these are defined to avoid confusion problems with "left"
255 * and "right" and "inner" and "outer". The convention is that
256 * the "left" plan is the "outer" plan and the "right" plan is
257 * the inner plan, but these make the code more readable.
258 * ----------------
259 */
260#define innerPlan(node) (((Plan *)(node))->righttree)
261#define outerPlan(node) (((Plan *)(node))->lefttree)
262
263
264/* ----------------
265 * ResultType -
266 * Classification of Result nodes
267 * ----------------
268 */
269typedef enum ResultType
270{
271 RESULT_TYPE_GATING, /* project or one-time-filter outer plan */
272 RESULT_TYPE_SCAN, /* replace empty scan */
273 RESULT_TYPE_JOIN, /* replace empty join */
274 RESULT_TYPE_UPPER, /* replace degenerate upper rel */
275 RESULT_TYPE_MINMAX /* implement minmax aggregate */
277
278/* ----------------
279 * Result node -
280 * If no outer plan, evaluate a variable-free targetlist.
281 * If outer plan, return tuples from outer plan (after a level of
282 * projection as shown by targetlist).
283 *
284 * If resconstantqual isn't NULL, it represents a one-time qualification
285 * test (i.e., one that doesn't depend on any variables from the outer plan,
286 * so needs to be evaluated only once).
287 *
288 * relids identifies the relation for which this Result node is generating the
289 * tuples. When subplan is not NULL, it should be empty: this node is not
290 * generating anything in that case, just acting on tuples generated by the
291 * subplan. Otherwise, it contains the relids of the planner relation that
292 * the Result represents.
293 * ----------------
294 */
302
303/* ----------------
304 * ProjectSet node -
305 * Apply a projection that includes set-returning functions to the
306 * output tuples of the outer plan.
307 * ----------------
308 */
309typedef struct ProjectSet
310{
313
314/* ----------------
315 * ModifyTable node -
316 * Apply rows produced by outer plan to result table(s),
317 * by inserting, updating, or deleting.
318 *
319 * If the originally named target table is a partitioned table or inheritance
320 * tree, both nominalRelation and rootRelation contain the RT index of the
321 * partition root or appendrel RTE, which is not otherwise mentioned in the
322 * plan. Otherwise rootRelation is zero. However, nominalRelation will
323 * always be set, as it's the rel that EXPLAIN should claim is the
324 * INSERT/UPDATE/DELETE/MERGE target.
325 *
326 * Note that rowMarks and epqParam are presumed to be valid for all the
327 * table(s); they can't contain any info that varies across tables.
328 * ----------------
329 */
330typedef struct ModifyTable
331{
333 /* INSERT, UPDATE, DELETE, or MERGE */
335 /* do we set the command tag/es_processed? */
337 /* Parent RT index for use of EXPLAIN */
339 /* Root RT index, if partitioned/inherited */
341 /* integer list of RT indexes */
343 /* per-target-table update_colnos lists */
345 /* per-target-table WCO lists */
347 /* alias for OLD in RETURNING lists */
349 /* alias for NEW in RETURNING lists */
351 /* per-target-table RETURNING tlists */
353 /* per-target-table FDW private data lists */
355 /* indices of FDW DM plans */
357 /* PlanRowMarks (non-locking only) */
359 /* ID of Param for EvalPlanQual re-eval */
361 /* ON CONFLICT action */
363 /* List of ON CONFLICT arbiter index OIDs */
365 /* INSERT ON CONFLICT DO UPDATE targetlist */
367 /* target column numbers for onConflictSet */
369 /* WHERE for ON CONFLICT UPDATE */
371 /* RTI of the EXCLUDED pseudo relation */
373 /* tlist of the EXCLUDED pseudo relation */
375 /* per-target-table lists of actions for MERGE */
377 /* per-target-table join conditions for MERGE */
380
381struct PartitionPruneInfo; /* forward reference to struct below */
382
383/* ----------------
384 * Append node -
385 * Generate the concatenation of the results of sub-plans.
386 * ----------------
387 */
388typedef struct Append
389{
391 /* RTIs of appendrel(s) formed by this node */
394 /* # of asynchronous plans */
396
397 /*
398 * All 'appendplans' preceding this index are non-partial plans. All
399 * 'appendplans' from this index onwards are partial plans.
400 */
402
403 /*
404 * Index into PlannedStmt.partPruneInfos and parallel lists in EState:
405 * es_part_prune_states and es_part_prune_results. Set to -1 if no
406 * run-time pruning is used.
407 */
410
411/* ----------------
412 * MergeAppend node -
413 * Merge the results of pre-sorted sub-plans to preserve the ordering.
414 * ----------------
415 */
416typedef struct MergeAppend
417{
419
420 /* RTIs of appendrel(s) formed by this node */
422
424
425 /* these fields are just like the sort-key info in struct Sort: */
426
427 /* number of sort-key columns */
429
430 /* their indexes in the target list */
432
433 /* OIDs of operators to sort them by */
435
436 /* OIDs of collations */
438
439 /* NULLS FIRST/LAST directions */
441
442 /*
443 * Index into PlannedStmt.partPruneInfos and parallel lists in EState:
444 * es_part_prune_states and es_part_prune_results. Set to -1 if no
445 * run-time pruning is used.
446 */
449
450/* ----------------
451 * RecursiveUnion node -
452 * Generate a recursive union of two subplans.
453 *
454 * The "outer" subplan is always the non-recursive term, and the "inner"
455 * subplan is the recursive term.
456 * ----------------
457 */
458typedef struct RecursiveUnion
459{
461
462 /* ID of Param representing work table */
464
465 /* Remaining fields are zero/null in UNION ALL case */
466
467 /* number of columns to check for duplicate-ness */
469
470 /* their indexes in the target list */
472
473 /* equality operators to compare with */
476
477 /* estimated number of groups in input */
480
481/* ----------------
482 * BitmapAnd node -
483 * Generate the intersection of the results of sub-plans.
484 *
485 * The subplans must be of types that yield tuple bitmaps. The targetlist
486 * and qual fields of the plan are unused and are always NIL.
487 * ----------------
488 */
494
495/* ----------------
496 * BitmapOr node -
497 * Generate the union of the results of sub-plans.
498 *
499 * The subplans must be of types that yield tuple bitmaps. The targetlist
500 * and qual fields of the plan are unused and are always NIL.
501 * ----------------
502 */
509
510/*
511 * ==========
512 * Scan nodes
513 *
514 * Scan is an abstract type that all relation scan plan types inherit from.
515 * ==========
516 */
517typedef struct Scan
518{
520
521 Plan plan;
522 /* relid is index into the range table */
525
526/* ----------------
527 * sequential scan node
528 * ----------------
529 */
530typedef struct SeqScan
531{
534
535/* ----------------
536 * table sample scan node
537 * ----------------
538 */
539typedef struct SampleScan
540{
542 /* use struct pointer to avoid including parsenodes.h here */
545
546/* ----------------
547 * index scan node
548 *
549 * indexqualorig is an implicitly-ANDed list of index qual expressions, each
550 * in the same form it appeared in the query WHERE condition. Each should
551 * be of the form (indexkey OP comparisonval) or (comparisonval OP indexkey).
552 * The indexkey is a Var or expression referencing column(s) of the index's
553 * base table. The comparisonval might be any expression, but it won't use
554 * any columns of the base table. The expressions are ordered by index
555 * column position (but items referencing the same index column can appear
556 * in any order). indexqualorig is used at runtime only if we have to recheck
557 * a lossy indexqual.
558 *
559 * indexqual has the same form, but the expressions have been commuted if
560 * necessary to put the indexkeys on the left, and the indexkeys are replaced
561 * by Var nodes identifying the index columns (their varno is INDEX_VAR and
562 * their varattno is the index column number).
563 *
564 * indexorderbyorig is similarly the original form of any ORDER BY expressions
565 * that are being implemented by the index, while indexorderby is modified to
566 * have index column Vars on the left-hand side. Here, multiple expressions
567 * must appear in exactly the ORDER BY order, and this is not necessarily the
568 * index column order. Only the expressions are provided, not the auxiliary
569 * sort-order information from the ORDER BY SortGroupClauses; it's assumed
570 * that the sort ordering is fully determinable from the top-level operators.
571 * indexorderbyorig is used at runtime to recheck the ordering, if the index
572 * cannot calculate an accurate ordering. It is also needed for EXPLAIN.
573 *
574 * indexorderbyops is a list of the OIDs of the operators used to sort the
575 * ORDER BY expressions. This is used together with indexorderbyorig to
576 * recheck ordering at run time. (Note that indexorderby, indexorderbyorig,
577 * and indexorderbyops are used for amcanorderbyop cases, not amcanorder.)
578 *
579 * indexorderdir specifies the scan ordering, for indexscans on amcanorder
580 * indexes (for other indexes it should be "don't care").
581 * ----------------
582 */
583typedef struct IndexScan
584{
586 /* OID of index to scan */
588 /* list of index quals (usually OpExprs) */
590 /* the same in original form */
592 /* list of index ORDER BY exprs */
594 /* the same in original form */
596 /* OIDs of sort ops for ORDER BY exprs */
598 /* forward or backward or don't care */
601
602/* ----------------
603 * index-only scan node
604 *
605 * IndexOnlyScan is very similar to IndexScan, but it specifies an
606 * index-only scan, in which the data comes from the index not the heap.
607 * Because of this, *all* Vars in the plan node's targetlist, qual, and
608 * index expressions reference index columns and have varno = INDEX_VAR.
609 *
610 * We could almost use indexqual directly against the index's output tuple
611 * when rechecking lossy index operators, but that won't work for quals on
612 * index columns that are not retrievable. Hence, recheckqual is needed
613 * for rechecks: it expresses the same condition as indexqual, but using
614 * only index columns that are retrievable. (We will not generate an
615 * index-only scan if this is not possible. An example is that if an
616 * index has table column "x" in a retrievable index column "ind1", plus
617 * an expression f(x) in a non-retrievable column "ind2", an indexable
618 * query on f(x) will use "ind2" in indexqual and f(ind1) in recheckqual.
619 * Without the "ind1" column, an index-only scan would be disallowed.)
620 *
621 * We don't currently need a recheckable equivalent of indexorderby,
622 * because we don't support lossy operators in index ORDER BY.
623 *
624 * To help EXPLAIN interpret the index Vars for display, we provide
625 * indextlist, which represents the contents of the index as a targetlist
626 * with one TLE per index column. Vars appearing in this list reference
627 * the base table, and this is the only field in the plan node that may
628 * contain such Vars. Also, for the convenience of setrefs.c, TLEs in
629 * indextlist are marked as resjunk if they correspond to columns that
630 * the index AM cannot reconstruct.
631 * ----------------
632 */
633typedef struct IndexOnlyScan
634{
636 /* OID of index to scan */
638 /* list of index quals (usually OpExprs) */
640 /* index quals in recheckable form */
642 /* list of index ORDER BY exprs */
644 /* TargetEntry list describing index's cols */
646 /* forward or backward or don't care */
649
650/* ----------------
651 * bitmap index scan node
652 *
653 * BitmapIndexScan delivers a bitmap of potential tuple locations;
654 * it does not access the heap itself. The bitmap is used by an
655 * ancestor BitmapHeapScan node, possibly after passing through
656 * intermediate BitmapAnd and/or BitmapOr nodes to combine it with
657 * the results of other BitmapIndexScans.
658 *
659 * The fields have the same meanings as for IndexScan, except we don't
660 * store a direction flag because direction is uninteresting.
661 *
662 * In a BitmapIndexScan plan node, the targetlist and qual fields are
663 * not used and are always NIL. The indexqualorig field is unused at
664 * run time too, but is saved for the benefit of EXPLAIN.
665 * ----------------
666 */
667typedef struct BitmapIndexScan
668{
670 /* OID of index to scan */
672 /* Create shared bitmap if set */
674 /* list of index quals (OpExprs) */
676 /* the same in original form */
679
680/* ----------------
681 * bitmap sequential scan node
682 *
683 * This needs a copy of the qual conditions being used by the input index
684 * scans because there are various cases where we need to recheck the quals;
685 * for example, when the bitmap is lossy about the specific rows on a page
686 * that meet the index condition.
687 * ----------------
688 */
689typedef struct BitmapHeapScan
690{
692 /* index quals, in standard expr form */
695
696/* ----------------
697 * tid scan node
698 *
699 * tidquals is an implicitly OR'ed list of qual expressions of the form
700 * "CTID = pseudoconstant", or "CTID = ANY(pseudoconstant_array)",
701 * or a CurrentOfExpr for the relation.
702 * ----------------
703 */
704typedef struct TidScan
705{
707 /* qual(s) involving CTID = something */
710
711/* ----------------
712 * tid range scan node
713 *
714 * tidrangequals is an implicitly AND'ed list of qual expressions of the form
715 * "CTID relop pseudoconstant", where relop is one of >,>=,<,<=.
716 * ----------------
717 */
718typedef struct TidRangeScan
719{
721 /* qual(s) involving CTID op something */
724
725/* ----------------
726 * subquery scan node
727 *
728 * SubqueryScan is for scanning the output of a sub-query in the range table.
729 * We often need an extra plan node above the sub-query's plan to perform
730 * expression evaluations (which we can't push into the sub-query without
731 * risking changing its semantics). Although we are not scanning a physical
732 * relation, we make this a descendant of Scan anyway for code-sharing
733 * purposes.
734 *
735 * SubqueryScanStatus caches the trivial_subqueryscan property of the node.
736 * SUBQUERY_SCAN_UNKNOWN means not yet determined. This is only used during
737 * planning.
738 *
739 * Note: we store the sub-plan in the type-specific subplan field, not in
740 * the generic lefttree field as you might expect. This is because we do
741 * not want plan-tree-traversal routines to recurse into the subplan without
742 * knowing that they are changing Query contexts.
743 * ----------------
744 */
751
758
759/* ----------------
760 * FunctionScan node
761 * ----------------
762 */
763typedef struct FunctionScan
764{
766 /* list of RangeTblFunction nodes */
768 /* WITH ORDINALITY */
771
772/* ----------------
773 * ValuesScan node
774 * ----------------
775 */
776typedef struct ValuesScan
777{
779 /* list of expression lists */
782
783/* ----------------
784 * TableFunc scan node
785 * ----------------
786 */
787typedef struct TableFuncScan
788{
790 /* table function node */
793
794/* ----------------
795 * CteScan node
796 * ----------------
797 */
798typedef struct CteScan
799{
801 /* ID of init SubPlan for CTE */
803 /* ID of Param representing CTE output */
806
807/* ----------------
808 * NamedTuplestoreScan node
809 * ----------------
810 */
812{
814 /* Name given to Ephemeral Named Relation */
815 char *enrname;
817
818/* ----------------
819 * WorkTableScan node
820 * ----------------
821 */
822typedef struct WorkTableScan
823{
825 /* ID of Param representing work table */
828
829/* ----------------
830 * ForeignScan node
831 *
832 * fdw_exprs and fdw_private are both under the control of the foreign-data
833 * wrapper, but fdw_exprs is presumed to contain expression trees and will
834 * be post-processed accordingly by the planner; fdw_private won't be.
835 * Note that everything in both lists must be copiable by copyObject().
836 * One way to store an arbitrary blob of bytes is to represent it as a bytea
837 * Const. Usually, though, you'll be better off choosing a representation
838 * that can be dumped usefully by nodeToString().
839 *
840 * fdw_scan_tlist is a targetlist describing the contents of the scan tuple
841 * returned by the FDW; it can be NIL if the scan tuple matches the declared
842 * rowtype of the foreign table, which is the normal case for a simple foreign
843 * table scan. (If the plan node represents a foreign join, fdw_scan_tlist
844 * is required since there is no rowtype available from the system catalogs.)
845 * When fdw_scan_tlist is provided, Vars in the node's tlist and quals must
846 * have varno INDEX_VAR, and their varattnos correspond to resnos in the
847 * fdw_scan_tlist (which are also column numbers in the actual scan tuple).
848 * fdw_scan_tlist is never actually executed; it just holds expression trees
849 * describing what is in the scan tuple's columns.
850 *
851 * fdw_recheck_quals should contain any quals which the core system passed to
852 * the FDW but which were not added to scan.plan.qual; that is, it should
853 * contain the quals being checked remotely. This is needed for correct
854 * behavior during EvalPlanQual rechecks.
855 *
856 * When the plan node represents a foreign join, scan.scanrelid is zero and
857 * fs_relids must be consulted to identify the join relation. (fs_relids
858 * is valid for simple scans as well, but will always match scan.scanrelid.)
859 * fs_relids includes outer joins; fs_base_relids does not.
860 *
861 * If the FDW's PlanDirectModify() callback decides to repurpose a ForeignScan
862 * node to perform the UPDATE or DELETE operation directly in the remote
863 * server, it sets 'operation' and 'resultRelation' to identify the operation
864 * type and target relation. Note that these fields are only set if the
865 * modification is performed *fully* remotely; otherwise, the modification is
866 * driven by a local ModifyTable node and 'operation' is left to CMD_SELECT.
867 * ----------------
868 */
869typedef struct ForeignScan
870{
872 /* SELECT/INSERT/UPDATE/DELETE */
874 /* direct modification target's RT index */
876 /* user to perform the scan as; 0 means to check as current user */
878 /* OID of foreign server */
880 /* expressions that FDW may evaluate */
882 /* private data for FDW */
884 /* optional tlist describing scan tuple */
886 /* original quals not in scan.plan.qual */
888 /* base+OJ RTIs generated by this scan */
890 /* base RTIs generated by this scan */
892 /* true if any "system column" is needed */
895
896/* ----------------
897 * CustomScan node
898 *
899 * The comments for ForeignScan's fdw_exprs, fdw_private, fdw_scan_tlist,
900 * and fs_relids fields apply equally to CustomScan's custom_exprs,
901 * custom_private, custom_scan_tlist, and custom_relids fields. The
902 * convention of setting scan.scanrelid to zero for joins applies as well.
903 *
904 * Note that since Plan trees can be copied, custom scan providers *must*
905 * fit all plan data they need into those fields; embedding CustomScan in
906 * a larger struct will not work.
907 * ----------------
908 */
909struct CustomScanMethods;
910
911typedef struct CustomScan
912{
914 /* mask of CUSTOMPATH_* flags, see nodes/extensible.h */
916 /* list of Plan nodes, if any */
918 /* expressions that custom code may evaluate */
920 /* private data for custom code */
922 /* optional tlist describing scan tuple */
924 /* RTIs generated by this scan */
926
927 /*
928 * NOTE: The method field of CustomScan is required to be a pointer to a
929 * static table of callback functions. So we don't copy the table itself,
930 * just reference the original one.
931 */
934
935/*
936 * ==========
937 * Join nodes
938 * ==========
939 */
940
941/* ----------------
942 * Join node
943 *
944 * jointype: rule for joining tuples from left and right subtrees
945 * inner_unique each outer tuple can match to no more than one inner tuple
946 * joinqual: qual conditions that came from JOIN/ON or JOIN/USING
947 * (plan.qual contains conditions that came from WHERE)
948 *
949 * When jointype is INNER, joinqual and plan.qual are semantically
950 * interchangeable. For OUTER jointypes, the two are *not* interchangeable;
951 * only joinqual is used to determine whether a match has been found for
952 * the purpose of deciding whether to generate null-extended tuples.
953 * (But plan.qual is still applied before actually returning a tuple.)
954 * For an outer join, only joinquals are allowed to be used as the merge
955 * or hash condition of a merge or hash join.
956 *
957 * inner_unique is set if the joinquals are such that no more than one inner
958 * tuple could match any given outer tuple. This allows the executor to
959 * skip searching for additional matches. (This must be provable from just
960 * the joinquals, ignoring plan.qual, due to where the executor tests it.)
961 * ----------------
962 */
963typedef struct Join
964{
966
967 Plan plan;
970 /* JOIN quals (in addition to plan.qual) */
973
974/* ----------------
975 * nest loop join node
976 *
977 * The nestParams list identifies any executor Params that must be passed
978 * into execution of the inner subplan carrying values from the current row
979 * of the outer subplan. Currently we restrict these values to be simple
980 * Vars, but perhaps someday that'd be worth relaxing. (Note: during plan
981 * creation, the paramval can actually be a PlaceHolderVar expression; but it
982 * must be a Var with varno OUTER_VAR by the time it gets to the executor.)
983 * ----------------
984 */
985typedef struct NestLoop
986{
988 /* list of NestLoopParam nodes */
991
992typedef struct NestLoopParam
993{
995
997 /* number of the PARAM_EXEC Param to set */
999 /* outer-relation Var to assign to Param */
1002
1003/* ----------------
1004 * merge join node
1005 *
1006 * The expected ordering of each mergeable column is described by a btree
1007 * opfamily OID, a collation OID, a direction (BTLessStrategyNumber or
1008 * BTGreaterStrategyNumber) and a nulls-first flag. Note that the two sides
1009 * of each mergeclause may be of different datatypes, but they are ordered the
1010 * same way according to the common opfamily and collation. The operator in
1011 * each mergeclause must be an equality operator of the indicated opfamily.
1012 * ----------------
1013 */
1014typedef struct MergeJoin
1015{
1017
1018 /* Can we skip mark/restore calls? */
1020
1021 /* mergeclauses as expression trees */
1023
1024 /* these are arrays, but have the same length as the mergeclauses list: */
1025
1026 /* per-clause OIDs of btree opfamilies */
1028
1029 /* per-clause OIDs of collations */
1031
1032 /* per-clause ordering (ASC or DESC) */
1034
1035 /* per-clause nulls ordering */
1038
1039/* ----------------
1040 * hash join node
1041 * ----------------
1042 */
1043typedef struct HashJoin
1044{
1049
1050 /*
1051 * List of expressions to be hashed for tuples from the outer plan, to
1052 * perform lookups in the hashtable over the inner plan.
1053 */
1056
1057/* ----------------
1058 * materialization node
1059 * ----------------
1060 */
1061typedef struct Material
1062{
1065
1066/* ----------------
1067 * memoize node
1068 * ----------------
1069 */
1070typedef struct Memoize
1071{
1073
1074 /* size of the two arrays below */
1076
1077 /* hash operators for each key */
1079
1080 /* collations for each key */
1082
1083 /* cache keys in the form of exprs containing parameters */
1085
1086 /*
1087 * true if the cache entry should be marked as complete after we store the
1088 * first tuple in it.
1089 */
1091
1092 /*
1093 * true when cache key should be compared bit by bit, false when using
1094 * hash equality ops
1095 */
1097
1098 /*
1099 * The maximum number of entries that the planner expects will fit in the
1100 * cache, or 0 if unknown
1101 */
1103
1104 /* paramids from param_exprs */
1106
1107 /* Estimated number of rescans, for EXPLAIN */
1109
1110 /* Estimated number of distinct lookup keys, for EXPLAIN */
1112
1113 /* Estimated cache hit ratio, for EXPLAIN */
1115
1117
1118/* ----------------
1119 * sort node
1120 * ----------------
1121 */
1122typedef struct Sort
1123{
1125
1126 /* number of sort-key columns */
1128
1129 /* their indexes in the target list */
1131
1132 /* OIDs of operators to sort them by */
1134
1135 /* OIDs of collations */
1137
1138 /* NULLS FIRST/LAST directions */
1141
1142/* ----------------
1143 * incremental sort node
1144 * ----------------
1145 */
1146typedef struct IncrementalSort
1147{
1149 /* number of presorted columns */
1152
1153/* ---------------
1154 * group node -
1155 * Used for queries with GROUP BY (but no aggregates) specified.
1156 * The input must be presorted according to the grouping columns.
1157 * ---------------
1158 */
1159typedef struct Group
1160{
1162
1163 /* number of grouping columns */
1165
1166 /* their indexes in the target list */
1168
1169 /* equality operators to compare with */
1173
1174/* ---------------
1175 * aggregate node
1176 *
1177 * An Agg node implements plain or grouped aggregation. For grouped
1178 * aggregation, we can work with presorted input or unsorted input;
1179 * the latter strategy uses an internal hashtable.
1180 *
1181 * Notice the lack of any direct info about the aggregate functions to be
1182 * computed. They are found by scanning the node's tlist and quals during
1183 * executor startup. (It is possible that there are no aggregate functions;
1184 * this could happen if they get optimized away by constant-folding, or if
1185 * we are using the Agg node to implement hash-based grouping.)
1186 * ---------------
1187 */
1188typedef struct Agg
1189{
1191
1192 /* basic strategy, see nodes.h */
1194
1195 /* agg-splitting mode, see nodes.h */
1197
1198 /* number of grouping columns */
1200
1201 /* their indexes in the target list */
1203
1204 /* equality operators to compare with */
1207
1208 /* estimated number of groups in input */
1210
1211 /* for pass-by-ref transition data */
1213
1214 /* IDs of Params used in Aggref inputs */
1216
1217 /* Note: planner provides numGroups & aggParams only in HASHED/MIXED case */
1218
1219 /* grouping sets to use */
1221
1222 /* chained Agg/Sort nodes */
1225
1226/* ----------------
1227 * window aggregate node
1228 * ----------------
1229 */
1230typedef struct WindowAgg
1231{
1233
1234 /* name of WindowClause implemented by this node */
1235 char *winname;
1236
1237 /* ID referenced by window functions */
1239
1240 /* number of columns in partition clause */
1242
1243 /* their indexes in the target list */
1245
1246 /* equality operators for partition columns */
1248
1249 /* collations for partition columns */
1251
1252 /* number of columns in ordering clause */
1254
1255 /* their indexes in the target list */
1257
1258 /* equality operators for ordering columns */
1260
1261 /* collations for ordering columns */
1263
1264 /* frame_clause options, see WindowDef */
1266
1267 /* expression for starting bound, if any */
1269
1270 /* expression for ending bound, if any */
1272
1273 /* qual to help short-circuit execution */
1275
1276 /* runCondition for display in EXPLAIN */
1278
1279 /* these fields are used with RANGE offset PRECEDING/FOLLOWING: */
1280
1281 /* in_range function for startOffset */
1283
1284 /* in_range function for endOffset */
1286
1287 /* collation for in_range tests */
1289
1290 /* use ASC sort order for in_range tests? */
1292
1293 /* nulls sort first for in_range tests? */
1295
1296 /*
1297 * false for all apart from the WindowAgg that's closest to the root of
1298 * the plan
1299 */
1302
1303/* ----------------
1304 * unique node
1305 * ----------------
1306 */
1307typedef struct Unique
1308{
1310
1311 /* number of columns to check for uniqueness */
1313
1314 /* their indexes in the target list */
1316
1317 /* equality operators to compare with */
1319
1320 /* collations for equality comparisons */
1323
1324/* ------------
1325 * gather node
1326 *
1327 * Note: rescan_param is the ID of a PARAM_EXEC parameter slot. That slot
1328 * will never actually contain a value, but the Gather node must flag it as
1329 * having changed whenever it is rescanned. The child parallel-aware scan
1330 * nodes are marked as depending on that parameter, so that the rescan
1331 * machinery is aware that their output is likely to change across rescans.
1332 * In some cases we don't need a rescan Param, so rescan_param is set to -1.
1333 * ------------
1334 */
1335typedef struct Gather
1336{
1338 /* planned number of worker processes */
1340 /* ID of Param that signals a rescan, or -1 */
1342 /* don't execute plan more than once */
1344 /* suppress EXPLAIN display (for testing)? */
1346
1347 /*
1348 * param id's of initplans which are referred at gather or one of its
1349 * child nodes
1350 */
1353
1354/* ------------
1355 * gather merge node
1356 * ------------
1357 */
1358typedef struct GatherMerge
1359{
1361
1362 /* planned number of worker processes */
1364
1365 /* ID of Param that signals a rescan, or -1 */
1367
1368 /* remaining fields are just like the sort-key info in struct Sort */
1369
1370 /* number of sort-key columns */
1372
1373 /* their indexes in the target list */
1375
1376 /* OIDs of operators to sort them by */
1378
1379 /* OIDs of collations */
1381
1382 /* NULLS FIRST/LAST directions */
1384
1385 /*
1386 * param id's of initplans which are referred at gather merge or one of
1387 * its child nodes
1388 */
1391
1392/* ----------------
1393 * hash build node
1394 *
1395 * If the executor is supposed to try to apply skew join optimization, then
1396 * skewTable/skewColumn/skewInherit identify the outer relation's join key
1397 * column, from which the relevant MCV statistics can be fetched.
1398 * ----------------
1399 */
1400typedef struct Hash
1401{
1403
1404 /*
1405 * List of expressions to be hashed for tuples from Hash's outer plan,
1406 * needed to put them into the hashtable.
1407 */
1408 /* hash keys for the hashjoin condition */
1410 /* outer join key's table OID, or InvalidOid */
1412 /* outer join key's column #, or zero */
1414 /* is outer join rel an inheritance tree? */
1416 /* all other info is in the parent HashJoin node */
1417 /* estimate total rows if parallel_aware */
1420
1421/* ----------------
1422 * setop node
1423 * ----------------
1424 */
1425typedef struct SetOp
1426{
1428
1429 /* what to do, see nodes.h */
1431
1432 /* how to do it, see nodes.h */
1434
1435 /* number of columns to compare */
1437
1438 /* their indexes in the target list */
1440
1441 /* comparison operators (either equality operators or sort operators) */
1444
1445 /* nulls-first flags if sorting, otherwise not interesting */
1447
1448 /* estimated number of groups in left input */
1451
1452/* ----------------
1453 * lock-rows node
1454 *
1455 * rowMarks identifies the rels to be locked by this node; it should be
1456 * a subset of the rowMarks listed in the top-level PlannedStmt.
1457 * epqParam is a Param that all scan nodes below this one must depend on.
1458 * It is used to force re-evaluation of the plan during EvalPlanQual.
1459 * ----------------
1460 */
1461typedef struct LockRows
1462{
1464 /* a list of PlanRowMark's */
1466 /* ID of Param for EvalPlanQual re-eval */
1469
1470/* ----------------
1471 * limit node
1472 *
1473 * Note: as of Postgres 8.2, the offset and count expressions are expected
1474 * to yield int8, rather than int4 as before.
1475 * ----------------
1476 */
1477typedef struct Limit
1478{
1480
1481 /* OFFSET parameter, or NULL if none */
1483
1484 /* COUNT parameter, or NULL if none */
1486
1487 /* limit type */
1489
1490 /* number of columns to check for similarity */
1492
1493 /* their indexes in the target list */
1495
1496 /* equality operators to compare with */
1498
1499 /* collations for equality comparisons */
1502
1503
1504/*
1505 * RowMarkType -
1506 * enums for types of row-marking operations
1507 *
1508 * The first four of these values represent different lock strengths that
1509 * we can take on tuples according to SELECT FOR [KEY] UPDATE/SHARE requests.
1510 * We support these on regular tables, as well as on foreign tables whose FDWs
1511 * report support for late locking. For other foreign tables, any locking
1512 * that might be done for such requests must happen during the initial row
1513 * fetch; their FDWs provide no mechanism for going back to lock a row later.
1514 * This means that the semantics will be a bit different than for a local
1515 * table; in particular we are likely to lock more rows than would be locked
1516 * locally, since remote rows will be locked even if they then fail
1517 * locally-checked restriction or join quals. However, the prospect of
1518 * doing a separate remote query to lock each selected row is usually pretty
1519 * unappealing, so early locking remains a credible design choice for FDWs.
1520 *
1521 * When doing UPDATE/DELETE/MERGE/SELECT FOR UPDATE/SHARE, we have to uniquely
1522 * identify all the source rows, not only those from the target relations, so
1523 * that we can perform EvalPlanQual rechecking at need. For plain tables we
1524 * can just fetch the TID, much as for a target relation; this case is
1525 * represented by ROW_MARK_REFERENCE. Otherwise (for example for VALUES or
1526 * FUNCTION scans) we have to copy the whole row value. ROW_MARK_COPY is
1527 * pretty inefficient, since most of the time we'll never need the data; but
1528 * fortunately the overhead is usually not performance-critical in practice.
1529 * By default we use ROW_MARK_COPY for foreign tables, but if the FDW has
1530 * a concept of rowid it can request to use ROW_MARK_REFERENCE instead.
1531 * (Again, this probably doesn't make sense if a physical remote fetch is
1532 * needed, but for FDWs that map to local storage it might be credible.)
1533 */
1534typedef enum RowMarkType
1535{
1536 ROW_MARK_EXCLUSIVE, /* obtain exclusive tuple lock */
1537 ROW_MARK_NOKEYEXCLUSIVE, /* obtain no-key exclusive tuple lock */
1538 ROW_MARK_SHARE, /* obtain shared tuple lock */
1539 ROW_MARK_KEYSHARE, /* obtain keyshare tuple lock */
1540 ROW_MARK_REFERENCE, /* just fetch the TID, don't lock it */
1541 ROW_MARK_COPY, /* physically copy the row value */
1543
1544#define RowMarkRequiresRowShareLock(marktype) ((marktype) <= ROW_MARK_KEYSHARE)
1545
1546/*
1547 * PlanRowMark -
1548 * plan-time representation of FOR [KEY] UPDATE/SHARE clauses
1549 *
1550 * When doing UPDATE/DELETE/MERGE/SELECT FOR UPDATE/SHARE, we create a separate
1551 * PlanRowMark node for each non-target relation in the query. Relations that
1552 * are not specified as FOR UPDATE/SHARE are marked ROW_MARK_REFERENCE (if
1553 * regular tables or supported foreign tables) or ROW_MARK_COPY (if not).
1554 *
1555 * Initially all PlanRowMarks have rti == prti and isParent == false.
1556 * When the planner discovers that a relation is the root of an inheritance
1557 * tree, it sets isParent true, and adds an additional PlanRowMark to the
1558 * list for each child relation (including the target rel itself in its role
1559 * as a child, if it is not a partitioned table). Any non-leaf partitioned
1560 * child relations will also have entries with isParent = true. The child
1561 * entries have rti == child rel's RT index and prti == top parent's RT index,
1562 * and can therefore be recognized as children by the fact that prti != rti.
1563 * The parent's allMarkTypes field gets the OR of (1<<markType) across all
1564 * its children (this definition allows children to use different markTypes).
1565 *
1566 * The planner also adds resjunk output columns to the plan that carry
1567 * information sufficient to identify the locked or fetched rows. When
1568 * markType != ROW_MARK_COPY, these columns are named
1569 * tableoid%u OID of table
1570 * ctid%u TID of row
1571 * The tableoid column is only present for an inheritance hierarchy.
1572 * When markType == ROW_MARK_COPY, there is instead a single column named
1573 * wholerow%u whole-row value of relation
1574 * (An inheritance hierarchy could have all three resjunk output columns,
1575 * if some children use a different markType than others.)
1576 * In all three cases, %u represents the rowmark ID number (rowmarkId).
1577 * This number is unique within a plan tree, except that child relation
1578 * entries copy their parent's rowmarkId. (Assigning unique numbers
1579 * means we needn't renumber rowmarkIds when flattening subqueries, which
1580 * would require finding and renaming the resjunk columns as well.)
1581 * Note this means that all tables in an inheritance hierarchy share the
1582 * same resjunk column names.
1583 */
1584typedef struct PlanRowMark
1585{
1587
1588 NodeTag type;
1589 /* range table index of markable relation */
1591 /* range table index of parent relation */
1593 /* unique identifier for resjunk columns */
1595 /* see enum above */
1597 /* OR of (1<<markType) for all children */
1599 /* LockingClause's strength, or LCS_NONE */
1601 /* NOWAIT and SKIP LOCKED options */
1603 /* true if this is a "dummy" parent entry */
1606
1607
1608/*
1609 * Node types to represent partition pruning information.
1610 */
1611
1612/*
1613 * PartitionPruneInfo - Details required to allow the executor to prune
1614 * partitions.
1615 *
1616 * Here we store mapping details to allow translation of a partitioned table's
1617 * index as returned by the partition pruning code into subplan indexes for
1618 * plan types which support arbitrary numbers of subplans, such as Append.
1619 * We also store various details to tell the executor when it should be
1620 * performing partition pruning.
1621 *
1622 * Each PartitionedRelPruneInfo describes the partitioning rules for a single
1623 * partitioned table (a/k/a level of partitioning). Since a partitioning
1624 * hierarchy could contain multiple levels, we represent it by a List of
1625 * PartitionedRelPruneInfos, where the first entry represents the topmost
1626 * partitioned table and additional entries represent non-leaf child
1627 * partitions, ordered such that parents appear before their children.
1628 * Then, since an Append-type node could have multiple partitioning
1629 * hierarchies among its children, we have an unordered List of those Lists.
1630 *
1631 * relids RelOptInfo.relids of the parent plan node (e.g. Append
1632 * or MergeAppend) to which this PartitionPruneInfo node
1633 * belongs. The pruning logic ensures that this matches
1634 * the parent plan node's apprelids.
1635 * prune_infos List of Lists containing PartitionedRelPruneInfo nodes,
1636 * one sublist per run-time-prunable partition hierarchy
1637 * appearing in the parent plan node's subplans.
1638 * other_subplans Indexes of any subplans that are not accounted for
1639 * by any of the PartitionedRelPruneInfo nodes in
1640 * "prune_infos". These subplans must not be pruned.
1641 */
1651
1652/*
1653 * PartitionedRelPruneInfo - Details required to allow the executor to prune
1654 * partitions for a single partitioned table.
1655 *
1656 * subplan_map[], subpart_map[], and leafpart_rti_map[] are indexed by partition
1657 * index of the partitioned table referenced by 'rtindex', the partition index
1658 * being the order that the partitions are defined in the table's
1659 * PartitionDesc. For a leaf partition p, subplan_map[p] contains the
1660 * zero-based index of the partition's subplan in the parent plan's subplan
1661 * list; it is -1 if the partition is non-leaf or has been pruned. For a
1662 * non-leaf partition p, subpart_map[p] contains the zero-based index of that
1663 * sub-partition's PartitionedRelPruneInfo in the hierarchy's
1664 * PartitionedRelPruneInfo list; it is -1 if the partition is a leaf or has
1665 * been pruned. leafpart_rti_map[p] contains the RT index of a leaf partition
1666 * if its subplan is in the parent plan' subplan list; it is 0 either if the
1667 * partition is non-leaf or it is leaf but has been pruned during planning.
1668 * Note that subplan indexes, as stored in 'subplan_map', are global across the
1669 * parent plan node, but partition indexes are valid only within a particular
1670 * hierarchy. relid_map[p] contains the partition's OID, or 0 if the partition
1671 * was pruned.
1672 */
1674{
1676
1677 NodeTag type;
1678
1679 /* RT index of partition rel for this level */
1681
1682 /* Indexes of all partitions which subplans or subparts are present for */
1684
1685 /* Length of the following arrays: */
1687
1688 /* subplan index by partition index, or -1 */
1689 int *subplan_map pg_node_attr(array_size(nparts));
1690
1691 /* subpart index by partition index, or -1 */
1692 int *subpart_map pg_node_attr(array_size(nparts));
1693
1694 /* RT index by partition index, or 0 */
1695 int *leafpart_rti_map pg_node_attr(array_size(nparts));
1696
1697 /* relation OID by partition index, or 0 */
1699
1700 /*
1701 * initial_pruning_steps shows how to prune during executor startup (i.e.,
1702 * without use of any PARAM_EXEC Params); it is NIL if no startup pruning
1703 * is required. exec_pruning_steps shows how to prune with PARAM_EXEC
1704 * Params; it is NIL if no per-scan pruning is required.
1705 */
1706 /* List of PartitionPruneStep */
1708 /* List of PartitionPruneStep */
1710
1711 /* All PARAM_EXEC Param IDs in exec_pruning_steps */
1714
1715/*
1716 * Abstract Node type for partition pruning steps (there are no concrete
1717 * Nodes of this type).
1718 *
1719 * step_id is the global identifier of the step within its pruning context.
1720 */
1728
1729/*
1730 * PartitionPruneStepOp - Information to prune using a set of mutually ANDed
1731 * OpExpr clauses
1732 *
1733 * This contains information extracted from up to partnatts OpExpr clauses,
1734 * where partnatts is the number of partition key columns. 'opstrategy' is the
1735 * strategy of the operator in the clause matched to the last partition key.
1736 * 'exprs' contains expressions which comprise the lookup key to be passed to
1737 * the partition bound search function. 'cmpfns' contains the OIDs of
1738 * comparison functions used to compare aforementioned expressions with
1739 * partition bounds. Both 'exprs' and 'cmpfns' contain the same number of
1740 * items, up to partnatts items.
1741 *
1742 * Once we find the offset of a partition bound using the lookup key, we
1743 * determine which partitions to include in the result based on the value of
1744 * 'opstrategy'. For example, if it were equality, we'd return just the
1745 * partition that would contain that key or a set of partitions if the key
1746 * didn't consist of all partitioning columns. For non-equality strategies,
1747 * we'd need to include other partitions as appropriate.
1748 *
1749 * 'nullkeys' is the set containing the offset of the partition keys (0 to
1750 * partnatts - 1) that were matched to an IS NULL clause. This is only
1751 * considered for hash partitioning as we need to pass which keys are null
1752 * to the hash partition bound search function. It is never possible to
1753 * have an expression be present in 'exprs' for a given partition key and
1754 * the corresponding bit set in 'nullkeys'.
1755 */
1765
1766/*
1767 * PartitionPruneStepCombine - Information to prune using a BoolExpr clause
1768 *
1769 * For BoolExpr clauses, we combine the set of partitions determined for each
1770 * of the argument clauses.
1771 */
1777
1785
1786
1787/*
1788 * Plan invalidation info
1789 *
1790 * We track the objects on which a PlannedStmt depends in two ways:
1791 * relations are recorded as a simple list of OIDs, and everything else
1792 * is represented as a list of PlanInvalItems. A PlanInvalItem is designed
1793 * to be used with the syscache invalidation mechanism, so it identifies a
1794 * system catalog entry by cache ID and hash value.
1795 */
1796typedef struct PlanInvalItem
1797{
1799
1800 NodeTag type;
1801 /* a syscache ID, see utils/syscache.h */
1803 /* hash value of object's cache lookup key */
1806
1807/*
1808 * MonotonicFunction
1809 *
1810 * Allows the planner to track monotonic properties of functions. A function
1811 * is monotonically increasing if a subsequent call cannot yield a lower value
1812 * than the previous call. A monotonically decreasing function cannot yield a
1813 * higher value on subsequent calls, and a function which is both must return
1814 * the same value on each call.
1815 */
1823
1824#endif /* PLANNODES_H */
int16 AttrNumber
Definition attnum.h:21
int64_t int64
Definition c.h:543
uint64_t uint64
Definition c.h:547
uint32_t uint32
Definition c.h:546
unsigned int Index
Definition c.h:628
LockWaitPolicy
Definition lockoptions.h:37
LockClauseStrength
Definition lockoptions.h:22
SetOpCmd
Definition nodes.h:407
SetOpStrategy
Definition nodes.h:415
double Cost
Definition nodes.h:261
OnConflictAction
Definition nodes.h:427
double Cardinality
Definition nodes.h:262
CmdType
Definition nodes.h:273
AggStrategy
Definition nodes.h:363
NodeTag
Definition nodes.h:27
AggSplit
Definition nodes.h:385
LimitOption
Definition nodes.h:440
int ParseLoc
Definition nodes.h:250
JoinType
Definition nodes.h:298
#define plan(x)
Definition pg_regress.c:161
SubqueryScanStatus
Definition plannodes.h:746
@ SUBQUERY_SCAN_NONTRIVIAL
Definition plannodes.h:749
@ SUBQUERY_SCAN_UNKNOWN
Definition plannodes.h:747
@ SUBQUERY_SCAN_TRIVIAL
Definition plannodes.h:748
PartitionPruneCombineOp
Definition plannodes.h:1773
@ PARTPRUNE_COMBINE_INTERSECT
Definition plannodes.h:1775
@ PARTPRUNE_COMBINE_UNION
Definition plannodes.h:1774
PlannedStmtOrigin
Definition plannodes.h:38
@ PLAN_STMT_STANDARD
Definition plannodes.h:41
@ PLAN_STMT_UNKNOWN
Definition plannodes.h:39
@ PLAN_STMT_CACHE_CUSTOM
Definition plannodes.h:43
@ PLAN_STMT_CACHE_GENERIC
Definition plannodes.h:42
@ PLAN_STMT_INTERNAL
Definition plannodes.h:40
ResultType
Definition plannodes.h:270
@ RESULT_TYPE_UPPER
Definition plannodes.h:274
@ RESULT_TYPE_SCAN
Definition plannodes.h:272
@ RESULT_TYPE_GATING
Definition plannodes.h:271
@ RESULT_TYPE_MINMAX
Definition plannodes.h:275
@ RESULT_TYPE_JOIN
Definition plannodes.h:273
RowMarkType
Definition plannodes.h:1535
@ ROW_MARK_COPY
Definition plannodes.h:1541
@ ROW_MARK_REFERENCE
Definition plannodes.h:1540
@ ROW_MARK_SHARE
Definition plannodes.h:1538
@ ROW_MARK_EXCLUSIVE
Definition plannodes.h:1536
@ ROW_MARK_NOKEYEXCLUSIVE
Definition plannodes.h:1537
@ ROW_MARK_KEYSHARE
Definition plannodes.h:1539
MonotonicFunction
Definition plannodes.h:1817
@ MONOTONICFUNC_NONE
Definition plannodes.h:1818
@ MONOTONICFUNC_DECREASING
Definition plannodes.h:1820
@ MONOTONICFUNC_INCREASING
Definition plannodes.h:1819
@ MONOTONICFUNC_BOTH
Definition plannodes.h:1821
unsigned int Oid
static int fb(int x)
ScanDirection
Definition sdir.h:25
uint16 StrategyNumber
Definition stratnum.h:22
AggSplit aggsplit
Definition plannodes.h:1196
List * chain
Definition plannodes.h:1223
Oid *grpCollations pg_node_attr(array_size(numCols))
List * groupingSets
Definition plannodes.h:1220
Bitmapset * aggParams
Definition plannodes.h:1215
Cardinality numGroups
Definition plannodes.h:1209
Plan plan
Definition plannodes.h:1190
int numCols
Definition plannodes.h:1199
Oid *grpOperators pg_node_attr(array_size(numCols))
uint64 transitionSpace
Definition plannodes.h:1212
AttrNumber *grpColIdx pg_node_attr(array_size(numCols))
AggStrategy aggstrategy
Definition plannodes.h:1193
int first_partial_plan
Definition plannodes.h:401
int part_prune_index
Definition plannodes.h:408
int nasyncplans
Definition plannodes.h:395
Bitmapset * apprelids
Definition plannodes.h:392
Plan plan
Definition plannodes.h:390
List * appendplans
Definition plannodes.h:393
Plan plan
Definition plannodes.h:491
List * bitmapplans
Definition plannodes.h:492
List * bitmapqualorig
Definition plannodes.h:693
List * indexqualorig
Definition plannodes.h:677
List * bitmapplans
Definition plannodes.h:507
bool isshared
Definition plannodes.h:506
Plan plan
Definition plannodes.h:505
int ctePlanId
Definition plannodes.h:802
int cteParam
Definition plannodes.h:804
Scan scan
Definition plannodes.h:800
uint32 flags
Definition plannodes.h:915
List * custom_scan_tlist
Definition plannodes.h:923
List * custom_private
Definition plannodes.h:921
Bitmapset * custom_relids
Definition plannodes.h:925
List * custom_exprs
Definition plannodes.h:919
const struct CustomScanMethods * methods
Definition plannodes.h:932
List * custom_plans
Definition plannodes.h:917
Oid checkAsUser
Definition plannodes.h:877
CmdType operation
Definition plannodes.h:873
List * fdw_exprs
Definition plannodes.h:881
bool fsSystemCol
Definition plannodes.h:893
Bitmapset * fs_relids
Definition plannodes.h:889
List * fdw_private
Definition plannodes.h:883
Bitmapset * fs_base_relids
Definition plannodes.h:891
Index resultRelation
Definition plannodes.h:875
List * fdw_recheck_quals
Definition plannodes.h:887
List * fdw_scan_tlist
Definition plannodes.h:885
List * functions
Definition plannodes.h:767
bool funcordinality
Definition plannodes.h:769
Oid *collations pg_node_attr(array_size(numCols))
Oid *sortOperators pg_node_attr(array_size(numCols))
bool *nullsFirst pg_node_attr(array_size(numCols))
Bitmapset * initParam
Definition plannodes.h:1389
AttrNumber *sortColIdx pg_node_attr(array_size(numCols))
int num_workers
Definition plannodes.h:1339
bool invisible
Definition plannodes.h:1345
Bitmapset * initParam
Definition plannodes.h:1351
bool single_copy
Definition plannodes.h:1343
Plan plan
Definition plannodes.h:1337
int rescan_param
Definition plannodes.h:1341
AttrNumber *grpColIdx pg_node_attr(array_size(numCols))
int numCols
Definition plannodes.h:1164
Plan plan
Definition plannodes.h:1161
Oid *grpCollations pg_node_attr(array_size(numCols))
Oid *grpOperators pg_node_attr(array_size(numCols))
List * hashcollations
Definition plannodes.h:1048
List * hashclauses
Definition plannodes.h:1046
List * hashoperators
Definition plannodes.h:1047
Join join
Definition plannodes.h:1045
List * hashkeys
Definition plannodes.h:1054
AttrNumber skewColumn
Definition plannodes.h:1413
List * hashkeys
Definition plannodes.h:1409
Oid skewTable
Definition plannodes.h:1411
bool skewInherit
Definition plannodes.h:1415
Cardinality rows_total
Definition plannodes.h:1418
Plan plan
Definition plannodes.h:1402
List * indexqual
Definition plannodes.h:639
List * recheckqual
Definition plannodes.h:641
List * indextlist
Definition plannodes.h:645
ScanDirection indexorderdir
Definition plannodes.h:647
List * indexorderby
Definition plannodes.h:643
List * indexorderby
Definition plannodes.h:593
List * indexorderbyops
Definition plannodes.h:597
ScanDirection indexorderdir
Definition plannodes.h:599
Scan scan
Definition plannodes.h:585
List * indexqualorig
Definition plannodes.h:591
Oid indexid
Definition plannodes.h:587
List * indexqual
Definition plannodes.h:589
List * indexorderbyorig
Definition plannodes.h:595
pg_node_attr(abstract) Plan plan
List * joinqual
Definition plannodes.h:971
JoinType jointype
Definition plannodes.h:968
bool inner_unique
Definition plannodes.h:969
LimitOption limitOption
Definition plannodes.h:1488
Oid *uniqOperators pg_node_attr(array_size(uniqNumCols))
Plan plan
Definition plannodes.h:1479
Node * limitCount
Definition plannodes.h:1485
AttrNumber *uniqColIdx pg_node_attr(array_size(uniqNumCols))
int uniqNumCols
Definition plannodes.h:1491
Oid *uniqCollations pg_node_attr(array_size(uniqNumCols))
Node * limitOffset
Definition plannodes.h:1482
Definition pg_list.h:54
int epqParam
Definition plannodes.h:1467
List * rowMarks
Definition plannodes.h:1465
Plan plan
Definition plannodes.h:1463
Plan plan
Definition plannodes.h:1063
Plan plan
Definition plannodes.h:1072
bool singlerow
Definition plannodes.h:1090
Cardinality est_calls
Definition plannodes.h:1108
Bitmapset * keyparamids
Definition plannodes.h:1105
Oid *hashOperators pg_node_attr(array_size(numKeys))
bool binary_mode
Definition plannodes.h:1096
int numKeys
Definition plannodes.h:1075
Cardinality est_unique_keys
Definition plannodes.h:1111
List * param_exprs
Definition plannodes.h:1084
double est_hit_ratio
Definition plannodes.h:1114
uint32 est_entries
Definition plannodes.h:1102
Oid *collations pg_node_attr(array_size(numKeys))
bool *nullsFirst pg_node_attr(array_size(numCols))
AttrNumber *sortColIdx pg_node_attr(array_size(numCols))
int part_prune_index
Definition plannodes.h:447
Oid *sortOperators pg_node_attr(array_size(numCols))
Bitmapset * apprelids
Definition plannodes.h:421
Oid *collations pg_node_attr(array_size(numCols))
List * mergeplans
Definition plannodes.h:423
List * mergeclauses
Definition plannodes.h:1022
Oid *mergeFamilies pg_node_attr(array_size(mergeclauses))
bool skip_mark_restore
Definition plannodes.h:1019
bool *mergeReversals pg_node_attr(array_size(mergeclauses))
bool *mergeNullsFirst pg_node_attr(array_size(mergeclauses))
Oid *mergeCollations pg_node_attr(array_size(mergeclauses))
List * updateColnosLists
Definition plannodes.h:344
Index nominalRelation
Definition plannodes.h:338
List * arbiterIndexes
Definition plannodes.h:364
List * onConflictCols
Definition plannodes.h:368
List * mergeJoinConditions
Definition plannodes.h:378
char * returningOldAlias
Definition plannodes.h:348
char * returningNewAlias
Definition plannodes.h:350
CmdType operation
Definition plannodes.h:334
List * resultRelations
Definition plannodes.h:342
Bitmapset * fdwDirectModifyPlans
Definition plannodes.h:356
List * onConflictSet
Definition plannodes.h:366
List * exclRelTlist
Definition plannodes.h:374
List * mergeActionLists
Definition plannodes.h:376
bool canSetTag
Definition plannodes.h:336
List * fdwPrivLists
Definition plannodes.h:354
List * returningLists
Definition plannodes.h:352
List * withCheckOptionLists
Definition plannodes.h:346
Index rootRelation
Definition plannodes.h:340
Node * onConflictWhere
Definition plannodes.h:370
List * rowMarks
Definition plannodes.h:358
OnConflictAction onConflictAction
Definition plannodes.h:362
Index exclRelRTI
Definition plannodes.h:372
pg_node_attr(no_equal, no_query_jumble) NodeTag type
List * nestParams
Definition plannodes.h:989
Join join
Definition plannodes.h:987
Definition nodes.h:135
Bitmapset * other_subplans
Definition plannodes.h:1649
Bitmapset * relids
Definition plannodes.h:1647
pg_node_attr(no_equal, no_query_jumble) NodeTag type
PartitionPruneCombineOp combineOp
Definition plannodes.h:1782
PartitionPruneStep step
Definition plannodes.h:1780
PartitionPruneStep step
Definition plannodes.h:1758
StrategyNumber opstrategy
Definition plannodes.h:1760
Bitmapset * nullkeys
Definition plannodes.h:1763
pg_node_attr(abstract, no_equal, no_query_jumble) NodeTag type
Oid *relid_map pg_node_attr(array_size(nparts))
pg_node_attr(no_equal, no_query_jumble) NodeTag type
Bitmapset * present_parts
Definition plannodes.h:1683
int *leafpart_rti_map pg_node_attr(array_size(nparts))
int *subplan_map pg_node_attr(array_size(nparts))
int *subpart_map pg_node_attr(array_size(nparts))
uint32 hashValue
Definition plannodes.h:1804
pg_node_attr(no_equal, no_query_jumble) NodeTag type
LockClauseStrength strength
Definition plannodes.h:1600
RowMarkType markType
Definition plannodes.h:1596
LockWaitPolicy waitPolicy
Definition plannodes.h:1602
Index rowmarkId
Definition plannodes.h:1594
pg_node_attr(no_equal, no_query_jumble) NodeTag type
Bitmapset * extParam
Definition plannodes.h:249
struct Plan * lefttree
Definition plannodes.h:233
bool async_capable
Definition plannodes.h:221
Cost total_cost
Definition plannodes.h:199
struct Plan * righttree
Definition plannodes.h:234
bool parallel_aware
Definition plannodes.h:213
Cost startup_cost
Definition plannodes.h:197
List * qual
Definition plannodes.h:231
int plan_width
Definition plannodes.h:207
Bitmapset * allParam
Definition plannodes.h:250
bool parallel_safe
Definition plannodes.h:215
Cardinality plan_rows
Definition plannodes.h:205
int plan_node_id
Definition plannodes.h:227
int disabled_nodes
Definition plannodes.h:195
List * targetlist
Definition plannodes.h:229
pg_node_attr(abstract, no_equal, no_query_jumble) NodeTag type
List * initPlan
Definition plannodes.h:236
struct Plan * planTree
Definition plannodes.h:101
bool hasModifyingCTE
Definition plannodes.h:83
List * appendRelations
Definition plannodes.h:127
List * permInfos
Definition plannodes.h:120
bool canSetTag
Definition plannodes.h:86
List * rowMarks
Definition plannodes.h:138
int64 planId
Definition plannodes.h:74
Bitmapset * rewindPlanIDs
Definition plannodes.h:135
List * extension_state
Definition plannodes.h:159
int64 queryId
Definition plannodes.h:71
ParseLoc stmt_len
Definition plannodes.h:165
PlannedStmtOrigin planOrigin
Definition plannodes.h:77
bool hasReturning
Definition plannodes.h:80
ParseLoc stmt_location
Definition plannodes.h:163
List * invalItems
Definition plannodes.h:144
bool transientPlan
Definition plannodes.h:89
List * resultRelations
Definition plannodes.h:124
List * subplans
Definition plannodes.h:132
List * relationOids
Definition plannodes.h:141
bool dependsOnRole
Definition plannodes.h:92
Bitmapset * unprunableRelids
Definition plannodes.h:115
CmdType commandType
Definition plannodes.h:68
pg_node_attr(no_equal, no_query_jumble) NodeTag type
Node * utilityStmt
Definition plannodes.h:150
List * rtable
Definition plannodes.h:109
List * partPruneInfos
Definition plannodes.h:106
List * paramExecTypes
Definition plannodes.h:147
bool parallelModeNeeded
Definition plannodes.h:95
AttrNumber *dupColIdx pg_node_attr(array_size(numCols))
Cardinality numGroups
Definition plannodes.h:478
Oid *dupOperators pg_node_attr(array_size(numCols))
Oid *dupCollations pg_node_attr(array_size(numCols))
Node * resconstantqual
Definition plannodes.h:299
ResultType result_type
Definition plannodes.h:298
Bitmapset * relids
Definition plannodes.h:300
Plan plan
Definition plannodes.h:297
struct TableSampleClause * tablesample
Definition plannodes.h:543
Index scanrelid
Definition plannodes.h:523
pg_node_attr(abstract) Plan plan
Scan scan
Definition plannodes.h:532
SetOpStrategy strategy
Definition plannodes.h:1433
Oid *cmpOperators pg_node_attr(array_size(numCols))
AttrNumber *cmpColIdx pg_node_attr(array_size(numCols))
SetOpCmd cmd
Definition plannodes.h:1430
Oid *cmpCollations pg_node_attr(array_size(numCols))
int numCols
Definition plannodes.h:1436
Plan plan
Definition plannodes.h:1427
bool *cmpNullsFirst pg_node_attr(array_size(numCols))
Cardinality numGroups
Definition plannodes.h:1449
Oid *collations pg_node_attr(array_size(numCols))
bool *nullsFirst pg_node_attr(array_size(numCols))
Oid *sortOperators pg_node_attr(array_size(numCols))
int numCols
Definition plannodes.h:1127
AttrNumber *sortColIdx pg_node_attr(array_size(numCols))
Plan plan
Definition plannodes.h:1124
SubqueryScanStatus scanstatus
Definition plannodes.h:756
Plan * subplan
Definition plannodes.h:755
TableFunc * tablefunc
Definition plannodes.h:791
List * tidrangequals
Definition plannodes.h:722
Scan scan
Definition plannodes.h:706
List * tidquals
Definition plannodes.h:708
AttrNumber *uniqColIdx pg_node_attr(array_size(numCols))
Oid *uniqOperators pg_node_attr(array_size(numCols))
Oid *uniqCollations pg_node_attr(array_size(numCols))
Plan plan
Definition plannodes.h:1309
int numCols
Definition plannodes.h:1312
List * values_lists
Definition plannodes.h:780
AttrNumber *ordColIdx pg_node_attr(array_size(ordNumCols))
char * winname
Definition plannodes.h:1235
int partNumCols
Definition plannodes.h:1241
Oid endInRangeFunc
Definition plannodes.h:1285
Node * endOffset
Definition plannodes.h:1271
Oid *partCollations pg_node_attr(array_size(partNumCols))
bool topWindow
Definition plannodes.h:1300
Oid *ordOperators pg_node_attr(array_size(ordNumCols))
List * runConditionOrig
Definition plannodes.h:1277
Oid inRangeColl
Definition plannodes.h:1288
Node * startOffset
Definition plannodes.h:1268
List * runCondition
Definition plannodes.h:1274
Oid startInRangeFunc
Definition plannodes.h:1282
bool inRangeAsc
Definition plannodes.h:1291
Index winref
Definition plannodes.h:1238
AttrNumber *partColIdx pg_node_attr(array_size(partNumCols))
bool inRangeNullsFirst
Definition plannodes.h:1294
Oid *partOperators pg_node_attr(array_size(partNumCols))
int ordNumCols
Definition plannodes.h:1253
Oid *ordCollations pg_node_attr(array_size(ordNumCols))
int frameOptions
Definition plannodes.h:1265
const char * type