PostgreSQL Source Code git master
Loading...
Searching...
No Matches
plannodes.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * plannodes.h
4 * definitions for query plan nodes
5 *
6 *
7 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/nodes/plannodes.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef PLANNODES_H
15#define PLANNODES_H
16
17#include "access/sdir.h"
18#include "access/stratnum.h"
19#include "common/relpath.h"
20#include "lib/stringinfo.h"
21#include "nodes/bitmapset.h"
22#include "nodes/lockoptions.h"
23#include "nodes/primnodes.h"
24
25
26/* ----------------------------------------------------------------
27 * node definitions
28 * ----------------------------------------------------------------
29 */
30
31/* ----------------
32 * PlannedStmtOrigin
33 *
34 * PlannedStmtOrigin identifies from where a PlannedStmt comes from.
35 * ----------------
36 */
38{
39 PLAN_STMT_UNKNOWN = 0, /* plan origin is not yet known */
40 PLAN_STMT_INTERNAL, /* generated internally by a query */
41 PLAN_STMT_STANDARD, /* standard planned statement */
42 PLAN_STMT_CACHE_GENERIC, /* Generic cached plan */
43 PLAN_STMT_CACHE_CUSTOM, /* Custom cached plan */
45
46/* ----------------
47 * PlannedStmt node
48 *
49 * The output of the planner is a Plan tree headed by a PlannedStmt node.
50 * PlannedStmt holds the "one time" information needed by the executor.
51 *
52 * For simplicity in APIs, we also wrap utility statements in PlannedStmt
53 * nodes; in such cases, commandType == CMD_UTILITY, the statement itself
54 * is in the utilityStmt field, and the rest of the struct is mostly dummy.
55 * (We do use canSetTag, stmt_location, stmt_len, and possibly queryId.)
56 *
57 * PlannedStmt, as well as all varieties of Plan, do not support equal(),
58 * not because it's not sensible but because we currently have no need.
59 * ----------------
60 */
61typedef struct PlannedStmt
62{
64
66
67 /* select|insert|update|delete|merge|utility */
69
70 /* query identifier (copied from Query) */
72
73 /* plan identifier (can be set by plugins) */
75
76 /* origin of plan */
78
79 /* is it insert|update|delete|merge RETURNING? */
81
82 /* has insert|update|delete|merge in WITH? */
84
85 /* do I set the command result tag? */
87
88 /* redo plan when TransactionXmin changes? */
90
91 /* is plan specific to current role? */
93
94 /* parallel mode required to execute? */
96
97 /* which forms of JIT should be performed */
99
100 /* tree of Plan nodes */
101 struct Plan *planTree;
102
103 /*
104 * List of PartitionPruneInfo contained in the plan
105 */
107
108 /* list of RangeTblEntry nodes */
110
111 /*
112 * RT indexes of relations that are not subject to runtime pruning or are
113 * needed to perform runtime pruning
114 */
116
117 /*
118 * list of RTEPermissionInfo nodes for rtable entries needing one
119 */
121
122 /* rtable indexes of target relations for INSERT/UPDATE/DELETE/MERGE */
123 /* integer list of RT indexes, or NIL */
125
126 /* list of AppendRelInfo nodes */
128
129 /*
130 * Plan trees for SubPlan expressions; note that some could be NULL
131 */
133
134 /* a list of SubPlanRTInfo objects */
136
137 /* indices of subplans that require REWIND */
139
140 /* a list of PlanRowMark's */
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 /* RTI of the EXCLUDED pseudo relation */
381 /* tlist of the EXCLUDED pseudo relation */
383 /* per-target-table lists of actions for MERGE */
385 /* per-target-table join conditions for MERGE */
388
389struct PartitionPruneInfo; /* forward reference to struct below */
390
391/* ----------------
392 * Append node -
393 * Generate the concatenation of the results of sub-plans.
394 * ----------------
395 */
396typedef struct Append
397{
399
400 /* RTIs of appendrel(s) formed by this node */
402
403 /* sets of RTIs of appendrels consolidated into this node */
405
406 /* plans to run */
408
409 /* # of asynchronous plans */
411
412 /*
413 * All 'appendplans' preceding this index are non-partial plans. All
414 * 'appendplans' from this index onwards are partial plans.
415 */
417
418 /*
419 * Index into PlannedStmt.partPruneInfos and parallel lists in EState:
420 * es_part_prune_states and es_part_prune_results. Set to -1 if no
421 * run-time pruning is used.
422 */
425
426/* ----------------
427 * MergeAppend node -
428 * Merge the results of pre-sorted sub-plans to preserve the ordering.
429 * ----------------
430 */
431typedef struct MergeAppend
432{
434
435 /* RTIs of appendrel(s) formed by this node */
437
438 /* sets of RTIs of appendrels consolidated into this node */
440
441 /* plans to run */
443
444 /* these fields are just like the sort-key info in struct Sort: */
445
446 /* number of sort-key columns */
448
449 /* their indexes in the target list */
451
452 /* OIDs of operators to sort them by */
454
455 /* OIDs of collations */
457
458 /* NULLS FIRST/LAST directions */
460
461 /*
462 * Index into PlannedStmt.partPruneInfos and parallel lists in EState:
463 * es_part_prune_states and es_part_prune_results. Set to -1 if no
464 * run-time pruning is used.
465 */
468
469/* ----------------
470 * RecursiveUnion node -
471 * Generate a recursive union of two subplans.
472 *
473 * The "outer" subplan is always the non-recursive term, and the "inner"
474 * subplan is the recursive term.
475 * ----------------
476 */
477typedef struct RecursiveUnion
478{
480
481 /* ID of Param representing work table */
483
484 /* Remaining fields are zero/null in UNION ALL case */
485
486 /* number of columns to check for duplicate-ness */
488
489 /* their indexes in the target list */
491
492 /* equality operators to compare with */
495
496 /* estimated number of groups in input */
499
500/* ----------------
501 * BitmapAnd node -
502 * Generate the intersection of the results of sub-plans.
503 *
504 * The subplans must be of types that yield tuple bitmaps. The targetlist
505 * and qual fields of the plan are unused and are always NIL.
506 * ----------------
507 */
513
514/* ----------------
515 * BitmapOr node -
516 * Generate the union of the results of sub-plans.
517 *
518 * The subplans must be of types that yield tuple bitmaps. The targetlist
519 * and qual fields of the plan are unused and are always NIL.
520 * ----------------
521 */
528
529/*
530 * ==========
531 * Scan nodes
532 *
533 * Scan is an abstract type that all relation scan plan types inherit from.
534 * ==========
535 */
536typedef struct Scan
537{
539
540 Plan plan;
541 /* relid is index into the range table */
544
545/* ----------------
546 * sequential scan node
547 * ----------------
548 */
549typedef struct SeqScan
550{
553
554/* ----------------
555 * table sample scan node
556 * ----------------
557 */
558typedef struct SampleScan
559{
561 /* use struct pointer to avoid including parsenodes.h here */
564
565/* ----------------
566 * index scan node
567 *
568 * indexqualorig is an implicitly-ANDed list of index qual expressions, each
569 * in the same form it appeared in the query WHERE condition. Each should
570 * be of the form (indexkey OP comparisonval) or (comparisonval OP indexkey).
571 * The indexkey is a Var or expression referencing column(s) of the index's
572 * base table. The comparisonval might be any expression, but it won't use
573 * any columns of the base table. The expressions are ordered by index
574 * column position (but items referencing the same index column can appear
575 * in any order). indexqualorig is used at runtime only if we have to recheck
576 * a lossy indexqual.
577 *
578 * indexqual has the same form, but the expressions have been commuted if
579 * necessary to put the indexkeys on the left, and the indexkeys are replaced
580 * by Var nodes identifying the index columns (their varno is INDEX_VAR and
581 * their varattno is the index column number).
582 *
583 * indexorderbyorig is similarly the original form of any ORDER BY expressions
584 * that are being implemented by the index, while indexorderby is modified to
585 * have index column Vars on the left-hand side. Here, multiple expressions
586 * must appear in exactly the ORDER BY order, and this is not necessarily the
587 * index column order. Only the expressions are provided, not the auxiliary
588 * sort-order information from the ORDER BY SortGroupClauses; it's assumed
589 * that the sort ordering is fully determinable from the top-level operators.
590 * indexorderbyorig is used at runtime to recheck the ordering, if the index
591 * cannot calculate an accurate ordering. It is also needed for EXPLAIN.
592 *
593 * indexorderbyops is a list of the OIDs of the operators used to sort the
594 * ORDER BY expressions. This is used together with indexorderbyorig to
595 * recheck ordering at run time. (Note that indexorderby, indexorderbyorig,
596 * and indexorderbyops are used for amcanorderbyop cases, not amcanorder.)
597 *
598 * indexorderdir specifies the scan ordering, for indexscans on amcanorder
599 * indexes (for other indexes it should be "don't care").
600 * ----------------
601 */
602typedef struct IndexScan
603{
605 /* OID of index to scan */
607 /* list of index quals (usually OpExprs) */
609 /* the same in original form */
611 /* list of index ORDER BY exprs */
613 /* the same in original form */
615 /* OIDs of sort ops for ORDER BY exprs */
617 /* forward or backward or don't care */
620
621/* ----------------
622 * index-only scan node
623 *
624 * IndexOnlyScan is very similar to IndexScan, but it specifies an
625 * index-only scan, in which the data comes from the index not the heap.
626 * Because of this, *all* Vars in the plan node's targetlist, qual, and
627 * index expressions reference index columns and have varno = INDEX_VAR.
628 *
629 * We could almost use indexqual directly against the index's output tuple
630 * when rechecking lossy index operators, but that won't work for quals on
631 * index columns that are not retrievable. Hence, recheckqual is needed
632 * for rechecks: it expresses the same condition as indexqual, but using
633 * only index columns that are retrievable. (We will not generate an
634 * index-only scan if this is not possible. An example is that if an
635 * index has table column "x" in a retrievable index column "ind1", plus
636 * an expression f(x) in a non-retrievable column "ind2", an indexable
637 * query on f(x) will use "ind2" in indexqual and f(ind1) in recheckqual.
638 * Without the "ind1" column, an index-only scan would be disallowed.)
639 *
640 * We don't currently need a recheckable equivalent of indexorderby,
641 * because we don't support lossy operators in index ORDER BY.
642 *
643 * To help EXPLAIN interpret the index Vars for display, we provide
644 * indextlist, which represents the contents of the index as a targetlist
645 * with one TLE per index column. Vars appearing in this list reference
646 * the base table, and this is the only field in the plan node that may
647 * contain such Vars. Also, for the convenience of setrefs.c, TLEs in
648 * indextlist are marked as resjunk if they correspond to columns that
649 * the index AM cannot reconstruct.
650 * ----------------
651 */
652typedef struct IndexOnlyScan
653{
655 /* OID of index to scan */
657 /* list of index quals (usually OpExprs) */
659 /* index quals in recheckable form */
661 /* list of index ORDER BY exprs */
663 /* TargetEntry list describing index's cols */
665 /* forward or backward or don't care */
668
669/* ----------------
670 * bitmap index scan node
671 *
672 * BitmapIndexScan delivers a bitmap of potential tuple locations;
673 * it does not access the heap itself. The bitmap is used by an
674 * ancestor BitmapHeapScan node, possibly after passing through
675 * intermediate BitmapAnd and/or BitmapOr nodes to combine it with
676 * the results of other BitmapIndexScans.
677 *
678 * The fields have the same meanings as for IndexScan, except we don't
679 * store a direction flag because direction is uninteresting.
680 *
681 * In a BitmapIndexScan plan node, the targetlist and qual fields are
682 * not used and are always NIL. The indexqualorig field is unused at
683 * run time too, but is saved for the benefit of EXPLAIN.
684 * ----------------
685 */
686typedef struct BitmapIndexScan
687{
689 /* OID of index to scan */
691 /* Create shared bitmap if set */
693 /* list of index quals (OpExprs) */
695 /* the same in original form */
698
699/* ----------------
700 * bitmap sequential scan node
701 *
702 * This needs a copy of the qual conditions being used by the input index
703 * scans because there are various cases where we need to recheck the quals;
704 * for example, when the bitmap is lossy about the specific rows on a page
705 * that meet the index condition.
706 * ----------------
707 */
708typedef struct BitmapHeapScan
709{
711 /* index quals, in standard expr form */
714
715/* ----------------
716 * tid scan node
717 *
718 * tidquals is an implicitly OR'ed list of qual expressions of the form
719 * "CTID = pseudoconstant", or "CTID = ANY(pseudoconstant_array)",
720 * or a CurrentOfExpr for the relation.
721 * ----------------
722 */
723typedef struct TidScan
724{
726 /* qual(s) involving CTID = something */
729
730/* ----------------
731 * tid range scan node
732 *
733 * tidrangequals is an implicitly AND'ed list of qual expressions of the form
734 * "CTID relop pseudoconstant", where relop is one of >,>=,<,<=.
735 * ----------------
736 */
737typedef struct TidRangeScan
738{
740 /* qual(s) involving CTID op something */
743
744/* ----------------
745 * subquery scan node
746 *
747 * SubqueryScan is for scanning the output of a sub-query in the range table.
748 * We often need an extra plan node above the sub-query's plan to perform
749 * expression evaluations (which we can't push into the sub-query without
750 * risking changing its semantics). Although we are not scanning a physical
751 * relation, we make this a descendant of Scan anyway for code-sharing
752 * purposes.
753 *
754 * SubqueryScanStatus caches the trivial_subqueryscan property of the node.
755 * SUBQUERY_SCAN_UNKNOWN means not yet determined. This is only used during
756 * planning.
757 *
758 * Note: we store the sub-plan in the type-specific subplan field, not in
759 * the generic lefttree field as you might expect. This is because we do
760 * not want plan-tree-traversal routines to recurse into the subplan without
761 * knowing that they are changing Query contexts.
762 * ----------------
763 */
770
777
778/* ----------------
779 * FunctionScan node
780 * ----------------
781 */
782typedef struct FunctionScan
783{
785 /* list of RangeTblFunction nodes */
787 /* WITH ORDINALITY */
790
791/* ----------------
792 * ValuesScan node
793 * ----------------
794 */
795typedef struct ValuesScan
796{
798 /* list of expression lists */
801
802/* ----------------
803 * TableFunc scan node
804 * ----------------
805 */
806typedef struct TableFuncScan
807{
809 /* table function node */
812
813/* ----------------
814 * CteScan node
815 * ----------------
816 */
817typedef struct CteScan
818{
820 /* ID of init SubPlan for CTE */
822 /* ID of Param representing CTE output */
825
826/* ----------------
827 * NamedTuplestoreScan node
828 * ----------------
829 */
831{
833 /* Name given to Ephemeral Named Relation */
834 char *enrname;
836
837/* ----------------
838 * WorkTableScan node
839 * ----------------
840 */
841typedef struct WorkTableScan
842{
844 /* ID of Param representing work table */
847
848/* ----------------
849 * ForeignScan node
850 *
851 * fdw_exprs and fdw_private are both under the control of the foreign-data
852 * wrapper, but fdw_exprs is presumed to contain expression trees and will
853 * be post-processed accordingly by the planner; fdw_private won't be.
854 * Note that everything in both lists must be copiable by copyObject().
855 * One way to store an arbitrary blob of bytes is to represent it as a bytea
856 * Const. Usually, though, you'll be better off choosing a representation
857 * that can be dumped usefully by nodeToString().
858 *
859 * fdw_scan_tlist is a targetlist describing the contents of the scan tuple
860 * returned by the FDW; it can be NIL if the scan tuple matches the declared
861 * rowtype of the foreign table, which is the normal case for a simple foreign
862 * table scan. (If the plan node represents a foreign join, fdw_scan_tlist
863 * is required since there is no rowtype available from the system catalogs.)
864 * When fdw_scan_tlist is provided, Vars in the node's tlist and quals must
865 * have varno INDEX_VAR, and their varattnos correspond to resnos in the
866 * fdw_scan_tlist (which are also column numbers in the actual scan tuple).
867 * fdw_scan_tlist is never actually executed; it just holds expression trees
868 * describing what is in the scan tuple's columns.
869 *
870 * fdw_recheck_quals should contain any quals which the core system passed to
871 * the FDW but which were not added to scan.plan.qual; that is, it should
872 * contain the quals being checked remotely. This is needed for correct
873 * behavior during EvalPlanQual rechecks.
874 *
875 * When the plan node represents a foreign join, scan.scanrelid is zero and
876 * fs_relids must be consulted to identify the join relation. (fs_relids
877 * is valid for simple scans as well, but will always match scan.scanrelid.)
878 * fs_relids includes outer joins; fs_base_relids does not.
879 *
880 * If the FDW's PlanDirectModify() callback decides to repurpose a ForeignScan
881 * node to perform the UPDATE or DELETE operation directly in the remote
882 * server, it sets 'operation' and 'resultRelation' to identify the operation
883 * type and target relation. Note that these fields are only set if the
884 * modification is performed *fully* remotely; otherwise, the modification is
885 * driven by a local ModifyTable node and 'operation' is left to CMD_SELECT.
886 * ----------------
887 */
888typedef struct ForeignScan
889{
891 /* SELECT/INSERT/UPDATE/DELETE */
893 /* direct modification target's RT index */
895 /* user to perform the scan as; 0 means to check as current user */
897 /* OID of foreign server */
899 /* expressions that FDW may evaluate */
901 /* private data for FDW */
903 /* optional tlist describing scan tuple */
905 /* original quals not in scan.plan.qual */
907 /* base+OJ RTIs generated by this scan */
909 /* base RTIs generated by this scan */
911 /* true if any "system column" is needed */
914
915/* ----------------
916 * CustomScan node
917 *
918 * The comments for ForeignScan's fdw_exprs, fdw_private, fdw_scan_tlist,
919 * and fs_relids fields apply equally to CustomScan's custom_exprs,
920 * custom_private, custom_scan_tlist, and custom_relids fields. The
921 * convention of setting scan.scanrelid to zero for joins applies as well.
922 *
923 * Note that since Plan trees can be copied, custom scan providers *must*
924 * fit all plan data they need into those fields; embedding CustomScan in
925 * a larger struct will not work.
926 * ----------------
927 */
928struct CustomScanMethods;
929
930typedef struct CustomScan
931{
933 /* mask of CUSTOMPATH_* flags, see nodes/extensible.h */
935 /* list of Plan nodes, if any */
937 /* expressions that custom code may evaluate */
939 /* private data for custom code */
941 /* optional tlist describing scan tuple */
943 /* RTIs generated by this scan */
945
946 /*
947 * NOTE: The method field of CustomScan is required to be a pointer to a
948 * static table of callback functions. So we don't copy the table itself,
949 * just reference the original one.
950 */
953
954/*
955 * ==========
956 * Join nodes
957 * ==========
958 */
959
960/* ----------------
961 * Join node
962 *
963 * jointype: rule for joining tuples from left and right subtrees
964 * inner_unique each outer tuple can match to no more than one inner tuple
965 * joinqual: qual conditions that came from JOIN/ON or JOIN/USING
966 * (plan.qual contains conditions that came from WHERE)
967 *
968 * When jointype is INNER, joinqual and plan.qual are semantically
969 * interchangeable. For OUTER jointypes, the two are *not* interchangeable;
970 * only joinqual is used to determine whether a match has been found for
971 * the purpose of deciding whether to generate null-extended tuples.
972 * (But plan.qual is still applied before actually returning a tuple.)
973 * For an outer join, only joinquals are allowed to be used as the merge
974 * or hash condition of a merge or hash join.
975 *
976 * inner_unique is set if the joinquals are such that no more than one inner
977 * tuple could match any given outer tuple. This allows the executor to
978 * skip searching for additional matches. (This must be provable from just
979 * the joinquals, ignoring plan.qual, due to where the executor tests it.)
980 * ----------------
981 */
982typedef struct Join
983{
985
986 Plan plan;
989 /* JOIN quals (in addition to plan.qual) */
992
993/* ----------------
994 * nest loop join node
995 *
996 * The nestParams list identifies any executor Params that must be passed
997 * into execution of the inner subplan carrying values from the current row
998 * of the outer subplan. Currently we restrict these values to be simple
999 * Vars, but perhaps someday that'd be worth relaxing. (Note: during plan
1000 * creation, the paramval can actually be a PlaceHolderVar expression; but it
1001 * must be a Var with varno OUTER_VAR by the time it gets to the executor.)
1002 * ----------------
1003 */
1004typedef struct NestLoop
1005{
1007 /* list of NestLoopParam nodes */
1010
1011typedef struct NestLoopParam
1012{
1014
1015 NodeTag type;
1016 /* number of the PARAM_EXEC Param to set */
1018 /* outer-relation Var to assign to Param */
1021
1022/* ----------------
1023 * merge join node
1024 *
1025 * The expected ordering of each mergeable column is described by a btree
1026 * opfamily OID, a collation OID, a direction (BTLessStrategyNumber or
1027 * BTGreaterStrategyNumber) and a nulls-first flag. Note that the two sides
1028 * of each mergeclause may be of different datatypes, but they are ordered the
1029 * same way according to the common opfamily and collation. The operator in
1030 * each mergeclause must be an equality operator of the indicated opfamily.
1031 * ----------------
1032 */
1033typedef struct MergeJoin
1034{
1036
1037 /* Can we skip mark/restore calls? */
1039
1040 /* mergeclauses as expression trees */
1042
1043 /* these are arrays, but have the same length as the mergeclauses list: */
1044
1045 /* per-clause OIDs of btree opfamilies */
1047
1048 /* per-clause OIDs of collations */
1050
1051 /* per-clause ordering (ASC or DESC) */
1053
1054 /* per-clause nulls ordering */
1057
1058/* ----------------
1059 * hash join node
1060 * ----------------
1061 */
1062typedef struct HashJoin
1063{
1068
1069 /*
1070 * List of expressions to be hashed for tuples from the outer plan, to
1071 * perform lookups in the hashtable over the inner plan.
1072 */
1075
1076/* ----------------
1077 * materialization node
1078 * ----------------
1079 */
1080typedef struct Material
1081{
1084
1085/* ----------------
1086 * memoize node
1087 * ----------------
1088 */
1089typedef struct Memoize
1090{
1092
1093 /* size of the two arrays below */
1095
1096 /* hash operators for each key */
1098
1099 /* collations for each key */
1101
1102 /* cache keys in the form of exprs containing parameters */
1104
1105 /*
1106 * true if the cache entry should be marked as complete after we store the
1107 * first tuple in it.
1108 */
1110
1111 /*
1112 * true when cache key should be compared bit by bit, false when using
1113 * hash equality ops
1114 */
1116
1117 /*
1118 * The maximum number of entries that the planner expects will fit in the
1119 * cache, or 0 if unknown
1120 */
1122
1123 /* paramids from param_exprs */
1125
1126 /* Estimated number of rescans, for EXPLAIN */
1128
1129 /* Estimated number of distinct lookup keys, for EXPLAIN */
1131
1132 /* Estimated cache hit ratio, for EXPLAIN */
1134
1136
1137/* ----------------
1138 * sort node
1139 * ----------------
1140 */
1141typedef struct Sort
1142{
1144
1145 /* number of sort-key columns */
1147
1148 /* their indexes in the target list */
1150
1151 /* OIDs of operators to sort them by */
1153
1154 /* OIDs of collations */
1156
1157 /* NULLS FIRST/LAST directions */
1160
1161/* ----------------
1162 * incremental sort node
1163 * ----------------
1164 */
1165typedef struct IncrementalSort
1166{
1168 /* number of presorted columns */
1171
1172/* ---------------
1173 * group node -
1174 * Used for queries with GROUP BY (but no aggregates) specified.
1175 * The input must be presorted according to the grouping columns.
1176 * ---------------
1177 */
1178typedef struct Group
1179{
1181
1182 /* number of grouping columns */
1184
1185 /* their indexes in the target list */
1187
1188 /* equality operators to compare with */
1192
1193/* ---------------
1194 * aggregate node
1195 *
1196 * An Agg node implements plain or grouped aggregation. For grouped
1197 * aggregation, we can work with presorted input or unsorted input;
1198 * the latter strategy uses an internal hashtable.
1199 *
1200 * Notice the lack of any direct info about the aggregate functions to be
1201 * computed. They are found by scanning the node's tlist and quals during
1202 * executor startup. (It is possible that there are no aggregate functions;
1203 * this could happen if they get optimized away by constant-folding, or if
1204 * we are using the Agg node to implement hash-based grouping.)
1205 * ---------------
1206 */
1207typedef struct Agg
1208{
1210
1211 /* basic strategy, see nodes.h */
1213
1214 /* agg-splitting mode, see nodes.h */
1216
1217 /* number of grouping columns */
1219
1220 /* their indexes in the target list */
1222
1223 /* equality operators to compare with */
1226
1227 /* estimated number of groups in input */
1229
1230 /* for pass-by-ref transition data */
1232
1233 /* IDs of Params used in Aggref inputs */
1235
1236 /* Note: planner provides numGroups & aggParams only in HASHED/MIXED case */
1237
1238 /* grouping sets to use */
1240
1241 /* chained Agg/Sort nodes */
1244
1245/* ----------------
1246 * window aggregate node
1247 * ----------------
1248 */
1249typedef struct WindowAgg
1250{
1252
1253 /* name of WindowClause implemented by this node */
1254 char *winname;
1255
1256 /* ID referenced by window functions */
1258
1259 /* number of columns in partition clause */
1261
1262 /* their indexes in the target list */
1264
1265 /* equality operators for partition columns */
1267
1268 /* collations for partition columns */
1270
1271 /* number of columns in ordering clause */
1273
1274 /* their indexes in the target list */
1276
1277 /* equality operators for ordering columns */
1279
1280 /* collations for ordering columns */
1282
1283 /* frame_clause options, see WindowDef */
1285
1286 /* expression for starting bound, if any */
1288
1289 /* expression for ending bound, if any */
1291
1292 /* qual to help short-circuit execution */
1294
1295 /* runCondition for display in EXPLAIN */
1297
1298 /* these fields are used with RANGE offset PRECEDING/FOLLOWING: */
1299
1300 /* in_range function for startOffset */
1302
1303 /* in_range function for endOffset */
1305
1306 /* collation for in_range tests */
1308
1309 /* use ASC sort order for in_range tests? */
1311
1312 /* nulls sort first for in_range tests? */
1314
1315 /*
1316 * false for all apart from the WindowAgg that's closest to the root of
1317 * the plan
1318 */
1321
1322/* ----------------
1323 * unique node
1324 * ----------------
1325 */
1326typedef struct Unique
1327{
1329
1330 /* number of columns to check for uniqueness */
1332
1333 /* their indexes in the target list */
1335
1336 /* equality operators to compare with */
1338
1339 /* collations for equality comparisons */
1342
1343/* ------------
1344 * gather node
1345 *
1346 * Note: rescan_param is the ID of a PARAM_EXEC parameter slot. That slot
1347 * will never actually contain a value, but the Gather node must flag it as
1348 * having changed whenever it is rescanned. The child parallel-aware scan
1349 * nodes are marked as depending on that parameter, so that the rescan
1350 * machinery is aware that their output is likely to change across rescans.
1351 * In some cases we don't need a rescan Param, so rescan_param is set to -1.
1352 * ------------
1353 */
1354typedef struct Gather
1355{
1357 /* planned number of worker processes */
1359 /* ID of Param that signals a rescan, or -1 */
1361 /* don't execute plan more than once */
1363 /* suppress EXPLAIN display (for testing)? */
1365
1366 /*
1367 * param id's of initplans which are referred at gather or one of its
1368 * child nodes
1369 */
1372
1373/* ------------
1374 * gather merge node
1375 * ------------
1376 */
1377typedef struct GatherMerge
1378{
1380
1381 /* planned number of worker processes */
1383
1384 /* ID of Param that signals a rescan, or -1 */
1386
1387 /* remaining fields are just like the sort-key info in struct Sort */
1388
1389 /* number of sort-key columns */
1391
1392 /* their indexes in the target list */
1394
1395 /* OIDs of operators to sort them by */
1397
1398 /* OIDs of collations */
1400
1401 /* NULLS FIRST/LAST directions */
1403
1404 /*
1405 * param id's of initplans which are referred at gather merge or one of
1406 * its child nodes
1407 */
1410
1411/* ----------------
1412 * hash build node
1413 *
1414 * If the executor is supposed to try to apply skew join optimization, then
1415 * skewTable/skewColumn/skewInherit identify the outer relation's join key
1416 * column, from which the relevant MCV statistics can be fetched.
1417 * ----------------
1418 */
1419typedef struct Hash
1420{
1422
1423 /*
1424 * List of expressions to be hashed for tuples from Hash's outer plan,
1425 * needed to put them into the hashtable.
1426 */
1427 /* hash keys for the hashjoin condition */
1429 /* outer join key's table OID, or InvalidOid */
1431 /* outer join key's column #, or zero */
1433 /* is outer join rel an inheritance tree? */
1435 /* all other info is in the parent HashJoin node */
1436 /* estimate total rows if parallel_aware */
1439
1440/* ----------------
1441 * setop node
1442 * ----------------
1443 */
1444typedef struct SetOp
1445{
1447
1448 /* what to do, see nodes.h */
1450
1451 /* how to do it, see nodes.h */
1453
1454 /* number of columns to compare */
1456
1457 /* their indexes in the target list */
1459
1460 /* comparison operators (either equality operators or sort operators) */
1463
1464 /* nulls-first flags if sorting, otherwise not interesting */
1466
1467 /* estimated number of groups in left input */
1470
1471/* ----------------
1472 * lock-rows node
1473 *
1474 * rowMarks identifies the rels to be locked by this node; it should be
1475 * a subset of the rowMarks listed in the top-level PlannedStmt.
1476 * epqParam is a Param that all scan nodes below this one must depend on.
1477 * It is used to force re-evaluation of the plan during EvalPlanQual.
1478 * ----------------
1479 */
1480typedef struct LockRows
1481{
1483 /* a list of PlanRowMark's */
1485 /* ID of Param for EvalPlanQual re-eval */
1488
1489/* ----------------
1490 * limit node
1491 *
1492 * Note: as of Postgres 8.2, the offset and count expressions are expected
1493 * to yield int8, rather than int4 as before.
1494 * ----------------
1495 */
1496typedef struct Limit
1497{
1499
1500 /* OFFSET parameter, or NULL if none */
1502
1503 /* COUNT parameter, or NULL if none */
1505
1506 /* limit type */
1508
1509 /* number of columns to check for similarity */
1511
1512 /* their indexes in the target list */
1514
1515 /* equality operators to compare with */
1517
1518 /* collations for equality comparisons */
1521
1522
1523/*
1524 * RowMarkType -
1525 * enums for types of row-marking operations
1526 *
1527 * The first four of these values represent different lock strengths that
1528 * we can take on tuples according to SELECT FOR [KEY] UPDATE/SHARE requests.
1529 * We support these on regular tables, as well as on foreign tables whose FDWs
1530 * report support for late locking. For other foreign tables, any locking
1531 * that might be done for such requests must happen during the initial row
1532 * fetch; their FDWs provide no mechanism for going back to lock a row later.
1533 * This means that the semantics will be a bit different than for a local
1534 * table; in particular we are likely to lock more rows than would be locked
1535 * locally, since remote rows will be locked even if they then fail
1536 * locally-checked restriction or join quals. However, the prospect of
1537 * doing a separate remote query to lock each selected row is usually pretty
1538 * unappealing, so early locking remains a credible design choice for FDWs.
1539 *
1540 * When doing UPDATE/DELETE/MERGE/SELECT FOR UPDATE/SHARE, we have to uniquely
1541 * identify all the source rows, not only those from the target relations, so
1542 * that we can perform EvalPlanQual rechecking at need. For plain tables we
1543 * can just fetch the TID, much as for a target relation; this case is
1544 * represented by ROW_MARK_REFERENCE. Otherwise (for example for VALUES or
1545 * FUNCTION scans) we have to copy the whole row value. ROW_MARK_COPY is
1546 * pretty inefficient, since most of the time we'll never need the data; but
1547 * fortunately the overhead is usually not performance-critical in practice.
1548 * By default we use ROW_MARK_COPY for foreign tables, but if the FDW has
1549 * a concept of rowid it can request to use ROW_MARK_REFERENCE instead.
1550 * (Again, this probably doesn't make sense if a physical remote fetch is
1551 * needed, but for FDWs that map to local storage it might be credible.)
1552 */
1553typedef enum RowMarkType
1554{
1555 ROW_MARK_EXCLUSIVE, /* obtain exclusive tuple lock */
1556 ROW_MARK_NOKEYEXCLUSIVE, /* obtain no-key exclusive tuple lock */
1557 ROW_MARK_SHARE, /* obtain shared tuple lock */
1558 ROW_MARK_KEYSHARE, /* obtain keyshare tuple lock */
1559 ROW_MARK_REFERENCE, /* just fetch the TID, don't lock it */
1560 ROW_MARK_COPY, /* physically copy the row value */
1562
1563#define RowMarkRequiresRowShareLock(marktype) ((marktype) <= ROW_MARK_KEYSHARE)
1564
1565/*
1566 * PlanRowMark -
1567 * plan-time representation of FOR [KEY] UPDATE/SHARE clauses
1568 *
1569 * When doing UPDATE/DELETE/MERGE/SELECT FOR UPDATE/SHARE, we create a separate
1570 * PlanRowMark node for each non-target relation in the query. Relations that
1571 * are not specified as FOR UPDATE/SHARE are marked ROW_MARK_REFERENCE (if
1572 * regular tables or supported foreign tables) or ROW_MARK_COPY (if not).
1573 *
1574 * Initially all PlanRowMarks have rti == prti and isParent == false.
1575 * When the planner discovers that a relation is the root of an inheritance
1576 * tree, it sets isParent true, and adds an additional PlanRowMark to the
1577 * list for each child relation (including the target rel itself in its role
1578 * as a child, if it is not a partitioned table). Any non-leaf partitioned
1579 * child relations will also have entries with isParent = true. The child
1580 * entries have rti == child rel's RT index and prti == top parent's RT index,
1581 * and can therefore be recognized as children by the fact that prti != rti.
1582 * The parent's allMarkTypes field gets the OR of (1<<markType) across all
1583 * its children (this definition allows children to use different markTypes).
1584 *
1585 * The planner also adds resjunk output columns to the plan that carry
1586 * information sufficient to identify the locked or fetched rows. When
1587 * markType != ROW_MARK_COPY, these columns are named
1588 * tableoid%u OID of table
1589 * ctid%u TID of row
1590 * The tableoid column is only present for an inheritance hierarchy.
1591 * When markType == ROW_MARK_COPY, there is instead a single column named
1592 * wholerow%u whole-row value of relation
1593 * (An inheritance hierarchy could have all three resjunk output columns,
1594 * if some children use a different markType than others.)
1595 * In all three cases, %u represents the rowmark ID number (rowmarkId).
1596 * This number is unique within a plan tree, except that child relation
1597 * entries copy their parent's rowmarkId. (Assigning unique numbers
1598 * means we needn't renumber rowmarkIds when flattening subqueries, which
1599 * would require finding and renaming the resjunk columns as well.)
1600 * Note this means that all tables in an inheritance hierarchy share the
1601 * same resjunk column names.
1602 */
1603typedef struct PlanRowMark
1604{
1606
1607 NodeTag type;
1608 /* range table index of markable relation */
1610 /* range table index of parent relation */
1612 /* unique identifier for resjunk columns */
1614 /* see enum above */
1616 /* OR of (1<<markType) for all children */
1618 /* LockingClause's strength, or LCS_NONE */
1620 /* NOWAIT and SKIP LOCKED options */
1622 /* true if this is a "dummy" parent entry */
1625
1626
1627/*
1628 * Node types to represent partition pruning information.
1629 */
1630
1631/*
1632 * PartitionPruneInfo - Details required to allow the executor to prune
1633 * partitions.
1634 *
1635 * Here we store mapping details to allow translation of a partitioned table's
1636 * index as returned by the partition pruning code into subplan indexes for
1637 * plan types which support arbitrary numbers of subplans, such as Append.
1638 * We also store various details to tell the executor when it should be
1639 * performing partition pruning.
1640 *
1641 * Each PartitionedRelPruneInfo describes the partitioning rules for a single
1642 * partitioned table (a/k/a level of partitioning). Since a partitioning
1643 * hierarchy could contain multiple levels, we represent it by a List of
1644 * PartitionedRelPruneInfos, where the first entry represents the topmost
1645 * partitioned table and additional entries represent non-leaf child
1646 * partitions, ordered such that parents appear before their children.
1647 * Then, since an Append-type node could have multiple partitioning
1648 * hierarchies among its children, we have an unordered List of those Lists.
1649 *
1650 * relids RelOptInfo.relids of the parent plan node (e.g. Append
1651 * or MergeAppend) to which this PartitionPruneInfo node
1652 * belongs. The pruning logic ensures that this matches
1653 * the parent plan node's apprelids.
1654 * prune_infos List of Lists containing PartitionedRelPruneInfo nodes,
1655 * one sublist per run-time-prunable partition hierarchy
1656 * appearing in the parent plan node's subplans.
1657 * other_subplans Indexes of any subplans that are not accounted for
1658 * by any of the PartitionedRelPruneInfo nodes in
1659 * "prune_infos". These subplans must not be pruned.
1660 */
1670
1671/*
1672 * PartitionedRelPruneInfo - Details required to allow the executor to prune
1673 * partitions for a single partitioned table.
1674 *
1675 * subplan_map[], subpart_map[], and leafpart_rti_map[] are indexed by partition
1676 * index of the partitioned table referenced by 'rtindex', the partition index
1677 * being the order that the partitions are defined in the table's
1678 * PartitionDesc. For a leaf partition p, subplan_map[p] contains the
1679 * zero-based index of the partition's subplan in the parent plan's subplan
1680 * list; it is -1 if the partition is non-leaf or has been pruned. For a
1681 * non-leaf partition p, subpart_map[p] contains the zero-based index of that
1682 * sub-partition's PartitionedRelPruneInfo in the hierarchy's
1683 * PartitionedRelPruneInfo list; it is -1 if the partition is a leaf or has
1684 * been pruned. leafpart_rti_map[p] contains the RT index of a leaf partition
1685 * if its subplan is in the parent plan' subplan list; it is 0 either if the
1686 * partition is non-leaf or it is leaf but has been pruned during planning.
1687 * Note that subplan indexes, as stored in 'subplan_map', are global across the
1688 * parent plan node, but partition indexes are valid only within a particular
1689 * hierarchy. relid_map[p] contains the partition's OID, or 0 if the partition
1690 * was pruned.
1691 */
1693{
1695
1696 NodeTag type;
1697
1698 /* RT index of partition rel for this level */
1700
1701 /* Indexes of all partitions which subplans or subparts are present for */
1703
1704 /* Length of the following arrays: */
1706
1707 /* subplan index by partition index, or -1 */
1708 int *subplan_map pg_node_attr(array_size(nparts));
1709
1710 /* subpart index by partition index, or -1 */
1711 int *subpart_map pg_node_attr(array_size(nparts));
1712
1713 /* RT index by partition index, or 0 */
1714 int *leafpart_rti_map pg_node_attr(array_size(nparts));
1715
1716 /* relation OID by partition index, or 0 */
1718
1719 /*
1720 * initial_pruning_steps shows how to prune during executor startup (i.e.,
1721 * without use of any PARAM_EXEC Params); it is NIL if no startup pruning
1722 * is required. exec_pruning_steps shows how to prune with PARAM_EXEC
1723 * Params; it is NIL if no per-scan pruning is required.
1724 */
1725 /* List of PartitionPruneStep */
1727 /* List of PartitionPruneStep */
1729
1730 /* All PARAM_EXEC Param IDs in exec_pruning_steps */
1733
1734/*
1735 * Abstract Node type for partition pruning steps (there are no concrete
1736 * Nodes of this type).
1737 *
1738 * step_id is the global identifier of the step within its pruning context.
1739 */
1747
1748/*
1749 * PartitionPruneStepOp - Information to prune using a set of mutually ANDed
1750 * OpExpr clauses
1751 *
1752 * This contains information extracted from up to partnatts OpExpr clauses,
1753 * where partnatts is the number of partition key columns. 'opstrategy' is the
1754 * strategy of the operator in the clause matched to the last partition key.
1755 * 'exprs' contains expressions which comprise the lookup key to be passed to
1756 * the partition bound search function. 'cmpfns' contains the OIDs of
1757 * comparison functions used to compare aforementioned expressions with
1758 * partition bounds. Both 'exprs' and 'cmpfns' contain the same number of
1759 * items, up to partnatts items.
1760 *
1761 * Once we find the offset of a partition bound using the lookup key, we
1762 * determine which partitions to include in the result based on the value of
1763 * 'opstrategy'. For example, if it were equality, we'd return just the
1764 * partition that would contain that key or a set of partitions if the key
1765 * didn't consist of all partitioning columns. For non-equality strategies,
1766 * we'd need to include other partitions as appropriate.
1767 *
1768 * 'nullkeys' is the set containing the offset of the partition keys (0 to
1769 * partnatts - 1) that were matched to an IS NULL clause. This is only
1770 * considered for hash partitioning as we need to pass which keys are null
1771 * to the hash partition bound search function. It is never possible to
1772 * have an expression be present in 'exprs' for a given partition key and
1773 * the corresponding bit set in 'nullkeys'.
1774 */
1784
1785/*
1786 * PartitionPruneStepCombine - Information to prune using a BoolExpr clause
1787 *
1788 * For BoolExpr clauses, we combine the set of partitions determined for each
1789 * of the argument clauses.
1790 */
1796
1804
1805
1806/*
1807 * Plan invalidation info
1808 *
1809 * We track the objects on which a PlannedStmt depends in two ways:
1810 * relations are recorded as a simple list of OIDs, and everything else
1811 * is represented as a list of PlanInvalItems. A PlanInvalItem is designed
1812 * to be used with the syscache invalidation mechanism, so it identifies a
1813 * system catalog entry by cache ID and hash value.
1814 */
1815typedef struct PlanInvalItem
1816{
1818
1819 NodeTag type;
1820 /* a syscache ID, see utils/syscache.h */
1822 /* hash value of object's cache lookup key */
1825
1826/*
1827 * MonotonicFunction
1828 *
1829 * Allows the planner to track monotonic properties of functions. A function
1830 * is monotonically increasing if a subsequent call cannot yield a lower value
1831 * than the previous call. A monotonically decreasing function cannot yield a
1832 * higher value on subsequent calls, and a function which is both must return
1833 * the same value on each call.
1834 */
1842
1843/*
1844 * SubPlanRTInfo
1845 *
1846 * Information about which range table entries came from which subquery
1847 * planning cycles.
1848 */
1856
1857/*
1858 * ElidedNode
1859 *
1860 * Information about nodes elided from the final plan tree: trivial subquery
1861 * scans, and single-child Append and MergeAppend nodes.
1862 *
1863 * plan_node_id is that of the surviving plan node, the sole child of the
1864 * one which was elided.
1865 */
1873
1874#endif /* PLANNODES_H */
int16 AttrNumber
Definition attnum.h:21
int64_t int64
Definition c.h:555
uint64_t uint64
Definition c.h:559
uint32_t uint32
Definition c.h:558
unsigned int Index
Definition c.h:640
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:765
@ SUBQUERY_SCAN_NONTRIVIAL
Definition plannodes.h:768
@ SUBQUERY_SCAN_UNKNOWN
Definition plannodes.h:766
@ SUBQUERY_SCAN_TRIVIAL
Definition plannodes.h:767
PartitionPruneCombineOp
Definition plannodes.h:1792
@ PARTPRUNE_COMBINE_INTERSECT
Definition plannodes.h:1794
@ PARTPRUNE_COMBINE_UNION
Definition plannodes.h:1793
PlannedStmtOrigin
Definition plannodes.h:38
@ PLAN_STMT_STANDARD
Definition plannodes.h:41
@ PLAN_STMT_UNKNOWN
Definition plannodes.h:39
@ PLAN_STMT_CACHE_CUSTOM
Definition plannodes.h:43
@ PLAN_STMT_CACHE_GENERIC
Definition plannodes.h:42
@ PLAN_STMT_INTERNAL
Definition plannodes.h:40
ResultType
Definition plannodes.h: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:1554
@ ROW_MARK_COPY
Definition plannodes.h:1560
@ ROW_MARK_REFERENCE
Definition plannodes.h:1559
@ ROW_MARK_SHARE
Definition plannodes.h:1557
@ ROW_MARK_EXCLUSIVE
Definition plannodes.h:1555
@ ROW_MARK_NOKEYEXCLUSIVE
Definition plannodes.h:1556
@ ROW_MARK_KEYSHARE
Definition plannodes.h:1558
MonotonicFunction
Definition plannodes.h:1836
@ MONOTONICFUNC_NONE
Definition plannodes.h:1837
@ MONOTONICFUNC_DECREASING
Definition plannodes.h:1839
@ MONOTONICFUNC_INCREASING
Definition plannodes.h:1838
@ MONOTONICFUNC_BOTH
Definition plannodes.h:1840
unsigned int Oid
static int fb(int x)
ScanDirection
Definition sdir.h:25
uint16 StrategyNumber
Definition stratnum.h:22
AggSplit aggsplit
Definition plannodes.h:1215
List * chain
Definition plannodes.h:1242
Oid *grpCollations pg_node_attr(array_size(numCols))
List * groupingSets
Definition plannodes.h:1239
Bitmapset * aggParams
Definition plannodes.h:1234
Cardinality numGroups
Definition plannodes.h:1228
Plan plan
Definition plannodes.h:1209
int numCols
Definition plannodes.h:1218
Oid *grpOperators pg_node_attr(array_size(numCols))
uint64 transitionSpace
Definition plannodes.h:1231
AttrNumber *grpColIdx pg_node_attr(array_size(numCols))
AggStrategy aggstrategy
Definition plannodes.h:1212
int first_partial_plan
Definition plannodes.h:416
int part_prune_index
Definition plannodes.h:423
int nasyncplans
Definition plannodes.h:410
List * child_append_relid_sets
Definition plannodes.h:404
Bitmapset * apprelids
Definition plannodes.h:401
Plan plan
Definition plannodes.h:398
List * appendplans
Definition plannodes.h:407
Plan plan
Definition plannodes.h:510
List * bitmapplans
Definition plannodes.h:511
List * bitmapqualorig
Definition plannodes.h:712
List * indexqualorig
Definition plannodes.h:696
List * bitmapplans
Definition plannodes.h:526
bool isshared
Definition plannodes.h:525
Plan plan
Definition plannodes.h:524
int ctePlanId
Definition plannodes.h:821
int cteParam
Definition plannodes.h:823
Scan scan
Definition plannodes.h:819
uint32 flags
Definition plannodes.h:934
List * custom_scan_tlist
Definition plannodes.h:942
List * custom_private
Definition plannodes.h:940
Bitmapset * custom_relids
Definition plannodes.h:944
List * custom_exprs
Definition plannodes.h:938
const struct CustomScanMethods * methods
Definition plannodes.h:951
List * custom_plans
Definition plannodes.h:936
NodeTag type
Definition plannodes.h:1868
NodeTag elided_type
Definition plannodes.h:1870
int plan_node_id
Definition plannodes.h:1869
Bitmapset * relids
Definition plannodes.h:1871
Oid checkAsUser
Definition plannodes.h:896
CmdType operation
Definition plannodes.h:892
List * fdw_exprs
Definition plannodes.h:900
bool fsSystemCol
Definition plannodes.h:912
Bitmapset * fs_relids
Definition plannodes.h:908
List * fdw_private
Definition plannodes.h:902
Bitmapset * fs_base_relids
Definition plannodes.h:910
Index resultRelation
Definition plannodes.h:894
List * fdw_recheck_quals
Definition plannodes.h:906
List * fdw_scan_tlist
Definition plannodes.h:904
List * functions
Definition plannodes.h:786
bool funcordinality
Definition plannodes.h:788
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:1408
AttrNumber *sortColIdx pg_node_attr(array_size(numCols))
int num_workers
Definition plannodes.h:1358
bool invisible
Definition plannodes.h:1364
Bitmapset * initParam
Definition plannodes.h:1370
bool single_copy
Definition plannodes.h:1362
Plan plan
Definition plannodes.h:1356
int rescan_param
Definition plannodes.h:1360
AttrNumber *grpColIdx pg_node_attr(array_size(numCols))
int numCols
Definition plannodes.h:1183
Plan plan
Definition plannodes.h:1180
Oid *grpCollations pg_node_attr(array_size(numCols))
Oid *grpOperators pg_node_attr(array_size(numCols))
List * hashcollations
Definition plannodes.h:1067
List * hashclauses
Definition plannodes.h:1065
List * hashoperators
Definition plannodes.h:1066
Join join
Definition plannodes.h:1064
List * hashkeys
Definition plannodes.h:1073
AttrNumber skewColumn
Definition plannodes.h:1432
List * hashkeys
Definition plannodes.h:1428
Oid skewTable
Definition plannodes.h:1430
bool skewInherit
Definition plannodes.h:1434
Cardinality rows_total
Definition plannodes.h:1437
Plan plan
Definition plannodes.h:1421
List * indexqual
Definition plannodes.h:658
List * recheckqual
Definition plannodes.h:660
List * indextlist
Definition plannodes.h:664
ScanDirection indexorderdir
Definition plannodes.h:666
List * indexorderby
Definition plannodes.h:662
List * indexorderby
Definition plannodes.h:612
List * indexorderbyops
Definition plannodes.h:616
ScanDirection indexorderdir
Definition plannodes.h:618
Scan scan
Definition plannodes.h:604
List * indexqualorig
Definition plannodes.h:610
Oid indexid
Definition plannodes.h:606
List * indexqual
Definition plannodes.h:608
List * indexorderbyorig
Definition plannodes.h:614
pg_node_attr(abstract) Plan plan
List * joinqual
Definition plannodes.h:990
JoinType jointype
Definition plannodes.h:987
bool inner_unique
Definition plannodes.h:988
LimitOption limitOption
Definition plannodes.h:1507
Oid *uniqOperators pg_node_attr(array_size(uniqNumCols))
Plan plan
Definition plannodes.h:1498
Node * limitCount
Definition plannodes.h:1504
AttrNumber *uniqColIdx pg_node_attr(array_size(uniqNumCols))
int uniqNumCols
Definition plannodes.h:1510
Oid *uniqCollations pg_node_attr(array_size(uniqNumCols))
Node * limitOffset
Definition plannodes.h:1501
Definition pg_list.h:54
int epqParam
Definition plannodes.h:1486
List * rowMarks
Definition plannodes.h:1484
Plan plan
Definition plannodes.h:1482
Plan plan
Definition plannodes.h:1082
Plan plan
Definition plannodes.h:1091
bool singlerow
Definition plannodes.h:1109
Cardinality est_calls
Definition plannodes.h:1127
Bitmapset * keyparamids
Definition plannodes.h:1124
Oid *hashOperators pg_node_attr(array_size(numKeys))
bool binary_mode
Definition plannodes.h:1115
int numKeys
Definition plannodes.h:1094
Cardinality est_unique_keys
Definition plannodes.h:1130
List * param_exprs
Definition plannodes.h:1103
double est_hit_ratio
Definition plannodes.h:1133
uint32 est_entries
Definition plannodes.h:1121
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:466
Oid *sortOperators pg_node_attr(array_size(numCols))
Bitmapset * apprelids
Definition plannodes.h:436
Oid *collations pg_node_attr(array_size(numCols))
List * mergeplans
Definition plannodes.h:442
List * child_append_relid_sets
Definition plannodes.h:439
List * mergeclauses
Definition plannodes.h:1041
Oid *mergeFamilies pg_node_attr(array_size(mergeclauses))
bool skip_mark_restore
Definition plannodes.h:1038
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:386
char * returningOldAlias
Definition plannodes.h:354
char * returningNewAlias
Definition plannodes.h:356
CmdType operation
Definition plannodes.h:340
List * resultRelations
Definition plannodes.h:348
Bitmapset * fdwDirectModifyPlans
Definition plannodes.h:362
List * onConflictSet
Definition plannodes.h:374
List * exclRelTlist
Definition plannodes.h:382
List * mergeActionLists
Definition plannodes.h:384
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:380
pg_node_attr(no_equal, no_query_jumble) NodeTag type
List * nestParams
Definition plannodes.h:1008
Join join
Definition plannodes.h:1006
Definition nodes.h:135
Bitmapset * other_subplans
Definition plannodes.h:1668
Bitmapset * relids
Definition plannodes.h:1666
pg_node_attr(no_equal, no_query_jumble) NodeTag type
PartitionPruneCombineOp combineOp
Definition plannodes.h:1801
PartitionPruneStep step
Definition plannodes.h:1799
PartitionPruneStep step
Definition plannodes.h:1777
StrategyNumber opstrategy
Definition plannodes.h:1779
Bitmapset * nullkeys
Definition plannodes.h:1782
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:1702
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:1823
pg_node_attr(no_equal, no_query_jumble) NodeTag type
LockClauseStrength strength
Definition plannodes.h:1619
RowMarkType markType
Definition plannodes.h:1615
LockWaitPolicy waitPolicy
Definition plannodes.h:1621
Index rowmarkId
Definition plannodes.h:1613
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:101
bool hasModifyingCTE
Definition plannodes.h:83
List * appendRelations
Definition plannodes.h:127
List * elidedNodes
Definition plannodes.h:156
List * permInfos
Definition plannodes.h:120
bool canSetTag
Definition plannodes.h:86
List * rowMarks
Definition plannodes.h:141
int64 planId
Definition plannodes.h:74
Bitmapset * rewindPlanIDs
Definition plannodes.h:138
List * extension_state
Definition plannodes.h:165
int64 queryId
Definition plannodes.h:71
ParseLoc stmt_len
Definition plannodes.h:171
PlannedStmtOrigin planOrigin
Definition plannodes.h:77
bool hasReturning
Definition plannodes.h:80
ParseLoc stmt_location
Definition plannodes.h:169
List * invalItems
Definition plannodes.h:147
bool transientPlan
Definition plannodes.h:89
List * resultRelations
Definition plannodes.h:124
List * subplans
Definition plannodes.h:132
List * relationOids
Definition plannodes.h:144
List * subrtinfos
Definition plannodes.h:135
bool dependsOnRole
Definition plannodes.h:92
Bitmapset * unprunableRelids
Definition plannodes.h:115
CmdType commandType
Definition plannodes.h:68
pg_node_attr(no_equal, no_query_jumble) NodeTag type
Node * utilityStmt
Definition plannodes.h:153
List * rtable
Definition plannodes.h:109
List * partPruneInfos
Definition plannodes.h:106
List * paramExecTypes
Definition plannodes.h:150
bool parallelModeNeeded
Definition plannodes.h:95
AttrNumber *dupColIdx pg_node_attr(array_size(numCols))
Cardinality numGroups
Definition plannodes.h:497
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:562
Index scanrelid
Definition plannodes.h:542
pg_node_attr(abstract) Plan plan
Scan scan
Definition plannodes.h:551
SetOpStrategy strategy
Definition plannodes.h:1452
Oid *cmpOperators pg_node_attr(array_size(numCols))
AttrNumber *cmpColIdx pg_node_attr(array_size(numCols))
SetOpCmd cmd
Definition plannodes.h:1449
Oid *cmpCollations pg_node_attr(array_size(numCols))
int numCols
Definition plannodes.h:1455
Plan plan
Definition plannodes.h:1446
bool *cmpNullsFirst pg_node_attr(array_size(numCols))
Cardinality numGroups
Definition plannodes.h:1468
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:1146
AttrNumber *sortColIdx pg_node_attr(array_size(numCols))
Plan plan
Definition plannodes.h:1143
char * plan_name
Definition plannodes.h:1852
SubqueryScanStatus scanstatus
Definition plannodes.h:775
Plan * subplan
Definition plannodes.h:774
TableFunc * tablefunc
Definition plannodes.h:810
List * tidrangequals
Definition plannodes.h:741
Scan scan
Definition plannodes.h:725
List * tidquals
Definition plannodes.h:727
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:1328
int numCols
Definition plannodes.h:1331
List * values_lists
Definition plannodes.h:799
AttrNumber *ordColIdx pg_node_attr(array_size(ordNumCols))
char * winname
Definition plannodes.h:1254
int partNumCols
Definition plannodes.h:1260
Oid endInRangeFunc
Definition plannodes.h:1304
Node * endOffset
Definition plannodes.h:1290
Oid *partCollations pg_node_attr(array_size(partNumCols))
bool topWindow
Definition plannodes.h:1319
Oid *ordOperators pg_node_attr(array_size(ordNumCols))
List * runConditionOrig
Definition plannodes.h:1296
Oid inRangeColl
Definition plannodes.h:1307
Node * startOffset
Definition plannodes.h:1287
List * runCondition
Definition plannodes.h:1293
Oid startInRangeFunc
Definition plannodes.h:1301
bool inRangeAsc
Definition plannodes.h:1310
Index winref
Definition plannodes.h:1257
AttrNumber *partColIdx pg_node_attr(array_size(partNumCols))
bool inRangeNullsFirst
Definition plannodes.h:1313
Oid *partOperators pg_node_attr(array_size(partNumCols))
int ordNumCols
Definition plannodes.h:1272
Oid *ordCollations pg_node_attr(array_size(ordNumCols))
int frameOptions
Definition plannodes.h:1284
const char * type