PostgreSQL Source Code  git master
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-2021, 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 "lib/stringinfo.h"
20 #include "nodes/bitmapset.h"
21 #include "nodes/lockoptions.h"
22 #include "nodes/primnodes.h"
23 
24 
25 /* ----------------------------------------------------------------
26  * node definitions
27  * ----------------------------------------------------------------
28  */
29 
30 /* ----------------
31  * PlannedStmt node
32  *
33  * The output of the planner is a Plan tree headed by a PlannedStmt node.
34  * PlannedStmt holds the "one time" information needed by the executor.
35  *
36  * For simplicity in APIs, we also wrap utility statements in PlannedStmt
37  * nodes; in such cases, commandType == CMD_UTILITY, the statement itself
38  * is in the utilityStmt field, and the rest of the struct is mostly dummy.
39  * (We do use canSetTag, stmt_location, stmt_len, and possibly queryId.)
40  * ----------------
41  */
42 typedef struct PlannedStmt
43 {
45 
46  CmdType commandType; /* select|insert|update|delete|utility */
47 
48  uint64 queryId; /* query identifier (copied from Query) */
49 
50  bool hasReturning; /* is it insert|update|delete RETURNING? */
51 
52  bool hasModifyingCTE; /* has insert|update|delete in WITH? */
53 
54  bool canSetTag; /* do I set the command result tag? */
55 
56  bool transientPlan; /* redo plan when TransactionXmin changes? */
57 
58  bool dependsOnRole; /* is plan specific to current role? */
59 
60  bool parallelModeNeeded; /* parallel mode required to execute? */
61 
62  int jitFlags; /* which forms of JIT should be performed */
63 
64  struct Plan *planTree; /* tree of Plan nodes */
65 
66  List *rtable; /* list of RangeTblEntry nodes */
67 
68  /* rtable indexes of target relations for INSERT/UPDATE/DELETE */
69  List *resultRelations; /* integer list of RT indexes, or NIL */
70 
71  List *appendRelations; /* list of AppendRelInfo nodes */
72 
73  List *subplans; /* Plan trees for SubPlan expressions; note
74  * that some could be NULL */
75 
76  Bitmapset *rewindPlanIDs; /* indices of subplans that require REWIND */
77 
78  List *rowMarks; /* a list of PlanRowMark's */
79 
80  List *relationOids; /* OIDs of relations the plan depends on */
81 
82  List *invalItems; /* other dependencies, as PlanInvalItems */
83 
84  List *paramExecTypes; /* type OIDs for PARAM_EXEC Params */
85 
86  Node *utilityStmt; /* non-null if this is utility stmt */
87 
88  /* statement location in source string (copied from Query) */
89  int stmt_location; /* start location, or -1 if unknown */
90  int stmt_len; /* length in bytes; 0 means "rest of string" */
92 
93 /* macro for fetching the Plan associated with a SubPlan node */
94 #define exec_subplan_get_plan(plannedstmt, subplan) \
95  ((Plan *) list_nth((plannedstmt)->subplans, (subplan)->plan_id - 1))
96 
97 
98 /* ----------------
99  * Plan node
100  *
101  * All plan nodes "derive" from the Plan structure by having the
102  * Plan structure as the first field. This ensures that everything works
103  * when nodes are cast to Plan's. (node pointers are frequently cast to Plan*
104  * when passed around generically in the executor)
105  *
106  * We never actually instantiate any Plan nodes; this is just the common
107  * abstract superclass for all Plan-type nodes.
108  * ----------------
109  */
110 typedef struct Plan
111 {
113 
114  /*
115  * estimated execution costs for plan (see costsize.c for more info)
116  */
117  Cost startup_cost; /* cost expended before fetching any tuples */
118  Cost total_cost; /* total cost (assuming all tuples fetched) */
119 
120  /*
121  * planner's estimate of result size of this plan step
122  */
123  Cardinality plan_rows; /* number of rows plan is expected to emit */
124  int plan_width; /* average row width in bytes */
125 
126  /*
127  * information needed for parallel query
128  */
129  bool parallel_aware; /* engage parallel-aware logic? */
130  bool parallel_safe; /* OK to use as part of parallel plan? */
131 
132  /*
133  * information needed for asynchronous execution
134  */
135  bool async_capable; /* engage asynchronous-capable logic? */
136 
137  /*
138  * Common structural data for all Plan types.
139  */
140  int plan_node_id; /* unique across entire final plan tree */
141  List *targetlist; /* target list to be computed at this node */
142  List *qual; /* implicitly-ANDed qual conditions */
143  struct Plan *lefttree; /* input plan tree(s) */
144  struct Plan *righttree;
145  List *initPlan; /* Init Plan nodes (un-correlated expr
146  * subselects) */
147 
148  /*
149  * Information for management of parameter-change-driven rescanning
150  *
151  * extParam includes the paramIDs of all external PARAM_EXEC params
152  * affecting this plan node or its children. setParam params from the
153  * node's initPlans are not included, but their extParams are.
154  *
155  * allParam includes all the extParam paramIDs, plus the IDs of local
156  * params that affect the node (i.e., the setParams of its initplans).
157  * These are _all_ the PARAM_EXEC params that affect this node.
158  */
162 
163 /* ----------------
164  * these are defined to avoid confusion problems with "left"
165  * and "right" and "inner" and "outer". The convention is that
166  * the "left" plan is the "outer" plan and the "right" plan is
167  * the inner plan, but these make the code more readable.
168  * ----------------
169  */
170 #define innerPlan(node) (((Plan *)(node))->righttree)
171 #define outerPlan(node) (((Plan *)(node))->lefttree)
172 
173 
174 /* ----------------
175  * Result node -
176  * If no outer plan, evaluate a variable-free targetlist.
177  * If outer plan, return tuples from outer plan (after a level of
178  * projection as shown by targetlist).
179  *
180  * If resconstantqual isn't NULL, it represents a one-time qualification
181  * test (i.e., one that doesn't depend on any variables from the outer plan,
182  * so needs to be evaluated only once).
183  * ----------------
184  */
185 typedef struct Result
186 {
190 
191 /* ----------------
192  * ProjectSet node -
193  * Apply a projection that includes set-returning functions to the
194  * output tuples of the outer plan.
195  * ----------------
196  */
197 typedef struct ProjectSet
198 {
201 
202 /* ----------------
203  * ModifyTable node -
204  * Apply rows produced by outer plan to result table(s),
205  * by inserting, updating, or deleting.
206  *
207  * If the originally named target table is a partitioned table, both
208  * nominalRelation and rootRelation contain the RT index of the partition
209  * root, which is not otherwise mentioned in the plan. Otherwise rootRelation
210  * is zero. However, nominalRelation will always be set, as it's the rel that
211  * EXPLAIN should claim is the INSERT/UPDATE/DELETE target.
212  *
213  * Note that rowMarks and epqParam are presumed to be valid for all the
214  * table(s); they can't contain any info that varies across tables.
215  * ----------------
216  */
217 typedef struct ModifyTable
218 {
220  CmdType operation; /* INSERT, UPDATE, or DELETE */
221  bool canSetTag; /* do we set the command tag/es_processed? */
222  Index nominalRelation; /* Parent RT index for use of EXPLAIN */
223  Index rootRelation; /* Root RT index, if target is partitioned */
224  bool partColsUpdated; /* some part key in hierarchy updated? */
225  List *resultRelations; /* integer list of RT indexes */
226  List *updateColnosLists; /* per-target-table update_colnos lists */
227  List *withCheckOptionLists; /* per-target-table WCO lists */
228  List *returningLists; /* per-target-table RETURNING tlists */
229  List *fdwPrivLists; /* per-target-table FDW private data lists */
230  Bitmapset *fdwDirectModifyPlans; /* indices of FDW DM plans */
231  List *rowMarks; /* PlanRowMarks (non-locking only) */
232  int epqParam; /* ID of Param for EvalPlanQual re-eval */
233  OnConflictAction onConflictAction; /* ON CONFLICT action */
234  List *arbiterIndexes; /* List of ON CONFLICT arbiter index OIDs */
235  List *onConflictSet; /* INSERT ON CONFLICT DO UPDATE targetlist */
236  List *onConflictCols; /* target column numbers for onConflictSet */
237  Node *onConflictWhere; /* WHERE for ON CONFLICT UPDATE */
238  Index exclRelRTI; /* RTI of the EXCLUDED pseudo relation */
239  List *exclRelTlist; /* tlist of the EXCLUDED pseudo relation */
241 
242 struct PartitionPruneInfo; /* forward reference to struct below */
243 
244 /* ----------------
245  * Append node -
246  * Generate the concatenation of the results of sub-plans.
247  * ----------------
248  */
249 typedef struct Append
250 {
252  Bitmapset *apprelids; /* RTIs of appendrel(s) formed by this node */
254  int nasyncplans; /* # of asynchronous plans */
255 
256  /*
257  * All 'appendplans' preceding this index are non-partial plans. All
258  * 'appendplans' from this index onwards are partial plans.
259  */
261 
262  /* Info for run-time subplan pruning; NULL if we're not doing that */
265 
266 /* ----------------
267  * MergeAppend node -
268  * Merge the results of pre-sorted sub-plans to preserve the ordering.
269  * ----------------
270  */
271 typedef struct MergeAppend
272 {
274  Bitmapset *apprelids; /* RTIs of appendrel(s) formed by this node */
276  /* these fields are just like the sort-key info in struct Sort: */
277  int numCols; /* number of sort-key columns */
278  AttrNumber *sortColIdx; /* their indexes in the target list */
279  Oid *sortOperators; /* OIDs of operators to sort them by */
280  Oid *collations; /* OIDs of collations */
281  bool *nullsFirst; /* NULLS FIRST/LAST directions */
282  /* Info for run-time subplan pruning; NULL if we're not doing that */
285 
286 /* ----------------
287  * RecursiveUnion node -
288  * Generate a recursive union of two subplans.
289  *
290  * The "outer" subplan is always the non-recursive term, and the "inner"
291  * subplan is the recursive term.
292  * ----------------
293  */
294 typedef struct RecursiveUnion
295 {
297  int wtParam; /* ID of Param representing work table */
298  /* Remaining fields are zero/null in UNION ALL case */
299  int numCols; /* number of columns to check for
300  * duplicate-ness */
301  AttrNumber *dupColIdx; /* their indexes in the target list */
302  Oid *dupOperators; /* equality operators to compare with */
304  long numGroups; /* estimated number of groups in input */
306 
307 /* ----------------
308  * BitmapAnd node -
309  * Generate the intersection of the results of sub-plans.
310  *
311  * The subplans must be of types that yield tuple bitmaps. The targetlist
312  * and qual fields of the plan are unused and are always NIL.
313  * ----------------
314  */
315 typedef struct BitmapAnd
316 {
320 
321 /* ----------------
322  * BitmapOr node -
323  * Generate the union of the results of sub-plans.
324  *
325  * The subplans must be of types that yield tuple bitmaps. The targetlist
326  * and qual fields of the plan are unused and are always NIL.
327  * ----------------
328  */
329 typedef struct BitmapOr
330 {
332  bool isshared;
335 
336 /*
337  * ==========
338  * Scan nodes
339  * ==========
340  */
341 typedef struct Scan
342 {
344  Index scanrelid; /* relid is index into the range table */
346 
347 /* ----------------
348  * sequential scan node
349  * ----------------
350  */
351 typedef struct SeqScan
352 {
355 
356 /* ----------------
357  * table sample scan node
358  * ----------------
359  */
360 typedef struct SampleScan
361 {
363  /* use struct pointer to avoid including parsenodes.h here */
366 
367 /* ----------------
368  * index scan node
369  *
370  * indexqualorig is an implicitly-ANDed list of index qual expressions, each
371  * in the same form it appeared in the query WHERE condition. Each should
372  * be of the form (indexkey OP comparisonval) or (comparisonval OP indexkey).
373  * The indexkey is a Var or expression referencing column(s) of the index's
374  * base table. The comparisonval might be any expression, but it won't use
375  * any columns of the base table. The expressions are ordered by index
376  * column position (but items referencing the same index column can appear
377  * in any order). indexqualorig is used at runtime only if we have to recheck
378  * a lossy indexqual.
379  *
380  * indexqual has the same form, but the expressions have been commuted if
381  * necessary to put the indexkeys on the left, and the indexkeys are replaced
382  * by Var nodes identifying the index columns (their varno is INDEX_VAR and
383  * their varattno is the index column number).
384  *
385  * indexorderbyorig is similarly the original form of any ORDER BY expressions
386  * that are being implemented by the index, while indexorderby is modified to
387  * have index column Vars on the left-hand side. Here, multiple expressions
388  * must appear in exactly the ORDER BY order, and this is not necessarily the
389  * index column order. Only the expressions are provided, not the auxiliary
390  * sort-order information from the ORDER BY SortGroupClauses; it's assumed
391  * that the sort ordering is fully determinable from the top-level operators.
392  * indexorderbyorig is used at runtime to recheck the ordering, if the index
393  * cannot calculate an accurate ordering. It is also needed for EXPLAIN.
394  *
395  * indexorderbyops is a list of the OIDs of the operators used to sort the
396  * ORDER BY expressions. This is used together with indexorderbyorig to
397  * recheck ordering at run time. (Note that indexorderby, indexorderbyorig,
398  * and indexorderbyops are used for amcanorderbyop cases, not amcanorder.)
399  *
400  * indexorderdir specifies the scan ordering, for indexscans on amcanorder
401  * indexes (for other indexes it should be "don't care").
402  * ----------------
403  */
404 typedef struct IndexScan
405 {
407  Oid indexid; /* OID of index to scan */
408  List *indexqual; /* list of index quals (usually OpExprs) */
409  List *indexqualorig; /* the same in original form */
410  List *indexorderby; /* list of index ORDER BY exprs */
411  List *indexorderbyorig; /* the same in original form */
412  List *indexorderbyops; /* OIDs of sort ops for ORDER BY exprs */
413  ScanDirection indexorderdir; /* forward or backward or don't care */
415 
416 /* ----------------
417  * index-only scan node
418  *
419  * IndexOnlyScan is very similar to IndexScan, but it specifies an
420  * index-only scan, in which the data comes from the index not the heap.
421  * Because of this, *all* Vars in the plan node's targetlist, qual, and
422  * index expressions reference index columns and have varno = INDEX_VAR.
423  * Hence we do not need separate indexqualorig and indexorderbyorig lists,
424  * since their contents would be equivalent to indexqual and indexorderby.
425  *
426  * To help EXPLAIN interpret the index Vars for display, we provide
427  * indextlist, which represents the contents of the index as a targetlist
428  * with one TLE per index column. Vars appearing in this list reference
429  * the base table, and this is the only field in the plan node that may
430  * contain such Vars.
431  * ----------------
432  */
433 typedef struct IndexOnlyScan
434 {
436  Oid indexid; /* OID of index to scan */
437  List *indexqual; /* list of index quals (usually OpExprs) */
438  List *indexorderby; /* list of index ORDER BY exprs */
439  List *indextlist; /* TargetEntry list describing index's cols */
440  ScanDirection indexorderdir; /* forward or backward or don't care */
442 
443 /* ----------------
444  * bitmap index scan node
445  *
446  * BitmapIndexScan delivers a bitmap of potential tuple locations;
447  * it does not access the heap itself. The bitmap is used by an
448  * ancestor BitmapHeapScan node, possibly after passing through
449  * intermediate BitmapAnd and/or BitmapOr nodes to combine it with
450  * the results of other BitmapIndexScans.
451  *
452  * The fields have the same meanings as for IndexScan, except we don't
453  * store a direction flag because direction is uninteresting.
454  *
455  * In a BitmapIndexScan plan node, the targetlist and qual fields are
456  * not used and are always NIL. The indexqualorig field is unused at
457  * run time too, but is saved for the benefit of EXPLAIN.
458  * ----------------
459  */
460 typedef struct BitmapIndexScan
461 {
463  Oid indexid; /* OID of index to scan */
464  bool isshared; /* Create shared bitmap if set */
465  List *indexqual; /* list of index quals (OpExprs) */
466  List *indexqualorig; /* the same in original form */
468 
469 /* ----------------
470  * bitmap sequential scan node
471  *
472  * This needs a copy of the qual conditions being used by the input index
473  * scans because there are various cases where we need to recheck the quals;
474  * for example, when the bitmap is lossy about the specific rows on a page
475  * that meet the index condition.
476  * ----------------
477  */
478 typedef struct BitmapHeapScan
479 {
481  List *bitmapqualorig; /* index quals, in standard expr form */
483 
484 /* ----------------
485  * tid scan node
486  *
487  * tidquals is an implicitly OR'ed list of qual expressions of the form
488  * "CTID = pseudoconstant", or "CTID = ANY(pseudoconstant_array)",
489  * or a CurrentOfExpr for the relation.
490  * ----------------
491  */
492 typedef struct TidScan
493 {
495  List *tidquals; /* qual(s) involving CTID = something */
497 
498 /* ----------------
499  * tid range scan node
500  *
501  * tidrangequals is an implicitly AND'ed list of qual expressions of the form
502  * "CTID relop pseudoconstant", where relop is one of >,>=,<,<=.
503  * ----------------
504  */
505 typedef struct TidRangeScan
506 {
508  List *tidrangequals; /* qual(s) involving CTID op something */
510 
511 /* ----------------
512  * subquery scan node
513  *
514  * SubqueryScan is for scanning the output of a sub-query in the range table.
515  * We often need an extra plan node above the sub-query's plan to perform
516  * expression evaluations (which we can't push into the sub-query without
517  * risking changing its semantics). Although we are not scanning a physical
518  * relation, we make this a descendant of Scan anyway for code-sharing
519  * purposes.
520  *
521  * Note: we store the sub-plan in the type-specific subplan field, not in
522  * the generic lefttree field as you might expect. This is because we do
523  * not want plan-tree-traversal routines to recurse into the subplan without
524  * knowing that they are changing Query contexts.
525  * ----------------
526  */
527 typedef struct SubqueryScan
528 {
532 
533 /* ----------------
534  * FunctionScan node
535  * ----------------
536  */
537 typedef struct FunctionScan
538 {
540  List *functions; /* list of RangeTblFunction nodes */
541  bool funcordinality; /* WITH ORDINALITY */
543 
544 /* ----------------
545  * ValuesScan node
546  * ----------------
547  */
548 typedef struct ValuesScan
549 {
551  List *values_lists; /* list of expression lists */
553 
554 /* ----------------
555  * TableFunc scan node
556  * ----------------
557  */
558 typedef struct TableFuncScan
559 {
561  TableFunc *tablefunc; /* table function node */
563 
564 /* ----------------
565  * CteScan node
566  * ----------------
567  */
568 typedef struct CteScan
569 {
571  int ctePlanId; /* ID of init SubPlan for CTE */
572  int cteParam; /* ID of Param representing CTE output */
574 
575 /* ----------------
576  * NamedTuplestoreScan node
577  * ----------------
578  */
579 typedef struct NamedTuplestoreScan
580 {
582  char *enrname; /* Name given to Ephemeral Named Relation */
584 
585 /* ----------------
586  * WorkTableScan node
587  * ----------------
588  */
589 typedef struct WorkTableScan
590 {
592  int wtParam; /* ID of Param representing work table */
594 
595 /* ----------------
596  * ForeignScan node
597  *
598  * fdw_exprs and fdw_private are both under the control of the foreign-data
599  * wrapper, but fdw_exprs is presumed to contain expression trees and will
600  * be post-processed accordingly by the planner; fdw_private won't be.
601  * Note that everything in both lists must be copiable by copyObject().
602  * One way to store an arbitrary blob of bytes is to represent it as a bytea
603  * Const. Usually, though, you'll be better off choosing a representation
604  * that can be dumped usefully by nodeToString().
605  *
606  * fdw_scan_tlist is a targetlist describing the contents of the scan tuple
607  * returned by the FDW; it can be NIL if the scan tuple matches the declared
608  * rowtype of the foreign table, which is the normal case for a simple foreign
609  * table scan. (If the plan node represents a foreign join, fdw_scan_tlist
610  * is required since there is no rowtype available from the system catalogs.)
611  * When fdw_scan_tlist is provided, Vars in the node's tlist and quals must
612  * have varno INDEX_VAR, and their varattnos correspond to resnos in the
613  * fdw_scan_tlist (which are also column numbers in the actual scan tuple).
614  * fdw_scan_tlist is never actually executed; it just holds expression trees
615  * describing what is in the scan tuple's columns.
616  *
617  * fdw_recheck_quals should contain any quals which the core system passed to
618  * the FDW but which were not added to scan.plan.qual; that is, it should
619  * contain the quals being checked remotely. This is needed for correct
620  * behavior during EvalPlanQual rechecks.
621  *
622  * When the plan node represents a foreign join, scan.scanrelid is zero and
623  * fs_relids must be consulted to identify the join relation. (fs_relids
624  * is valid for simple scans as well, but will always match scan.scanrelid.)
625  *
626  * If the FDW's PlanDirectModify() callback decides to repurpose a ForeignScan
627  * node to perform the UPDATE or DELETE operation directly in the remote
628  * server, it sets 'operation' and 'resultRelation' to identify the operation
629  * type and target relation. Note that these fields are only set if the
630  * modification is performed *fully* remotely; otherwise, the modification is
631  * driven by a local ModifyTable node and 'operation' is left to CMD_SELECT.
632  * ----------------
633  */
634 typedef struct ForeignScan
635 {
637  CmdType operation; /* SELECT/INSERT/UPDATE/DELETE */
638  Index resultRelation; /* direct modification target's RT index */
639  Oid fs_server; /* OID of foreign server */
640  List *fdw_exprs; /* expressions that FDW may evaluate */
641  List *fdw_private; /* private data for FDW */
642  List *fdw_scan_tlist; /* optional tlist describing scan tuple */
643  List *fdw_recheck_quals; /* original quals not in scan.plan.qual */
644  Bitmapset *fs_relids; /* RTIs generated by this scan */
645  bool fsSystemCol; /* true if any "system column" is needed */
647 
648 /* ----------------
649  * CustomScan node
650  *
651  * The comments for ForeignScan's fdw_exprs, fdw_private, fdw_scan_tlist,
652  * and fs_relids fields apply equally to CustomScan's custom_exprs,
653  * custom_private, custom_scan_tlist, and custom_relids fields. The
654  * convention of setting scan.scanrelid to zero for joins applies as well.
655  *
656  * Note that since Plan trees can be copied, custom scan providers *must*
657  * fit all plan data they need into those fields; embedding CustomScan in
658  * a larger struct will not work.
659  * ----------------
660  */
661 struct CustomScanMethods;
662 
663 typedef struct CustomScan
664 {
666  uint32 flags; /* mask of CUSTOMPATH_* flags, see
667  * nodes/extensible.h */
668  List *custom_plans; /* list of Plan nodes, if any */
669  List *custom_exprs; /* expressions that custom code may evaluate */
670  List *custom_private; /* private data for custom code */
671  List *custom_scan_tlist; /* optional tlist describing scan tuple */
672  Bitmapset *custom_relids; /* RTIs generated by this scan */
673  const struct CustomScanMethods *methods;
675 
676 /*
677  * ==========
678  * Join nodes
679  * ==========
680  */
681 
682 /* ----------------
683  * Join node
684  *
685  * jointype: rule for joining tuples from left and right subtrees
686  * inner_unique each outer tuple can match to no more than one inner tuple
687  * joinqual: qual conditions that came from JOIN/ON or JOIN/USING
688  * (plan.qual contains conditions that came from WHERE)
689  *
690  * When jointype is INNER, joinqual and plan.qual are semantically
691  * interchangeable. For OUTER jointypes, the two are *not* interchangeable;
692  * only joinqual is used to determine whether a match has been found for
693  * the purpose of deciding whether to generate null-extended tuples.
694  * (But plan.qual is still applied before actually returning a tuple.)
695  * For an outer join, only joinquals are allowed to be used as the merge
696  * or hash condition of a merge or hash join.
697  *
698  * inner_unique is set if the joinquals are such that no more than one inner
699  * tuple could match any given outer tuple. This allows the executor to
700  * skip searching for additional matches. (This must be provable from just
701  * the joinquals, ignoring plan.qual, due to where the executor tests it.)
702  * ----------------
703  */
704 typedef struct Join
705 {
709  List *joinqual; /* JOIN quals (in addition to plan.qual) */
711 
712 /* ----------------
713  * nest loop join node
714  *
715  * The nestParams list identifies any executor Params that must be passed
716  * into execution of the inner subplan carrying values from the current row
717  * of the outer subplan. Currently we restrict these values to be simple
718  * Vars, but perhaps someday that'd be worth relaxing. (Note: during plan
719  * creation, the paramval can actually be a PlaceHolderVar expression; but it
720  * must be a Var with varno OUTER_VAR by the time it gets to the executor.)
721  * ----------------
722  */
723 typedef struct NestLoop
724 {
726  List *nestParams; /* list of NestLoopParam nodes */
728 
729 typedef struct NestLoopParam
730 {
732  int paramno; /* number of the PARAM_EXEC Param to set */
733  Var *paramval; /* outer-relation Var to assign to Param */
735 
736 /* ----------------
737  * merge join node
738  *
739  * The expected ordering of each mergeable column is described by a btree
740  * opfamily OID, a collation OID, a direction (BTLessStrategyNumber or
741  * BTGreaterStrategyNumber) and a nulls-first flag. Note that the two sides
742  * of each mergeclause may be of different datatypes, but they are ordered the
743  * same way according to the common opfamily and collation. The operator in
744  * each mergeclause must be an equality operator of the indicated opfamily.
745  * ----------------
746  */
747 typedef struct MergeJoin
748 {
750  bool skip_mark_restore; /* Can we skip mark/restore calls? */
751  List *mergeclauses; /* mergeclauses as expression trees */
752  /* these are arrays, but have the same length as the mergeclauses list: */
753  Oid *mergeFamilies; /* per-clause OIDs of btree opfamilies */
754  Oid *mergeCollations; /* per-clause OIDs of collations */
755  int *mergeStrategies; /* per-clause ordering (ASC or DESC) */
756  bool *mergeNullsFirst; /* per-clause nulls ordering */
758 
759 /* ----------------
760  * hash join node
761  * ----------------
762  */
763 typedef struct HashJoin
764 {
769 
770  /*
771  * List of expressions to be hashed for tuples from the outer plan, to
772  * perform lookups in the hashtable over the inner plan.
773  */
776 
777 /* ----------------
778  * materialization node
779  * ----------------
780  */
781 typedef struct Material
782 {
785 
786 /* ----------------
787  * memoize node
788  * ----------------
789  */
790 typedef struct Memoize
791 {
793 
794  int numKeys; /* size of the two arrays below */
795 
796  Oid *hashOperators; /* hash operators for each key */
797  Oid *collations; /* cache keys */
798  List *param_exprs; /* exprs containing parameters */
799  bool singlerow; /* true if the cache entry should be marked as
800  * complete after we store the first tuple in
801  * it. */
802  bool binary_mode; /* true when cache key should be compared bit
803  * by bit, false when using hash equality ops */
804  uint32 est_entries; /* The maximum number of entries that the
805  * planner expects will fit in the cache, or 0
806  * if unknown */
807  Bitmapset *keyparamids; /* paramids from param_exprs */
809 
810 /* ----------------
811  * sort node
812  * ----------------
813  */
814 typedef struct Sort
815 {
817  int numCols; /* number of sort-key columns */
818  AttrNumber *sortColIdx; /* their indexes in the target list */
819  Oid *sortOperators; /* OIDs of operators to sort them by */
820  Oid *collations; /* OIDs of collations */
821  bool *nullsFirst; /* NULLS FIRST/LAST directions */
823 
824 /* ----------------
825  * incremental sort node
826  * ----------------
827  */
828 typedef struct IncrementalSort
829 {
831  int nPresortedCols; /* number of presorted columns */
833 
834 /* ---------------
835  * group node -
836  * Used for queries with GROUP BY (but no aggregates) specified.
837  * The input must be presorted according to the grouping columns.
838  * ---------------
839  */
840 typedef struct Group
841 {
843  int numCols; /* number of grouping columns */
844  AttrNumber *grpColIdx; /* their indexes in the target list */
845  Oid *grpOperators; /* equality operators to compare with */
848 
849 /* ---------------
850  * aggregate node
851  *
852  * An Agg node implements plain or grouped aggregation. For grouped
853  * aggregation, we can work with presorted input or unsorted input;
854  * the latter strategy uses an internal hashtable.
855  *
856  * Notice the lack of any direct info about the aggregate functions to be
857  * computed. They are found by scanning the node's tlist and quals during
858  * executor startup. (It is possible that there are no aggregate functions;
859  * this could happen if they get optimized away by constant-folding, or if
860  * we are using the Agg node to implement hash-based grouping.)
861  * ---------------
862  */
863 typedef struct Agg
864 {
866  AggStrategy aggstrategy; /* basic strategy, see nodes.h */
867  AggSplit aggsplit; /* agg-splitting mode, see nodes.h */
868  int numCols; /* number of grouping columns */
869  AttrNumber *grpColIdx; /* their indexes in the target list */
870  Oid *grpOperators; /* equality operators to compare with */
872  long numGroups; /* estimated number of groups in input */
873  uint64 transitionSpace; /* for pass-by-ref transition data */
874  Bitmapset *aggParams; /* IDs of Params used in Aggref inputs */
875  /* Note: planner provides numGroups & aggParams only in HASHED/MIXED case */
876  List *groupingSets; /* grouping sets to use */
877  List *chain; /* chained Agg/Sort nodes */
878 } Agg;
879 
880 /* ----------------
881  * window aggregate node
882  * ----------------
883  */
884 typedef struct WindowAgg
885 {
887  Index winref; /* ID referenced by window functions */
888  int partNumCols; /* number of columns in partition clause */
889  AttrNumber *partColIdx; /* their indexes in the target list */
890  Oid *partOperators; /* equality operators for partition columns */
891  Oid *partCollations; /* collations for partition columns */
892  int ordNumCols; /* number of columns in ordering clause */
893  AttrNumber *ordColIdx; /* their indexes in the target list */
894  Oid *ordOperators; /* equality operators for ordering columns */
895  Oid *ordCollations; /* collations for ordering columns */
896  int frameOptions; /* frame_clause options, see WindowDef */
897  Node *startOffset; /* expression for starting bound, if any */
898  Node *endOffset; /* expression for ending bound, if any */
899  /* these fields are used with RANGE offset PRECEDING/FOLLOWING: */
900  Oid startInRangeFunc; /* in_range function for startOffset */
901  Oid endInRangeFunc; /* in_range function for endOffset */
902  Oid inRangeColl; /* collation for in_range tests */
903  bool inRangeAsc; /* use ASC sort order for in_range tests? */
904  bool inRangeNullsFirst; /* nulls sort first for in_range tests? */
906 
907 /* ----------------
908  * unique node
909  * ----------------
910  */
911 typedef struct Unique
912 {
914  int numCols; /* number of columns to check for uniqueness */
915  AttrNumber *uniqColIdx; /* their indexes in the target list */
916  Oid *uniqOperators; /* equality operators to compare with */
917  Oid *uniqCollations; /* collations for equality comparisons */
919 
920 /* ------------
921  * gather node
922  *
923  * Note: rescan_param is the ID of a PARAM_EXEC parameter slot. That slot
924  * will never actually contain a value, but the Gather node must flag it as
925  * having changed whenever it is rescanned. The child parallel-aware scan
926  * nodes are marked as depending on that parameter, so that the rescan
927  * machinery is aware that their output is likely to change across rescans.
928  * In some cases we don't need a rescan Param, so rescan_param is set to -1.
929  * ------------
930  */
931 typedef struct Gather
932 {
934  int num_workers; /* planned number of worker processes */
935  int rescan_param; /* ID of Param that signals a rescan, or -1 */
936  bool single_copy; /* don't execute plan more than once */
937  bool invisible; /* suppress EXPLAIN display (for testing)? */
938  Bitmapset *initParam; /* param id's of initplans which are referred
939  * at gather or one of it's child node */
941 
942 /* ------------
943  * gather merge node
944  * ------------
945  */
946 typedef struct GatherMerge
947 {
949  int num_workers; /* planned number of worker processes */
950  int rescan_param; /* ID of Param that signals a rescan, or -1 */
951  /* remaining fields are just like the sort-key info in struct Sort */
952  int numCols; /* number of sort-key columns */
953  AttrNumber *sortColIdx; /* their indexes in the target list */
954  Oid *sortOperators; /* OIDs of operators to sort them by */
955  Oid *collations; /* OIDs of collations */
956  bool *nullsFirst; /* NULLS FIRST/LAST directions */
957  Bitmapset *initParam; /* param id's of initplans which are referred
958  * at gather merge or one of it's child node */
960 
961 /* ----------------
962  * hash build node
963  *
964  * If the executor is supposed to try to apply skew join optimization, then
965  * skewTable/skewColumn/skewInherit identify the outer relation's join key
966  * column, from which the relevant MCV statistics can be fetched.
967  * ----------------
968  */
969 typedef struct Hash
970 {
972 
973  /*
974  * List of expressions to be hashed for tuples from Hash's outer plan,
975  * needed to put them into the hashtable.
976  */
977  List *hashkeys; /* hash keys for the hashjoin condition */
978  Oid skewTable; /* outer join key's table OID, or InvalidOid */
979  AttrNumber skewColumn; /* outer join key's column #, or zero */
980  bool skewInherit; /* is outer join rel an inheritance tree? */
981  /* all other info is in the parent HashJoin node */
982  Cardinality rows_total; /* estimate total rows if parallel_aware */
984 
985 /* ----------------
986  * setop node
987  * ----------------
988  */
989 typedef struct SetOp
990 {
992  SetOpCmd cmd; /* what to do, see nodes.h */
993  SetOpStrategy strategy; /* how to do it, see nodes.h */
994  int numCols; /* number of columns to check for
995  * duplicate-ness */
996  AttrNumber *dupColIdx; /* their indexes in the target list */
997  Oid *dupOperators; /* equality operators to compare with */
999  AttrNumber flagColIdx; /* where is the flag column, if any */
1000  int firstFlag; /* flag value for first input relation */
1001  long numGroups; /* estimated number of groups in input */
1003 
1004 /* ----------------
1005  * lock-rows node
1006  *
1007  * rowMarks identifies the rels to be locked by this node; it should be
1008  * a subset of the rowMarks listed in the top-level PlannedStmt.
1009  * epqParam is a Param that all scan nodes below this one must depend on.
1010  * It is used to force re-evaluation of the plan during EvalPlanQual.
1011  * ----------------
1012  */
1013 typedef struct LockRows
1014 {
1016  List *rowMarks; /* a list of PlanRowMark's */
1017  int epqParam; /* ID of Param for EvalPlanQual re-eval */
1019 
1020 /* ----------------
1021  * limit node
1022  *
1023  * Note: as of Postgres 8.2, the offset and count expressions are expected
1024  * to yield int8, rather than int4 as before.
1025  * ----------------
1026  */
1027 typedef struct Limit
1028 {
1030  Node *limitOffset; /* OFFSET parameter, or NULL if none */
1031  Node *limitCount; /* COUNT parameter, or NULL if none */
1032  LimitOption limitOption; /* limit type */
1033  int uniqNumCols; /* number of columns to check for similarity */
1034  AttrNumber *uniqColIdx; /* their indexes in the target list */
1035  Oid *uniqOperators; /* equality operators to compare with */
1036  Oid *uniqCollations; /* collations for equality comparisons */
1038 
1039 
1040 /*
1041  * RowMarkType -
1042  * enums for types of row-marking operations
1043  *
1044  * The first four of these values represent different lock strengths that
1045  * we can take on tuples according to SELECT FOR [KEY] UPDATE/SHARE requests.
1046  * We support these on regular tables, as well as on foreign tables whose FDWs
1047  * report support for late locking. For other foreign tables, any locking
1048  * that might be done for such requests must happen during the initial row
1049  * fetch; their FDWs provide no mechanism for going back to lock a row later.
1050  * This means that the semantics will be a bit different than for a local
1051  * table; in particular we are likely to lock more rows than would be locked
1052  * locally, since remote rows will be locked even if they then fail
1053  * locally-checked restriction or join quals. However, the prospect of
1054  * doing a separate remote query to lock each selected row is usually pretty
1055  * unappealing, so early locking remains a credible design choice for FDWs.
1056  *
1057  * When doing UPDATE, DELETE, or SELECT FOR UPDATE/SHARE, we have to uniquely
1058  * identify all the source rows, not only those from the target relations, so
1059  * that we can perform EvalPlanQual rechecking at need. For plain tables we
1060  * can just fetch the TID, much as for a target relation; this case is
1061  * represented by ROW_MARK_REFERENCE. Otherwise (for example for VALUES or
1062  * FUNCTION scans) we have to copy the whole row value. ROW_MARK_COPY is
1063  * pretty inefficient, since most of the time we'll never need the data; but
1064  * fortunately the overhead is usually not performance-critical in practice.
1065  * By default we use ROW_MARK_COPY for foreign tables, but if the FDW has
1066  * a concept of rowid it can request to use ROW_MARK_REFERENCE instead.
1067  * (Again, this probably doesn't make sense if a physical remote fetch is
1068  * needed, but for FDWs that map to local storage it might be credible.)
1069  */
1070 typedef enum RowMarkType
1071 {
1072  ROW_MARK_EXCLUSIVE, /* obtain exclusive tuple lock */
1073  ROW_MARK_NOKEYEXCLUSIVE, /* obtain no-key exclusive tuple lock */
1074  ROW_MARK_SHARE, /* obtain shared tuple lock */
1075  ROW_MARK_KEYSHARE, /* obtain keyshare tuple lock */
1076  ROW_MARK_REFERENCE, /* just fetch the TID, don't lock it */
1077  ROW_MARK_COPY /* physically copy the row value */
1079 
1080 #define RowMarkRequiresRowShareLock(marktype) ((marktype) <= ROW_MARK_KEYSHARE)
1081 
1082 /*
1083  * PlanRowMark -
1084  * plan-time representation of FOR [KEY] UPDATE/SHARE clauses
1085  *
1086  * When doing UPDATE, DELETE, or SELECT FOR UPDATE/SHARE, we create a separate
1087  * PlanRowMark node for each non-target relation in the query. Relations that
1088  * are not specified as FOR UPDATE/SHARE are marked ROW_MARK_REFERENCE (if
1089  * regular tables or supported foreign tables) or ROW_MARK_COPY (if not).
1090  *
1091  * Initially all PlanRowMarks have rti == prti and isParent == false.
1092  * When the planner discovers that a relation is the root of an inheritance
1093  * tree, it sets isParent true, and adds an additional PlanRowMark to the
1094  * list for each child relation (including the target rel itself in its role
1095  * as a child, if it is not a partitioned table). Any non-leaf partitioned
1096  * child relations will also have entries with isParent = true. The child
1097  * entries have rti == child rel's RT index and prti == top parent's RT index,
1098  * and can therefore be recognized as children by the fact that prti != rti.
1099  * The parent's allMarkTypes field gets the OR of (1<<markType) across all
1100  * its children (this definition allows children to use different markTypes).
1101  *
1102  * The planner also adds resjunk output columns to the plan that carry
1103  * information sufficient to identify the locked or fetched rows. When
1104  * markType != ROW_MARK_COPY, these columns are named
1105  * tableoid%u OID of table
1106  * ctid%u TID of row
1107  * The tableoid column is only present for an inheritance hierarchy.
1108  * When markType == ROW_MARK_COPY, there is instead a single column named
1109  * wholerow%u whole-row value of relation
1110  * (An inheritance hierarchy could have all three resjunk output columns,
1111  * if some children use a different markType than others.)
1112  * In all three cases, %u represents the rowmark ID number (rowmarkId).
1113  * This number is unique within a plan tree, except that child relation
1114  * entries copy their parent's rowmarkId. (Assigning unique numbers
1115  * means we needn't renumber rowmarkIds when flattening subqueries, which
1116  * would require finding and renaming the resjunk columns as well.)
1117  * Note this means that all tables in an inheritance hierarchy share the
1118  * same resjunk column names.
1119  */
1120 typedef struct PlanRowMark
1121 {
1123  Index rti; /* range table index of markable relation */
1124  Index prti; /* range table index of parent relation */
1125  Index rowmarkId; /* unique identifier for resjunk columns */
1126  RowMarkType markType; /* see enum above */
1127  int allMarkTypes; /* OR of (1<<markType) for all children */
1128  LockClauseStrength strength; /* LockingClause's strength, or LCS_NONE */
1129  LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED options */
1130  bool isParent; /* true if this is a "dummy" parent entry */
1132 
1133 
1134 /*
1135  * Node types to represent partition pruning information.
1136  */
1137 
1138 /*
1139  * PartitionPruneInfo - Details required to allow the executor to prune
1140  * partitions.
1141  *
1142  * Here we store mapping details to allow translation of a partitioned table's
1143  * index as returned by the partition pruning code into subplan indexes for
1144  * plan types which support arbitrary numbers of subplans, such as Append.
1145  * We also store various details to tell the executor when it should be
1146  * performing partition pruning.
1147  *
1148  * Each PartitionedRelPruneInfo describes the partitioning rules for a single
1149  * partitioned table (a/k/a level of partitioning). Since a partitioning
1150  * hierarchy could contain multiple levels, we represent it by a List of
1151  * PartitionedRelPruneInfos, where the first entry represents the topmost
1152  * partitioned table and additional entries represent non-leaf child
1153  * partitions, ordered such that parents appear before their children.
1154  * Then, since an Append-type node could have multiple partitioning
1155  * hierarchies among its children, we have an unordered List of those Lists.
1156  *
1157  * prune_infos List of Lists containing PartitionedRelPruneInfo nodes,
1158  * one sublist per run-time-prunable partition hierarchy
1159  * appearing in the parent plan node's subplans.
1160  * other_subplans Indexes of any subplans that are not accounted for
1161  * by any of the PartitionedRelPruneInfo nodes in
1162  * "prune_infos". These subplans must not be pruned.
1163  */
1164 typedef struct PartitionPruneInfo
1165 {
1170 
1171 /*
1172  * PartitionedRelPruneInfo - Details required to allow the executor to prune
1173  * partitions for a single partitioned table.
1174  *
1175  * subplan_map[] and subpart_map[] are indexed by partition index of the
1176  * partitioned table referenced by 'rtindex', the partition index being the
1177  * order that the partitions are defined in the table's PartitionDesc. For a
1178  * leaf partition p, subplan_map[p] contains the zero-based index of the
1179  * partition's subplan in the parent plan's subplan list; it is -1 if the
1180  * partition is non-leaf or has been pruned. For a non-leaf partition p,
1181  * subpart_map[p] contains the zero-based index of that sub-partition's
1182  * PartitionedRelPruneInfo in the hierarchy's PartitionedRelPruneInfo list;
1183  * it is -1 if the partition is a leaf or has been pruned. Note that subplan
1184  * indexes, as stored in 'subplan_map', are global across the parent plan
1185  * node, but partition indexes are valid only within a particular hierarchy.
1186  * relid_map[p] contains the partition's OID, or 0 if the partition was pruned.
1187  */
1189 {
1191  Index rtindex; /* RT index of partition rel for this level */
1192  Bitmapset *present_parts; /* Indexes of all partitions which subplans or
1193  * subparts are present for */
1194  int nparts; /* Length of the following arrays: */
1195  int *subplan_map; /* subplan index by partition index, or -1 */
1196  int *subpart_map; /* subpart index by partition index, or -1 */
1197  Oid *relid_map; /* relation OID by partition index, or 0 */
1198 
1199  /*
1200  * initial_pruning_steps shows how to prune during executor startup (i.e.,
1201  * without use of any PARAM_EXEC Params); it is NIL if no startup pruning
1202  * is required. exec_pruning_steps shows how to prune with PARAM_EXEC
1203  * Params; it is NIL if no per-scan pruning is required.
1204  */
1205  List *initial_pruning_steps; /* List of PartitionPruneStep */
1206  List *exec_pruning_steps; /* List of PartitionPruneStep */
1207  Bitmapset *execparamids; /* All PARAM_EXEC Param IDs in
1208  * exec_pruning_steps */
1210 
1211 /*
1212  * Abstract Node type for partition pruning steps (there are no concrete
1213  * Nodes of this type).
1214  *
1215  * step_id is the global identifier of the step within its pruning context.
1216  */
1217 typedef struct PartitionPruneStep
1218 {
1220  int step_id;
1222 
1223 /*
1224  * PartitionPruneStepOp - Information to prune using a set of mutually ANDed
1225  * OpExpr clauses
1226  *
1227  * This contains information extracted from up to partnatts OpExpr clauses,
1228  * where partnatts is the number of partition key columns. 'opstrategy' is the
1229  * strategy of the operator in the clause matched to the last partition key.
1230  * 'exprs' contains expressions which comprise the lookup key to be passed to
1231  * the partition bound search function. 'cmpfns' contains the OIDs of
1232  * comparison functions used to compare aforementioned expressions with
1233  * partition bounds. Both 'exprs' and 'cmpfns' contain the same number of
1234  * items, up to partnatts items.
1235  *
1236  * Once we find the offset of a partition bound using the lookup key, we
1237  * determine which partitions to include in the result based on the value of
1238  * 'opstrategy'. For example, if it were equality, we'd return just the
1239  * partition that would contain that key or a set of partitions if the key
1240  * didn't consist of all partitioning columns. For non-equality strategies,
1241  * we'd need to include other partitions as appropriate.
1242  *
1243  * 'nullkeys' is the set containing the offset of the partition keys (0 to
1244  * partnatts - 1) that were matched to an IS NULL clause. This is only
1245  * considered for hash partitioning as we need to pass which keys are null
1246  * to the hash partition bound search function. It is never possible to
1247  * have an expression be present in 'exprs' for a given partition key and
1248  * the corresponding bit set in 'nullkeys'.
1249  */
1250 typedef struct PartitionPruneStepOp
1251 {
1253 
1259 
1260 /*
1261  * PartitionPruneStepCombine - Information to prune using a BoolExpr clause
1262  *
1263  * For BoolExpr clauses, we combine the set of partitions determined for each
1264  * of the argument clauses.
1265  */
1267 {
1271 
1273 {
1275 
1279 
1280 
1281 /*
1282  * Plan invalidation info
1283  *
1284  * We track the objects on which a PlannedStmt depends in two ways:
1285  * relations are recorded as a simple list of OIDs, and everything else
1286  * is represented as a list of PlanInvalItems. A PlanInvalItem is designed
1287  * to be used with the syscache invalidation mechanism, so it identifies a
1288  * system catalog entry by cache ID and hash value.
1289  */
1290 typedef struct PlanInvalItem
1291 {
1293  int cacheId; /* a syscache ID, see utils/syscache.h */
1294  uint32 hashValue; /* hash value of object's cache lookup key */
1296 
1297 #endif /* PLANNODES_H */
int16 AttrNumber
Definition: attnum.h:21
unsigned int uint32
Definition: c.h:441
unsigned int Index
Definition: c.h:549
LockWaitPolicy
Definition: lockoptions.h:37
LockClauseStrength
Definition: lockoptions.h:22
SetOpCmd
Definition: nodes.h:813
SetOpStrategy
Definition: nodes.h:821
double Cost
Definition: nodes.h:672
OnConflictAction
Definition: nodes.h:833
double Cardinality
Definition: nodes.h:673
CmdType
Definition: nodes.h:683
AggStrategy
Definition: nodes.h:769
NodeTag
Definition: nodes.h:27
AggSplit
Definition: nodes.h:791
LimitOption
Definition: nodes.h:846
JoinType
Definition: nodes.h:707
struct ForeignScan ForeignScan
struct TableFuncScan TableFuncScan
struct IndexScan IndexScan
struct MergeJoin MergeJoin
struct Memoize Memoize
struct Plan Plan
struct SampleScan SampleScan
struct WindowAgg WindowAgg
struct WorkTableScan WorkTableScan
struct ProjectSet ProjectSet
struct Sort Sort
struct PartitionedRelPruneInfo PartitionedRelPruneInfo
struct BitmapIndexScan BitmapIndexScan
struct TidScan TidScan
struct LockRows LockRows
struct TidRangeScan TidRangeScan
struct PartitionPruneStepOp PartitionPruneStepOp
struct PlanInvalItem PlanInvalItem
struct SubqueryScan SubqueryScan
PartitionPruneCombineOp
Definition: plannodes.h:1267
@ PARTPRUNE_COMBINE_INTERSECT
Definition: plannodes.h:1269
@ PARTPRUNE_COMBINE_UNION
Definition: plannodes.h:1268
struct IncrementalSort IncrementalSort
struct CteScan CteScan
struct NestLoop NestLoop
struct PlanRowMark PlanRowMark
struct Limit Limit
struct Unique Unique
struct Join Join
struct BitmapOr BitmapOr
struct SeqScan SeqScan
struct HashJoin HashJoin
struct Group Group
struct Scan Scan
struct PartitionPruneInfo PartitionPruneInfo
struct Append Append
struct Material Material
struct BitmapHeapScan BitmapHeapScan
struct NamedTuplestoreScan NamedTuplestoreScan
struct SetOp SetOp
struct NestLoopParam NestLoopParam
struct BitmapAnd BitmapAnd
struct GatherMerge GatherMerge
struct ModifyTable ModifyTable
struct PartitionPruneStep PartitionPruneStep
struct Hash Hash
RowMarkType
Definition: plannodes.h:1071
@ ROW_MARK_COPY
Definition: plannodes.h:1077
@ ROW_MARK_REFERENCE
Definition: plannodes.h:1076
@ ROW_MARK_SHARE
Definition: plannodes.h:1074
@ ROW_MARK_EXCLUSIVE
Definition: plannodes.h:1072
@ ROW_MARK_NOKEYEXCLUSIVE
Definition: plannodes.h:1073
@ ROW_MARK_KEYSHARE
Definition: plannodes.h:1075
struct RecursiveUnion RecursiveUnion
struct IndexOnlyScan IndexOnlyScan
struct FunctionScan FunctionScan
struct Result Result
struct MergeAppend MergeAppend
struct PartitionPruneStepCombine PartitionPruneStepCombine
struct CustomScan CustomScan
struct Agg Agg
struct ValuesScan ValuesScan
struct Gather Gather
struct PlannedStmt PlannedStmt
unsigned int Oid
Definition: postgres_ext.h:31
ScanDirection
Definition: sdir.h:23
uint16 StrategyNumber
Definition: stratnum.h:22
Definition: plannodes.h:864
AggSplit aggsplit
Definition: plannodes.h:867
List * chain
Definition: plannodes.h:877
long numGroups
Definition: plannodes.h:872
List * groupingSets
Definition: plannodes.h:876
Bitmapset * aggParams
Definition: plannodes.h:874
AttrNumber * grpColIdx
Definition: plannodes.h:869
Plan plan
Definition: plannodes.h:865
int numCols
Definition: plannodes.h:868
uint64 transitionSpace
Definition: plannodes.h:873
Oid * grpOperators
Definition: plannodes.h:870
AggStrategy aggstrategy
Definition: plannodes.h:866
Oid * grpCollations
Definition: plannodes.h:871
int first_partial_plan
Definition: plannodes.h:260
struct PartitionPruneInfo * part_prune_info
Definition: plannodes.h:263
int nasyncplans
Definition: plannodes.h:254
Bitmapset * apprelids
Definition: plannodes.h:252
Plan plan
Definition: plannodes.h:251
List * appendplans
Definition: plannodes.h:253
Plan plan
Definition: plannodes.h:317
List * bitmapplans
Definition: plannodes.h:318
List * bitmapqualorig
Definition: plannodes.h:481
List * indexqualorig
Definition: plannodes.h:466
List * indexqual
Definition: plannodes.h:465
List * bitmapplans
Definition: plannodes.h:333
bool isshared
Definition: plannodes.h:332
Plan plan
Definition: plannodes.h:331
int ctePlanId
Definition: plannodes.h:571
int cteParam
Definition: plannodes.h:572
Scan scan
Definition: plannodes.h:570
uint32 flags
Definition: plannodes.h:666
List * custom_scan_tlist
Definition: plannodes.h:671
Scan scan
Definition: plannodes.h:665
List * custom_private
Definition: plannodes.h:670
Bitmapset * custom_relids
Definition: plannodes.h:672
List * custom_exprs
Definition: plannodes.h:669
const struct CustomScanMethods * methods
Definition: plannodes.h:673
List * custom_plans
Definition: plannodes.h:668
CmdType operation
Definition: plannodes.h:637
Oid fs_server
Definition: plannodes.h:639
List * fdw_exprs
Definition: plannodes.h:640
bool fsSystemCol
Definition: plannodes.h:645
Bitmapset * fs_relids
Definition: plannodes.h:644
List * fdw_private
Definition: plannodes.h:641
Index resultRelation
Definition: plannodes.h:638
List * fdw_recheck_quals
Definition: plannodes.h:643
List * fdw_scan_tlist
Definition: plannodes.h:642
List * functions
Definition: plannodes.h:540
bool funcordinality
Definition: plannodes.h:541
Oid * collations
Definition: plannodes.h:955
int rescan_param
Definition: plannodes.h:950
AttrNumber * sortColIdx
Definition: plannodes.h:953
bool * nullsFirst
Definition: plannodes.h:956
Bitmapset * initParam
Definition: plannodes.h:957
Oid * sortOperators
Definition: plannodes.h:954
int num_workers
Definition: plannodes.h:949
int num_workers
Definition: plannodes.h:934
bool invisible
Definition: plannodes.h:937
Bitmapset * initParam
Definition: plannodes.h:938
bool single_copy
Definition: plannodes.h:936
Plan plan
Definition: plannodes.h:933
int rescan_param
Definition: plannodes.h:935
Oid * grpOperators
Definition: plannodes.h:845
int numCols
Definition: plannodes.h:843
Oid * grpCollations
Definition: plannodes.h:846
Plan plan
Definition: plannodes.h:842
AttrNumber * grpColIdx
Definition: plannodes.h:844
List * hashcollations
Definition: plannodes.h:768
List * hashclauses
Definition: plannodes.h:766
List * hashoperators
Definition: plannodes.h:767
Join join
Definition: plannodes.h:765
List * hashkeys
Definition: plannodes.h:774
AttrNumber skewColumn
Definition: plannodes.h:979
List * hashkeys
Definition: plannodes.h:977
Oid skewTable
Definition: plannodes.h:978
bool skewInherit
Definition: plannodes.h:980
Cardinality rows_total
Definition: plannodes.h:982
Plan plan
Definition: plannodes.h:971
List * indexqual
Definition: plannodes.h:437
List * indextlist
Definition: plannodes.h:439
ScanDirection indexorderdir
Definition: plannodes.h:440
List * indexorderby
Definition: plannodes.h:438
List * indexorderby
Definition: plannodes.h:410
List * indexorderbyops
Definition: plannodes.h:412
ScanDirection indexorderdir
Definition: plannodes.h:413
Scan scan
Definition: plannodes.h:406
List * indexqualorig
Definition: plannodes.h:409
Oid indexid
Definition: plannodes.h:407
List * indexqual
Definition: plannodes.h:408
List * indexorderbyorig
Definition: plannodes.h:411
List * joinqual
Definition: plannodes.h:709
JoinType jointype
Definition: plannodes.h:707
Plan plan
Definition: plannodes.h:706
bool inner_unique
Definition: plannodes.h:708
LimitOption limitOption
Definition: plannodes.h:1032
Plan plan
Definition: plannodes.h:1029
Oid * uniqOperators
Definition: plannodes.h:1035
AttrNumber * uniqColIdx
Definition: plannodes.h:1034
Node * limitCount
Definition: plannodes.h:1031
int uniqNumCols
Definition: plannodes.h:1033
Node * limitOffset
Definition: plannodes.h:1030
Oid * uniqCollations
Definition: plannodes.h:1036
Definition: pg_list.h:51
int epqParam
Definition: plannodes.h:1017
List * rowMarks
Definition: plannodes.h:1016
Plan plan
Definition: plannodes.h:1015
Plan plan
Definition: plannodes.h:783
Plan plan
Definition: plannodes.h:792
bool singlerow
Definition: plannodes.h:799
Bitmapset * keyparamids
Definition: plannodes.h:807
bool binary_mode
Definition: plannodes.h:802
int numKeys
Definition: plannodes.h:794
List * param_exprs
Definition: plannodes.h:798
Oid * hashOperators
Definition: plannodes.h:796
uint32 est_entries
Definition: plannodes.h:804
Oid * collations
Definition: plannodes.h:797
struct PartitionPruneInfo * part_prune_info
Definition: plannodes.h:283
Oid * sortOperators
Definition: plannodes.h:279
Bitmapset * apprelids
Definition: plannodes.h:274
bool * nullsFirst
Definition: plannodes.h:281
AttrNumber * sortColIdx
Definition: plannodes.h:278
Oid * collations
Definition: plannodes.h:280
List * mergeplans
Definition: plannodes.h:275
List * mergeclauses
Definition: plannodes.h:751
Join join
Definition: plannodes.h:749
int * mergeStrategies
Definition: plannodes.h:755
Oid * mergeCollations
Definition: plannodes.h:754
bool skip_mark_restore
Definition: plannodes.h:750
Oid * mergeFamilies
Definition: plannodes.h:753
bool * mergeNullsFirst
Definition: plannodes.h:756
List * updateColnosLists
Definition: plannodes.h:226
Index nominalRelation
Definition: plannodes.h:222
List * arbiterIndexes
Definition: plannodes.h:234
List * onConflictCols
Definition: plannodes.h:236
CmdType operation
Definition: plannodes.h:220
int epqParam
Definition: plannodes.h:232
List * resultRelations
Definition: plannodes.h:225
Bitmapset * fdwDirectModifyPlans
Definition: plannodes.h:230
List * onConflictSet
Definition: plannodes.h:235
List * exclRelTlist
Definition: plannodes.h:239
bool canSetTag
Definition: plannodes.h:221
List * fdwPrivLists
Definition: plannodes.h:229
bool partColsUpdated
Definition: plannodes.h:224
List * returningLists
Definition: plannodes.h:228
List * withCheckOptionLists
Definition: plannodes.h:227
Index rootRelation
Definition: plannodes.h:223
Node * onConflictWhere
Definition: plannodes.h:237
List * rowMarks
Definition: plannodes.h:231
OnConflictAction onConflictAction
Definition: plannodes.h:233
Index exclRelRTI
Definition: plannodes.h:238
Var * paramval
Definition: plannodes.h:733
NodeTag type
Definition: plannodes.h:731
List * nestParams
Definition: plannodes.h:726
Join join
Definition: plannodes.h:725
Definition: nodes.h:539
Bitmapset * other_subplans
Definition: plannodes.h:1168
PartitionPruneCombineOp combineOp
Definition: plannodes.h:1276
PartitionPruneStep step
Definition: plannodes.h:1274
PartitionPruneStep step
Definition: plannodes.h:1252
StrategyNumber opstrategy
Definition: plannodes.h:1254
Bitmapset * nullkeys
Definition: plannodes.h:1257
Bitmapset * present_parts
Definition: plannodes.h:1192
Bitmapset * execparamids
Definition: plannodes.h:1207
uint32 hashValue
Definition: plannodes.h:1294
NodeTag type
Definition: plannodes.h:1292
NodeTag type
Definition: plannodes.h:1122
LockClauseStrength strength
Definition: plannodes.h:1128
Index prti
Definition: plannodes.h:1124
RowMarkType markType
Definition: plannodes.h:1126
LockWaitPolicy waitPolicy
Definition: plannodes.h:1129
bool isParent
Definition: plannodes.h:1130
Index rowmarkId
Definition: plannodes.h:1125
int allMarkTypes
Definition: plannodes.h:1127
Bitmapset * extParam
Definition: plannodes.h:159
struct Plan * lefttree
Definition: plannodes.h:143
bool async_capable
Definition: plannodes.h:135
Cost total_cost
Definition: plannodes.h:118
struct Plan * righttree
Definition: plannodes.h:144
NodeTag type
Definition: plannodes.h:112
bool parallel_aware
Definition: plannodes.h:129
Cost startup_cost
Definition: plannodes.h:117
List * qual
Definition: plannodes.h:142
int plan_width
Definition: plannodes.h:124
Bitmapset * allParam
Definition: plannodes.h:160
bool parallel_safe
Definition: plannodes.h:130
Cardinality plan_rows
Definition: plannodes.h:123
int plan_node_id
Definition: plannodes.h:140
List * targetlist
Definition: plannodes.h:141
List * initPlan
Definition: plannodes.h:145
struct Plan * planTree
Definition: plannodes.h:64
bool hasModifyingCTE
Definition: plannodes.h:52
List * appendRelations
Definition: plannodes.h:71
bool canSetTag
Definition: plannodes.h:54
List * rowMarks
Definition: plannodes.h:78
int stmt_location
Definition: plannodes.h:89
int stmt_len
Definition: plannodes.h:90
int jitFlags
Definition: plannodes.h:62
Bitmapset * rewindPlanIDs
Definition: plannodes.h:76
bool hasReturning
Definition: plannodes.h:50
List * invalItems
Definition: plannodes.h:82
bool transientPlan
Definition: plannodes.h:56
List * resultRelations
Definition: plannodes.h:69
List * subplans
Definition: plannodes.h:73
List * relationOids
Definition: plannodes.h:80
bool dependsOnRole
Definition: plannodes.h:58
CmdType commandType
Definition: plannodes.h:46
Node * utilityStmt
Definition: plannodes.h:86
List * rtable
Definition: plannodes.h:66
NodeTag type
Definition: plannodes.h:44
List * paramExecTypes
Definition: plannodes.h:84
bool parallelModeNeeded
Definition: plannodes.h:60
uint64 queryId
Definition: plannodes.h:48
Plan plan
Definition: plannodes.h:199
Oid * dupCollations
Definition: plannodes.h:303
AttrNumber * dupColIdx
Definition: plannodes.h:301
Oid * dupOperators
Definition: plannodes.h:302
Node * resconstantqual
Definition: plannodes.h:188
Plan plan
Definition: plannodes.h:187
struct TableSampleClause * tablesample
Definition: plannodes.h:364
Scan scan
Definition: plannodes.h:362
Plan plan
Definition: plannodes.h:343
Index scanrelid
Definition: plannodes.h:344
Scan scan
Definition: plannodes.h:353
Oid * dupCollations
Definition: plannodes.h:998
SetOpStrategy strategy
Definition: plannodes.h:993
AttrNumber flagColIdx
Definition: plannodes.h:999
AttrNumber * dupColIdx
Definition: plannodes.h:996
Oid * dupOperators
Definition: plannodes.h:997
SetOpCmd cmd
Definition: plannodes.h:992
int numCols
Definition: plannodes.h:994
int firstFlag
Definition: plannodes.h:1000
Plan plan
Definition: plannodes.h:991
long numGroups
Definition: plannodes.h:1001
Oid * sortOperators
Definition: plannodes.h:819
int numCols
Definition: plannodes.h:817
bool * nullsFirst
Definition: plannodes.h:821
AttrNumber * sortColIdx
Definition: plannodes.h:818
Plan plan
Definition: plannodes.h:816
Oid * collations
Definition: plannodes.h:820
Plan * subplan
Definition: plannodes.h:530
TableFunc * tablefunc
Definition: plannodes.h:561
List * tidrangequals
Definition: plannodes.h:508
Scan scan
Definition: plannodes.h:494
List * tidquals
Definition: plannodes.h:495
Oid * uniqCollations
Definition: plannodes.h:917
Oid * uniqOperators
Definition: plannodes.h:916
AttrNumber * uniqColIdx
Definition: plannodes.h:915
Plan plan
Definition: plannodes.h:913
int numCols
Definition: plannodes.h:914
Scan scan
Definition: plannodes.h:550
List * values_lists
Definition: plannodes.h:551
Definition: primnodes.h:187
Oid * partOperators
Definition: plannodes.h:890
int partNumCols
Definition: plannodes.h:888
Oid endInRangeFunc
Definition: plannodes.h:901
Node * endOffset
Definition: plannodes.h:898
AttrNumber * ordColIdx
Definition: plannodes.h:893
Plan plan
Definition: plannodes.h:886
Oid inRangeColl
Definition: plannodes.h:902
Node * startOffset
Definition: plannodes.h:897
Oid startInRangeFunc
Definition: plannodes.h:900
bool inRangeAsc
Definition: plannodes.h:903
Oid * partCollations
Definition: plannodes.h:891
Index winref
Definition: plannodes.h:887
bool inRangeNullsFirst
Definition: plannodes.h:904
Oid * ordCollations
Definition: plannodes.h:895
Oid * ordOperators
Definition: plannodes.h:894
int ordNumCols
Definition: plannodes.h:892
AttrNumber * partColIdx
Definition: plannodes.h:889
int frameOptions
Definition: plannodes.h:896