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