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