PostgreSQL Source Code  git master
primnodes.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * primnodes.h
4  * Definitions for "primitive" node types, those that are used in more
5  * than one of the parse/plan/execute stages of the query pipeline.
6  * Currently, these are mostly nodes for executable expressions
7  * and join trees.
8  *
9  *
10  * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
11  * Portions Copyright (c) 1994, Regents of the University of California
12  *
13  * src/include/nodes/primnodes.h
14  *
15  *-------------------------------------------------------------------------
16  */
17 #ifndef PRIMNODES_H
18 #define PRIMNODES_H
19 
20 #include "access/attnum.h"
21 #include "access/stratnum.h"
22 #include "nodes/bitmapset.h"
23 #include "nodes/pg_list.h"
24 
25 
26 /* ----------------------------------------------------------------
27  * node definitions
28  * ----------------------------------------------------------------
29  */
30 
31 /*
32  * Alias -
33  * specifies an alias for a range variable; the alias might also
34  * specify renaming of columns within the table.
35  *
36  * Note: colnames is a list of Value nodes (always strings). In Alias structs
37  * associated with RTEs, there may be entries corresponding to dropped
38  * columns; these are normally empty strings (""). See parsenodes.h for info.
39  */
40 typedef struct Alias
41 {
43  char *aliasname; /* aliased rel name (never qualified) */
44  List *colnames; /* optional list of column aliases */
45 } Alias;
46 
47 /* What to do at commit time for temporary relations */
48 typedef enum OnCommitAction
49 {
50  ONCOMMIT_NOOP, /* No ON COMMIT clause (do nothing) */
51  ONCOMMIT_PRESERVE_ROWS, /* ON COMMIT PRESERVE ROWS (do nothing) */
52  ONCOMMIT_DELETE_ROWS, /* ON COMMIT DELETE ROWS */
53  ONCOMMIT_DROP /* ON COMMIT DROP */
55 
56 /*
57  * RangeVar - range variable, used in FROM clauses
58  *
59  * Also used to represent table names in utility statements; there, the alias
60  * field is not used, and inh tells whether to apply the operation
61  * recursively to child tables. In some contexts it is also useful to carry
62  * a TEMP table indication here.
63  */
64 typedef struct RangeVar
65 {
67  char *catalogname; /* the catalog (database) name, or NULL */
68  char *schemaname; /* the schema name, or NULL */
69  char *relname; /* the relation/sequence name */
70  bool inh; /* expand rel by inheritance? recursively act
71  * on children? */
72  char relpersistence; /* see RELPERSISTENCE_* in pg_class.h */
73  Alias *alias; /* table alias & optional column aliases */
74  int location; /* token location, or -1 if unknown */
75 } RangeVar;
76 
77 /*
78  * TableFunc - node for a table function, such as XMLTABLE.
79  */
80 typedef struct TableFunc
81 {
83  List *ns_uris; /* list of namespace uri */
84  List *ns_names; /* list of namespace names */
85  Node *docexpr; /* input document expression */
86  Node *rowexpr; /* row filter expression */
87  List *colnames; /* column names (list of String) */
88  List *coltypes; /* OID list of column type OIDs */
89  List *coltypmods; /* integer list of column typmods */
90  List *colcollations; /* OID list of column collation OIDs */
91  List *colexprs; /* list of column filter expressions */
92  List *coldefexprs; /* list of column default expressions */
93  Bitmapset *notnulls; /* nullability flag for each output column */
94  int ordinalitycol; /* counts from 0; -1 if none specified */
95  int location; /* token location, or -1 if unknown */
96 } TableFunc;
97 
98 /*
99  * IntoClause - target information for SELECT INTO, CREATE TABLE AS, and
100  * CREATE MATERIALIZED VIEW
101  *
102  * For CREATE MATERIALIZED VIEW, viewQuery is the parsed-but-not-rewritten
103  * SELECT Query for the view; otherwise it's NULL. (Although it's actually
104  * Query*, we declare it as Node* to avoid a forward reference.)
105  */
106 typedef struct IntoClause
107 {
109 
110  RangeVar *rel; /* target relation name */
111  List *colNames; /* column names to assign, or NIL */
112  List *options; /* options from WITH clause */
113  OnCommitAction onCommit; /* what do we do at COMMIT? */
114  char *tableSpaceName; /* table space to use, or NULL */
115  Node *viewQuery; /* materialized view's SELECT query */
116  bool skipData; /* true for WITH NO DATA */
117 } IntoClause;
118 
119 
120 /* ----------------------------------------------------------------
121  * node types for executable expressions
122  * ----------------------------------------------------------------
123  */
124 
125 /*
126  * Expr - generic superclass for executable-expression nodes
127  *
128  * All node types that are used in executable expression trees should derive
129  * from Expr (that is, have Expr as their first field). Since Expr only
130  * contains NodeTag, this is a formality, but it is an easy form of
131  * documentation. See also the ExprState node types in execnodes.h.
132  */
133 typedef struct Expr
134 {
136 } Expr;
137 
138 /*
139  * Var - expression node representing a variable (ie, a table column)
140  *
141  * Note: during parsing/planning, varnoold/varoattno are always just copies
142  * of varno/varattno. At the tail end of planning, Var nodes appearing in
143  * upper-level plan nodes are reassigned to point to the outputs of their
144  * subplans; for example, in a join node varno becomes INNER_VAR or OUTER_VAR
145  * and varattno becomes the index of the proper element of that subplan's
146  * target list. Similarly, INDEX_VAR is used to identify Vars that reference
147  * an index column rather than a heap column. (In ForeignScan and CustomScan
148  * plan nodes, INDEX_VAR is abused to signify references to columns of a
149  * custom scan tuple type.) In all these cases, varnoold/varoattno hold the
150  * original values. The code doesn't really need varnoold/varoattno, but they
151  * are very useful for debugging and interpreting completed plans, so we keep
152  * them around.
153  */
154 #define INNER_VAR 65000 /* reference to inner subplan */
155 #define OUTER_VAR 65001 /* reference to outer subplan */
156 #define INDEX_VAR 65002 /* reference to index column */
157 
158 #define IS_SPECIAL_VARNO(varno) ((varno) >= INNER_VAR)
159 
160 /* Symbols for the indexes of the special RTE entries in rules */
161 #define PRS2_OLD_VARNO 1
162 #define PRS2_NEW_VARNO 2
163 
164 typedef struct Var
165 {
167  Index varno; /* index of this var's relation in the range
168  * table, or INNER_VAR/OUTER_VAR/INDEX_VAR */
169  AttrNumber varattno; /* attribute number of this var, or zero for
170  * all attrs ("whole-row Var") */
171  Oid vartype; /* pg_type OID for the type of this var */
172  int32 vartypmod; /* pg_attribute typmod value */
173  Oid varcollid; /* OID of collation, or InvalidOid if none */
174  Index varlevelsup; /* for subquery variables referencing outer
175  * relations; 0 in a normal var, >0 means N
176  * levels up */
177  Index varnoold; /* original value of varno, for debugging */
178  AttrNumber varoattno; /* original value of varattno */
179  int location; /* token location, or -1 if unknown */
180 } Var;
181 
182 /*
183  * Const
184  *
185  * Note: for varlena data types, we make a rule that a Const node's value
186  * must be in non-extended form (4-byte header, no compression or external
187  * references). This ensures that the Const node is self-contained and makes
188  * it more likely that equal() will see logically identical values as equal.
189  */
190 typedef struct Const
191 {
193  Oid consttype; /* pg_type OID of the constant's datatype */
194  int32 consttypmod; /* typmod value, if any */
195  Oid constcollid; /* OID of collation, or InvalidOid if none */
196  int constlen; /* typlen of the constant's datatype */
197  Datum constvalue; /* the constant's value */
198  bool constisnull; /* whether the constant is null (if true,
199  * constvalue is undefined) */
200  bool constbyval; /* whether this datatype is passed by value.
201  * If true, then all the information is stored
202  * in the Datum. If false, then the Datum
203  * contains a pointer to the information. */
204  int location; /* token location, or -1 if unknown */
205 } Const;
206 
207 /*
208  * Param
209  *
210  * paramkind specifies the kind of parameter. The possible values
211  * for this field are:
212  *
213  * PARAM_EXTERN: The parameter value is supplied from outside the plan.
214  * Such parameters are numbered from 1 to n.
215  *
216  * PARAM_EXEC: The parameter is an internal executor parameter, used
217  * for passing values into and out of sub-queries or from
218  * nestloop joins to their inner scans.
219  * For historical reasons, such parameters are numbered from 0.
220  * These numbers are independent of PARAM_EXTERN numbers.
221  *
222  * PARAM_SUBLINK: The parameter represents an output column of a SubLink
223  * node's sub-select. The column number is contained in the
224  * `paramid' field. (This type of Param is converted to
225  * PARAM_EXEC during planning.)
226  *
227  * PARAM_MULTIEXPR: Like PARAM_SUBLINK, the parameter represents an
228  * output column of a SubLink node's sub-select, but here, the
229  * SubLink is always a MULTIEXPR SubLink. The high-order 16 bits
230  * of the `paramid' field contain the SubLink's subLinkId, and
231  * the low-order 16 bits contain the column number. (This type
232  * of Param is also converted to PARAM_EXEC during planning.)
233  */
234 typedef enum ParamKind
235 {
240 } ParamKind;
241 
242 typedef struct Param
243 {
245  ParamKind paramkind; /* kind of parameter. See above */
246  int paramid; /* numeric ID for parameter */
247  Oid paramtype; /* pg_type OID of parameter's datatype */
248  int32 paramtypmod; /* typmod value, if known */
249  Oid paramcollid; /* OID of collation, or InvalidOid if none */
250  int location; /* token location, or -1 if unknown */
251 } Param;
252 
253 /*
254  * Aggref
255  *
256  * The aggregate's args list is a targetlist, ie, a list of TargetEntry nodes.
257  *
258  * For a normal (non-ordered-set) aggregate, the non-resjunk TargetEntries
259  * represent the aggregate's regular arguments (if any) and resjunk TLEs can
260  * be added at the end to represent ORDER BY expressions that are not also
261  * arguments. As in a top-level Query, the TLEs can be marked with
262  * ressortgroupref indexes to let them be referenced by SortGroupClause
263  * entries in the aggorder and/or aggdistinct lists. This represents ORDER BY
264  * and DISTINCT operations to be applied to the aggregate input rows before
265  * they are passed to the transition function. The grammar only allows a
266  * simple "DISTINCT" specifier for the arguments, but we use the full
267  * query-level representation to allow more code sharing.
268  *
269  * For an ordered-set aggregate, the args list represents the WITHIN GROUP
270  * (aggregated) arguments, all of which will be listed in the aggorder list.
271  * DISTINCT is not supported in this case, so aggdistinct will be NIL.
272  * The direct arguments appear in aggdirectargs (as a list of plain
273  * expressions, not TargetEntry nodes).
274  *
275  * aggtranstype is the data type of the state transition values for this
276  * aggregate (resolved to an actual type, if agg's transtype is polymorphic).
277  * This is determined during planning and is InvalidOid before that.
278  *
279  * aggargtypes is an OID list of the data types of the direct and regular
280  * arguments. Normally it's redundant with the aggdirectargs and args lists,
281  * but in a combining aggregate, it's not because the args list has been
282  * replaced with a single argument representing the partial-aggregate
283  * transition values.
284  *
285  * aggsplit indicates the expected partial-aggregation mode for the Aggref's
286  * parent plan node. It's always set to AGGSPLIT_SIMPLE in the parser, but
287  * the planner might change it to something else. We use this mainly as
288  * a crosscheck that the Aggrefs match the plan; but note that when aggsplit
289  * indicates a non-final mode, aggtype reflects the transition data type
290  * not the SQL-level output type of the aggregate.
291  */
292 typedef struct Aggref
293 {
295  Oid aggfnoid; /* pg_proc Oid of the aggregate */
296  Oid aggtype; /* type Oid of result of the aggregate */
297  Oid aggcollid; /* OID of collation of result */
298  Oid inputcollid; /* OID of collation that function should use */
299  Oid aggtranstype; /* type Oid of aggregate's transition value */
300  List *aggargtypes; /* type Oids of direct and aggregated args */
301  List *aggdirectargs; /* direct arguments, if an ordered-set agg */
302  List *args; /* aggregated arguments and sort expressions */
303  List *aggorder; /* ORDER BY (list of SortGroupClause) */
304  List *aggdistinct; /* DISTINCT (list of SortGroupClause) */
305  Expr *aggfilter; /* FILTER expression, if any */
306  bool aggstar; /* true if argument list was really '*' */
307  bool aggvariadic; /* true if variadic arguments have been
308  * combined into an array last argument */
309  char aggkind; /* aggregate kind (see pg_aggregate.h) */
310  Index agglevelsup; /* > 0 if agg belongs to outer query */
311  AggSplit aggsplit; /* expected agg-splitting mode of parent Agg */
312  int location; /* token location, or -1 if unknown */
313 } Aggref;
314 
315 /*
316  * GroupingFunc
317  *
318  * A GroupingFunc is a GROUPING(...) expression, which behaves in many ways
319  * like an aggregate function (e.g. it "belongs" to a specific query level,
320  * which might not be the one immediately containing it), but also differs in
321  * an important respect: it never evaluates its arguments, they merely
322  * designate expressions from the GROUP BY clause of the query level to which
323  * it belongs.
324  *
325  * The spec defines the evaluation of GROUPING() purely by syntactic
326  * replacement, but we make it a real expression for optimization purposes so
327  * that one Agg node can handle multiple grouping sets at once. Evaluating the
328  * result only needs the column positions to check against the grouping set
329  * being projected. However, for EXPLAIN to produce meaningful output, we have
330  * to keep the original expressions around, since expression deparse does not
331  * give us any feasible way to get at the GROUP BY clause.
332  *
333  * Also, we treat two GroupingFunc nodes as equal if they have equal arguments
334  * lists and agglevelsup, without comparing the refs and cols annotations.
335  *
336  * In raw parse output we have only the args list; parse analysis fills in the
337  * refs list, and the planner fills in the cols list.
338  */
339 typedef struct GroupingFunc
340 {
342  List *args; /* arguments, not evaluated but kept for
343  * benefit of EXPLAIN etc. */
344  List *refs; /* ressortgrouprefs of arguments */
345  List *cols; /* actual column positions set by planner */
346  Index agglevelsup; /* same as Aggref.agglevelsup */
347  int location; /* token location */
348 } GroupingFunc;
349 
350 /*
351  * WindowFunc
352  */
353 typedef struct WindowFunc
354 {
356  Oid winfnoid; /* pg_proc Oid of the function */
357  Oid wintype; /* type Oid of result of the window function */
358  Oid wincollid; /* OID of collation of result */
359  Oid inputcollid; /* OID of collation that function should use */
360  List *args; /* arguments to the window function */
361  Expr *aggfilter; /* FILTER expression, if any */
362  Index winref; /* index of associated WindowClause */
363  bool winstar; /* true if argument list was really '*' */
364  bool winagg; /* is function a simple aggregate? */
365  int location; /* token location, or -1 if unknown */
366 } WindowFunc;
367 
368 /* ----------------
369  * ArrayRef: describes an array subscripting operation
370  *
371  * An ArrayRef can describe fetching a single element from an array,
372  * fetching a subarray (array slice), storing a single element into
373  * an array, or storing a slice. The "store" cases work with an
374  * initial array value and a source value that is inserted into the
375  * appropriate part of the array; the result of the operation is an
376  * entire new modified array value.
377  *
378  * If reflowerindexpr = NIL, then we are fetching or storing a single array
379  * element at the subscripts given by refupperindexpr. Otherwise we are
380  * fetching or storing an array slice, that is a rectangular subarray
381  * with lower and upper bounds given by the index expressions.
382  * reflowerindexpr must be the same length as refupperindexpr when it
383  * is not NIL.
384  *
385  * In the slice case, individual expressions in the subscript lists can be
386  * NULL, meaning "substitute the array's current lower or upper bound".
387  *
388  * Note: the result datatype is the element type when fetching a single
389  * element; but it is the array type when doing subarray fetch or either
390  * type of store.
391  *
392  * Note: for the cases where an array is returned, if refexpr yields a R/W
393  * expanded array, then the implementation is allowed to modify that object
394  * in-place and return the same object.)
395  * ----------------
396  */
397 typedef struct ArrayRef
398 {
400  Oid refarraytype; /* type of the array proper */
401  Oid refelemtype; /* type of the array elements */
402  int32 reftypmod; /* typmod of the array (and elements too) */
403  Oid refcollid; /* OID of collation, or InvalidOid if none */
404  List *refupperindexpr; /* expressions that evaluate to upper
405  * array indexes */
406  List *reflowerindexpr; /* expressions that evaluate to lower
407  * array indexes, or NIL for single array
408  * element */
409  Expr *refexpr; /* the expression that evaluates to an array
410  * value */
411  Expr *refassgnexpr; /* expression for the source value, or NULL if
412  * fetch */
413 } ArrayRef;
414 
415 /*
416  * CoercionContext - distinguishes the allowed set of type casts
417  *
418  * NB: ordering of the alternatives is significant; later (larger) values
419  * allow more casts than earlier ones.
420  */
421 typedef enum CoercionContext
422 {
423  COERCION_IMPLICIT, /* coercion in context of expression */
424  COERCION_ASSIGNMENT, /* coercion in context of assignment */
425  COERCION_EXPLICIT /* explicit cast operation */
427 
428 /*
429  * CoercionForm - how to display a node that could have come from a cast
430  *
431  * NB: equal() ignores CoercionForm fields, therefore this *must* not carry
432  * any semantically significant information. We need that behavior so that
433  * the planner will consider equivalent implicit and explicit casts to be
434  * equivalent. In cases where those actually behave differently, the coercion
435  * function's arguments will be different.
436  */
437 typedef enum CoercionForm
438 {
439  COERCE_EXPLICIT_CALL, /* display as a function call */
440  COERCE_EXPLICIT_CAST, /* display as an explicit cast */
441  COERCE_IMPLICIT_CAST /* implicit cast, so hide it */
442 } CoercionForm;
443 
444 /*
445  * FuncExpr - expression node for a function call
446  */
447 typedef struct FuncExpr
448 {
450  Oid funcid; /* PG_PROC OID of the function */
451  Oid funcresulttype; /* PG_TYPE OID of result value */
452  bool funcretset; /* true if function returns set */
453  bool funcvariadic; /* true if variadic arguments have been
454  * combined into an array last argument */
455  CoercionForm funcformat; /* how to display this function call */
456  Oid funccollid; /* OID of collation of result */
457  Oid inputcollid; /* OID of collation that function should use */
458  List *args; /* arguments to the function */
459  int location; /* token location, or -1 if unknown */
460 } FuncExpr;
461 
462 /*
463  * NamedArgExpr - a named argument of a function
464  *
465  * This node type can only appear in the args list of a FuncCall or FuncExpr
466  * node. We support pure positional call notation (no named arguments),
467  * named notation (all arguments are named), and mixed notation (unnamed
468  * arguments followed by named ones).
469  *
470  * Parse analysis sets argnumber to the positional index of the argument,
471  * but doesn't rearrange the argument list.
472  *
473  * The planner will convert argument lists to pure positional notation
474  * during expression preprocessing, so execution never sees a NamedArgExpr.
475  */
476 typedef struct NamedArgExpr
477 {
479  Expr *arg; /* the argument expression */
480  char *name; /* the name */
481  int argnumber; /* argument's number in positional notation */
482  int location; /* argument name location, or -1 if unknown */
483 } NamedArgExpr;
484 
485 /*
486  * OpExpr - expression node for an operator invocation
487  *
488  * Semantically, this is essentially the same as a function call.
489  *
490  * Note that opfuncid is not necessarily filled in immediately on creation
491  * of the node. The planner makes sure it is valid before passing the node
492  * tree to the executor, but during parsing/planning opfuncid can be 0.
493  */
494 typedef struct OpExpr
495 {
497  Oid opno; /* PG_OPERATOR OID of the operator */
498  Oid opfuncid; /* PG_PROC OID of underlying function */
499  Oid opresulttype; /* PG_TYPE OID of result value */
500  bool opretset; /* true if operator returns set */
501  Oid opcollid; /* OID of collation of result */
502  Oid inputcollid; /* OID of collation that operator should use */
503  List *args; /* arguments to the operator (1 or 2) */
504  int location; /* token location, or -1 if unknown */
505 } OpExpr;
506 
507 /*
508  * DistinctExpr - expression node for "x IS DISTINCT FROM y"
509  *
510  * Except for the nodetag, this is represented identically to an OpExpr
511  * referencing the "=" operator for x and y.
512  * We use "=", not the more obvious "<>", because more datatypes have "="
513  * than "<>". This means the executor must invert the operator result.
514  * Note that the operator function won't be called at all if either input
515  * is NULL, since then the result can be determined directly.
516  */
518 
519 /*
520  * NullIfExpr - a NULLIF expression
521  *
522  * Like DistinctExpr, this is represented the same as an OpExpr referencing
523  * the "=" operator for x and y.
524  */
526 
527 /*
528  * ScalarArrayOpExpr - expression node for "scalar op ANY/ALL (array)"
529  *
530  * The operator must yield boolean. It is applied to the left operand
531  * and each element of the righthand array, and the results are combined
532  * with OR or AND (for ANY or ALL respectively). The node representation
533  * is almost the same as for the underlying operator, but we need a useOr
534  * flag to remember whether it's ANY or ALL, and we don't have to store
535  * the result type (or the collation) because it must be boolean.
536  */
537 typedef struct ScalarArrayOpExpr
538 {
540  Oid opno; /* PG_OPERATOR OID of the operator */
541  Oid opfuncid; /* PG_PROC OID of underlying function */
542  bool useOr; /* true for ANY, false for ALL */
543  Oid inputcollid; /* OID of collation that operator should use */
544  List *args; /* the scalar and array operands */
545  int location; /* token location, or -1 if unknown */
547 
548 /*
549  * BoolExpr - expression node for the basic Boolean operators AND, OR, NOT
550  *
551  * Notice the arguments are given as a List. For NOT, of course the list
552  * must always have exactly one element. For AND and OR, there can be two
553  * or more arguments.
554  */
555 typedef enum BoolExprType
556 {
558 } BoolExprType;
559 
560 typedef struct BoolExpr
561 {
564  List *args; /* arguments to this expression */
565  int location; /* token location, or -1 if unknown */
566 } BoolExpr;
567 
568 /*
569  * SubLink
570  *
571  * A SubLink represents a subselect appearing in an expression, and in some
572  * cases also the combining operator(s) just above it. The subLinkType
573  * indicates the form of the expression represented:
574  * EXISTS_SUBLINK EXISTS(SELECT ...)
575  * ALL_SUBLINK (lefthand) op ALL (SELECT ...)
576  * ANY_SUBLINK (lefthand) op ANY (SELECT ...)
577  * ROWCOMPARE_SUBLINK (lefthand) op (SELECT ...)
578  * EXPR_SUBLINK (SELECT with single targetlist item ...)
579  * MULTIEXPR_SUBLINK (SELECT with multiple targetlist items ...)
580  * ARRAY_SUBLINK ARRAY(SELECT with single targetlist item ...)
581  * CTE_SUBLINK WITH query (never actually part of an expression)
582  * For ALL, ANY, and ROWCOMPARE, the lefthand is a list of expressions of the
583  * same length as the subselect's targetlist. ROWCOMPARE will *always* have
584  * a list with more than one entry; if the subselect has just one target
585  * then the parser will create an EXPR_SUBLINK instead (and any operator
586  * above the subselect will be represented separately).
587  * ROWCOMPARE, EXPR, and MULTIEXPR require the subselect to deliver at most
588  * one row (if it returns no rows, the result is NULL).
589  * ALL, ANY, and ROWCOMPARE require the combining operators to deliver boolean
590  * results. ALL and ANY combine the per-row results using AND and OR
591  * semantics respectively.
592  * ARRAY requires just one target column, and creates an array of the target
593  * column's type using any number of rows resulting from the subselect.
594  *
595  * SubLink is classed as an Expr node, but it is not actually executable;
596  * it must be replaced in the expression tree by a SubPlan node during
597  * planning.
598  *
599  * NOTE: in the raw output of gram.y, testexpr contains just the raw form
600  * of the lefthand expression (if any), and operName is the String name of
601  * the combining operator. Also, subselect is a raw parsetree. During parse
602  * analysis, the parser transforms testexpr into a complete boolean expression
603  * that compares the lefthand value(s) to PARAM_SUBLINK nodes representing the
604  * output columns of the subselect. And subselect is transformed to a Query.
605  * This is the representation seen in saved rules and in the rewriter.
606  *
607  * In EXISTS, EXPR, MULTIEXPR, and ARRAY SubLinks, testexpr and operName
608  * are unused and are always null.
609  *
610  * subLinkId is currently used only for MULTIEXPR SubLinks, and is zero in
611  * other SubLinks. This number identifies different multiple-assignment
612  * subqueries within an UPDATE statement's SET list. It is unique only
613  * within a particular targetlist. The output column(s) of the MULTIEXPR
614  * are referenced by PARAM_MULTIEXPR Params appearing elsewhere in the tlist.
615  *
616  * The CTE_SUBLINK case never occurs in actual SubLink nodes, but it is used
617  * in SubPlans generated for WITH subqueries.
618  */
619 typedef enum SubLinkType
620 {
628  CTE_SUBLINK /* for SubPlans only */
629 } SubLinkType;
630 
631 
632 typedef struct SubLink
633 {
635  SubLinkType subLinkType; /* see above */
636  int subLinkId; /* ID (1..n); 0 if not MULTIEXPR */
637  Node *testexpr; /* outer-query test for ALL/ANY/ROWCOMPARE */
638  List *operName; /* originally specified operator name */
639  Node *subselect; /* subselect as Query* or raw parsetree */
640  int location; /* token location, or -1 if unknown */
641 } SubLink;
642 
643 /*
644  * SubPlan - executable expression node for a subplan (sub-SELECT)
645  *
646  * The planner replaces SubLink nodes in expression trees with SubPlan
647  * nodes after it has finished planning the subquery. SubPlan references
648  * a sub-plantree stored in the subplans list of the toplevel PlannedStmt.
649  * (We avoid a direct link to make it easier to copy expression trees
650  * without causing multiple processing of the subplan.)
651  *
652  * In an ordinary subplan, testexpr points to an executable expression
653  * (OpExpr, an AND/OR tree of OpExprs, or RowCompareExpr) for the combining
654  * operator(s); the left-hand arguments are the original lefthand expressions,
655  * and the right-hand arguments are PARAM_EXEC Param nodes representing the
656  * outputs of the sub-select. (NOTE: runtime coercion functions may be
657  * inserted as well.) This is just the same expression tree as testexpr in
658  * the original SubLink node, but the PARAM_SUBLINK nodes are replaced by
659  * suitably numbered PARAM_EXEC nodes.
660  *
661  * If the sub-select becomes an initplan rather than a subplan, the executable
662  * expression is part of the outer plan's expression tree (and the SubPlan
663  * node itself is not, but rather is found in the outer plan's initPlan
664  * list). In this case testexpr is NULL to avoid duplication.
665  *
666  * The planner also derives lists of the values that need to be passed into
667  * and out of the subplan. Input values are represented as a list "args" of
668  * expressions to be evaluated in the outer-query context (currently these
669  * args are always just Vars, but in principle they could be any expression).
670  * The values are assigned to the global PARAM_EXEC params indexed by parParam
671  * (the parParam and args lists must have the same ordering). setParam is a
672  * list of the PARAM_EXEC params that are computed by the sub-select, if it
673  * is an initplan; they are listed in order by sub-select output column
674  * position. (parParam and setParam are integer Lists, not Bitmapsets,
675  * because their ordering is significant.)
676  *
677  * Also, the planner computes startup and per-call costs for use of the
678  * SubPlan. Note that these include the cost of the subquery proper,
679  * evaluation of the testexpr if any, and any hashtable management overhead.
680  */
681 typedef struct SubPlan
682 {
684  /* Fields copied from original SubLink: */
685  SubLinkType subLinkType; /* see above */
686  /* The combining operators, transformed to an executable expression: */
687  Node *testexpr; /* OpExpr or RowCompareExpr expression tree */
688  List *paramIds; /* IDs of Params embedded in the above */
689  /* Identification of the Plan tree to use: */
690  int plan_id; /* Index (from 1) in PlannedStmt.subplans */
691  /* Identification of the SubPlan for EXPLAIN and debugging purposes: */
692  char *plan_name; /* A name assigned during planning */
693  /* Extra data useful for determining subplan's output type: */
694  Oid firstColType; /* Type of first column of subplan result */
695  int32 firstColTypmod; /* Typmod of first column of subplan result */
696  Oid firstColCollation; /* Collation of first column of subplan
697  * result */
698  /* Information about execution strategy: */
699  bool useHashTable; /* true to store subselect output in a hash
700  * table (implies we are doing "IN") */
701  bool unknownEqFalse; /* true if it's okay to return FALSE when the
702  * spec result is UNKNOWN; this allows much
703  * simpler handling of null values */
704  bool parallel_safe; /* is the subplan parallel-safe? */
705  /* Note: parallel_safe does not consider contents of testexpr or args */
706  /* Information for passing params into and out of the subselect: */
707  /* setParam and parParam are lists of integers (param IDs) */
708  List *setParam; /* initplan subqueries have to set these
709  * Params for parent plan */
710  List *parParam; /* indices of input Params from parent plan */
711  List *args; /* exprs to pass as parParam values */
712  /* Estimated execution costs: */
713  Cost startup_cost; /* one-time setup cost */
714  Cost per_call_cost; /* cost for each subplan evaluation */
715 } SubPlan;
716 
717 /*
718  * AlternativeSubPlan - expression node for a choice among SubPlans
719  *
720  * The subplans are given as a List so that the node definition need not
721  * change if there's ever more than two alternatives. For the moment,
722  * though, there are always exactly two; and the first one is the fast-start
723  * plan.
724  */
725 typedef struct AlternativeSubPlan
726 {
728  List *subplans; /* SubPlan(s) with equivalent results */
730 
731 /* ----------------
732  * FieldSelect
733  *
734  * FieldSelect represents the operation of extracting one field from a tuple
735  * value. At runtime, the input expression is expected to yield a rowtype
736  * Datum. The specified field number is extracted and returned as a Datum.
737  * ----------------
738  */
739 
740 typedef struct FieldSelect
741 {
743  Expr *arg; /* input expression */
744  AttrNumber fieldnum; /* attribute number of field to extract */
745  Oid resulttype; /* type of the field (result type of this
746  * node) */
747  int32 resulttypmod; /* output typmod (usually -1) */
748  Oid resultcollid; /* OID of collation of the field */
749 } FieldSelect;
750 
751 /* ----------------
752  * FieldStore
753  *
754  * FieldStore represents the operation of modifying one field in a tuple
755  * value, yielding a new tuple value (the input is not touched!). Like
756  * the assign case of ArrayRef, this is used to implement UPDATE of a
757  * portion of a column.
758  *
759  * resulttype is always a named composite type (not a domain). To update
760  * a composite domain value, apply CoerceToDomain to the FieldStore.
761  *
762  * A single FieldStore can actually represent updates of several different
763  * fields. The parser only generates FieldStores with single-element lists,
764  * but the planner will collapse multiple updates of the same base column
765  * into one FieldStore.
766  * ----------------
767  */
768 
769 typedef struct FieldStore
770 {
772  Expr *arg; /* input tuple value */
773  List *newvals; /* new value(s) for field(s) */
774  List *fieldnums; /* integer list of field attnums */
775  Oid resulttype; /* type of result (same as type of arg) */
776  /* Like RowExpr, we deliberately omit a typmod and collation here */
777 } FieldStore;
778 
779 /* ----------------
780  * RelabelType
781  *
782  * RelabelType represents a "dummy" type coercion between two binary-
783  * compatible datatypes, such as reinterpreting the result of an OID
784  * expression as an int4. It is a no-op at runtime; we only need it
785  * to provide a place to store the correct type to be attributed to
786  * the expression result during type resolution. (We can't get away
787  * with just overwriting the type field of the input expression node,
788  * so we need a separate node to show the coercion's result type.)
789  * ----------------
790  */
791 
792 typedef struct RelabelType
793 {
795  Expr *arg; /* input expression */
796  Oid resulttype; /* output type of coercion expression */
797  int32 resulttypmod; /* output typmod (usually -1) */
798  Oid resultcollid; /* OID of collation, or InvalidOid if none */
799  CoercionForm relabelformat; /* how to display this node */
800  int location; /* token location, or -1 if unknown */
801 } RelabelType;
802 
803 /* ----------------
804  * CoerceViaIO
805  *
806  * CoerceViaIO represents a type coercion between two types whose textual
807  * representations are compatible, implemented by invoking the source type's
808  * typoutput function then the destination type's typinput function.
809  * ----------------
810  */
811 
812 typedef struct CoerceViaIO
813 {
815  Expr *arg; /* input expression */
816  Oid resulttype; /* output type of coercion */
817  /* output typmod is not stored, but is presumed -1 */
818  Oid resultcollid; /* OID of collation, or InvalidOid if none */
819  CoercionForm coerceformat; /* how to display this node */
820  int location; /* token location, or -1 if unknown */
821 } CoerceViaIO;
822 
823 /* ----------------
824  * ArrayCoerceExpr
825  *
826  * ArrayCoerceExpr represents a type coercion from one array type to another,
827  * which is implemented by applying the per-element coercion expression
828  * "elemexpr" to each element of the source array. Within elemexpr, the
829  * source element is represented by a CaseTestExpr node. Note that even if
830  * elemexpr is a no-op (that is, just CaseTestExpr + RelabelType), the
831  * coercion still requires some effort: we have to fix the element type OID
832  * stored in the array header.
833  * ----------------
834  */
835 
836 typedef struct ArrayCoerceExpr
837 {
839  Expr *arg; /* input expression (yields an array) */
840  Expr *elemexpr; /* expression representing per-element work */
841  Oid resulttype; /* output type of coercion (an array type) */
842  int32 resulttypmod; /* output typmod (also element typmod) */
843  Oid resultcollid; /* OID of collation, or InvalidOid if none */
844  CoercionForm coerceformat; /* how to display this node */
845  int location; /* token location, or -1 if unknown */
847 
848 /* ----------------
849  * ConvertRowtypeExpr
850  *
851  * ConvertRowtypeExpr represents a type coercion from one composite type
852  * to another, where the source type is guaranteed to contain all the columns
853  * needed for the destination type plus possibly others; the columns need not
854  * be in the same positions, but are matched up by name. This is primarily
855  * used to convert a whole-row value of an inheritance child table into a
856  * valid whole-row value of its parent table's rowtype. Both resulttype
857  * and the exposed type of "arg" must be named composite types (not domains).
858  * ----------------
859  */
860 
861 typedef struct ConvertRowtypeExpr
862 {
864  Expr *arg; /* input expression */
865  Oid resulttype; /* output type (always a composite type) */
866  /* Like RowExpr, we deliberately omit a typmod and collation here */
867  CoercionForm convertformat; /* how to display this node */
868  int location; /* token location, or -1 if unknown */
870 
871 /*----------
872  * CollateExpr - COLLATE
873  *
874  * The planner replaces CollateExpr with RelabelType during expression
875  * preprocessing, so execution never sees a CollateExpr.
876  *----------
877  */
878 typedef struct CollateExpr
879 {
881  Expr *arg; /* input expression */
882  Oid collOid; /* collation's OID */
883  int location; /* token location, or -1 if unknown */
884 } CollateExpr;
885 
886 /*----------
887  * CaseExpr - a CASE expression
888  *
889  * We support two distinct forms of CASE expression:
890  * CASE WHEN boolexpr THEN expr [ WHEN boolexpr THEN expr ... ]
891  * CASE testexpr WHEN compexpr THEN expr [ WHEN compexpr THEN expr ... ]
892  * These are distinguishable by the "arg" field being NULL in the first case
893  * and the testexpr in the second case.
894  *
895  * In the raw grammar output for the second form, the condition expressions
896  * of the WHEN clauses are just the comparison values. Parse analysis
897  * converts these to valid boolean expressions of the form
898  * CaseTestExpr '=' compexpr
899  * where the CaseTestExpr node is a placeholder that emits the correct
900  * value at runtime. This structure is used so that the testexpr need be
901  * evaluated only once. Note that after parse analysis, the condition
902  * expressions always yield boolean.
903  *
904  * Note: we can test whether a CaseExpr has been through parse analysis
905  * yet by checking whether casetype is InvalidOid or not.
906  *----------
907  */
908 typedef struct CaseExpr
909 {
911  Oid casetype; /* type of expression result */
912  Oid casecollid; /* OID of collation, or InvalidOid if none */
913  Expr *arg; /* implicit equality comparison argument */
914  List *args; /* the arguments (list of WHEN clauses) */
915  Expr *defresult; /* the default result (ELSE clause) */
916  int location; /* token location, or -1 if unknown */
917 } CaseExpr;
918 
919 /*
920  * CaseWhen - one arm of a CASE expression
921  */
922 typedef struct CaseWhen
923 {
925  Expr *expr; /* condition expression */
926  Expr *result; /* substitution result */
927  int location; /* token location, or -1 if unknown */
928 } CaseWhen;
929 
930 /*
931  * Placeholder node for the test value to be processed by a CASE expression.
932  * This is effectively like a Param, but can be implemented more simply
933  * since we need only one replacement value at a time.
934  *
935  * We also use this in nested UPDATE expressions.
936  * See transformAssignmentIndirection().
937  */
938 typedef struct CaseTestExpr
939 {
941  Oid typeId; /* type for substituted value */
942  int32 typeMod; /* typemod for substituted value */
943  Oid collation; /* collation for the substituted value */
944 } CaseTestExpr;
945 
946 /*
947  * ArrayExpr - an ARRAY[] expression
948  *
949  * Note: if multidims is false, the constituent expressions all yield the
950  * scalar type identified by element_typeid. If multidims is true, the
951  * constituent expressions all yield arrays of element_typeid (ie, the same
952  * type as array_typeid); at runtime we must check for compatible subscripts.
953  */
954 typedef struct ArrayExpr
955 {
957  Oid array_typeid; /* type of expression result */
958  Oid array_collid; /* OID of collation, or InvalidOid if none */
959  Oid element_typeid; /* common type of array elements */
960  List *elements; /* the array elements or sub-arrays */
961  bool multidims; /* true if elements are sub-arrays */
962  int location; /* token location, or -1 if unknown */
963 } ArrayExpr;
964 
965 /*
966  * RowExpr - a ROW() expression
967  *
968  * Note: the list of fields must have a one-for-one correspondence with
969  * physical fields of the associated rowtype, although it is okay for it
970  * to be shorter than the rowtype. That is, the N'th list element must
971  * match up with the N'th physical field. When the N'th physical field
972  * is a dropped column (attisdropped) then the N'th list element can just
973  * be a NULL constant. (This case can only occur for named composite types,
974  * not RECORD types, since those are built from the RowExpr itself rather
975  * than vice versa.) It is important not to assume that length(args) is
976  * the same as the number of columns logically present in the rowtype.
977  *
978  * colnames provides field names in cases where the names can't easily be
979  * obtained otherwise. Names *must* be provided if row_typeid is RECORDOID.
980  * If row_typeid identifies a known composite type, colnames can be NIL to
981  * indicate the type's cataloged field names apply. Note that colnames can
982  * be non-NIL even for a composite type, and typically is when the RowExpr
983  * was created by expanding a whole-row Var. This is so that we can retain
984  * the column alias names of the RTE that the Var referenced (which would
985  * otherwise be very difficult to extract from the parsetree). Like the
986  * args list, colnames is one-for-one with physical fields of the rowtype.
987  */
988 typedef struct RowExpr
989 {
991  List *args; /* the fields */
992  Oid row_typeid; /* RECORDOID or a composite type's ID */
993 
994  /*
995  * row_typeid cannot be a domain over composite, only plain composite. To
996  * create a composite domain value, apply CoerceToDomain to the RowExpr.
997  *
998  * Note: we deliberately do NOT store a typmod. Although a typmod will be
999  * associated with specific RECORD types at runtime, it will differ for
1000  * different backends, and so cannot safely be stored in stored
1001  * parsetrees. We must assume typmod -1 for a RowExpr node.
1002  *
1003  * We don't need to store a collation either. The result type is
1004  * necessarily composite, and composite types never have a collation.
1005  */
1006  CoercionForm row_format; /* how to display this node */
1007  List *colnames; /* list of String, or NIL */
1008  int location; /* token location, or -1 if unknown */
1009 } RowExpr;
1010 
1011 /*
1012  * RowCompareExpr - row-wise comparison, such as (a, b) <= (1, 2)
1013  *
1014  * We support row comparison for any operator that can be determined to
1015  * act like =, <>, <, <=, >, or >= (we determine this by looking for the
1016  * operator in btree opfamilies). Note that the same operator name might
1017  * map to a different operator for each pair of row elements, since the
1018  * element datatypes can vary.
1019  *
1020  * A RowCompareExpr node is only generated for the < <= > >= cases;
1021  * the = and <> cases are translated to simple AND or OR combinations
1022  * of the pairwise comparisons. However, we include = and <> in the
1023  * RowCompareType enum for the convenience of parser logic.
1024  */
1025 typedef enum RowCompareType
1026 {
1027  /* Values of this enum are chosen to match btree strategy numbers */
1028  ROWCOMPARE_LT = 1, /* BTLessStrategyNumber */
1029  ROWCOMPARE_LE = 2, /* BTLessEqualStrategyNumber */
1030  ROWCOMPARE_EQ = 3, /* BTEqualStrategyNumber */
1031  ROWCOMPARE_GE = 4, /* BTGreaterEqualStrategyNumber */
1032  ROWCOMPARE_GT = 5, /* BTGreaterStrategyNumber */
1033  ROWCOMPARE_NE = 6 /* no such btree strategy */
1034 } RowCompareType;
1035 
1036 typedef struct RowCompareExpr
1037 {
1039  RowCompareType rctype; /* LT LE GE or GT, never EQ or NE */
1040  List *opnos; /* OID list of pairwise comparison ops */
1041  List *opfamilies; /* OID list of containing operator families */
1042  List *inputcollids; /* OID list of collations for comparisons */
1043  List *largs; /* the left-hand input arguments */
1044  List *rargs; /* the right-hand input arguments */
1045 } RowCompareExpr;
1046 
1047 /*
1048  * CoalesceExpr - a COALESCE expression
1049  */
1050 typedef struct CoalesceExpr
1051 {
1053  Oid coalescetype; /* type of expression result */
1054  Oid coalescecollid; /* OID of collation, or InvalidOid if none */
1055  List *args; /* the arguments */
1056  int location; /* token location, or -1 if unknown */
1057 } CoalesceExpr;
1058 
1059 /*
1060  * MinMaxExpr - a GREATEST or LEAST function
1061  */
1062 typedef enum MinMaxOp
1063 {
1066 } MinMaxOp;
1067 
1068 typedef struct MinMaxExpr
1069 {
1071  Oid minmaxtype; /* common type of arguments and result */
1072  Oid minmaxcollid; /* OID of collation of result */
1073  Oid inputcollid; /* OID of collation that function should use */
1074  MinMaxOp op; /* function to execute */
1075  List *args; /* the arguments */
1076  int location; /* token location, or -1 if unknown */
1077 } MinMaxExpr;
1078 
1079 /*
1080  * SQLValueFunction - parameterless functions with special grammar productions
1081  *
1082  * The SQL standard categorizes some of these as <datetime value function>
1083  * and others as <general value specification>. We call 'em SQLValueFunctions
1084  * for lack of a better term. We store type and typmod of the result so that
1085  * some code doesn't need to know each function individually, and because
1086  * we would need to store typmod anyway for some of the datetime functions.
1087  * Note that currently, all variants return non-collating datatypes, so we do
1088  * not need a collation field; also, all these functions are stable.
1089  */
1091 {
1108 
1109 typedef struct SQLValueFunction
1110 {
1112  SQLValueFunctionOp op; /* which function this is */
1113  Oid type; /* result type/typmod */
1115  int location; /* token location, or -1 if unknown */
1117 
1118 /*
1119  * XmlExpr - various SQL/XML functions requiring special grammar productions
1120  *
1121  * 'name' carries the "NAME foo" argument (already XML-escaped).
1122  * 'named_args' and 'arg_names' represent an xml_attribute list.
1123  * 'args' carries all other arguments.
1124  *
1125  * Note: result type/typmod/collation are not stored, but can be deduced
1126  * from the XmlExprOp. The type/typmod fields are just used for display
1127  * purposes, and are NOT necessarily the true result type of the node.
1128  */
1129 typedef enum XmlExprOp
1130 {
1131  IS_XMLCONCAT, /* XMLCONCAT(args) */
1132  IS_XMLELEMENT, /* XMLELEMENT(name, xml_attributes, args) */
1133  IS_XMLFOREST, /* XMLFOREST(xml_attributes) */
1134  IS_XMLPARSE, /* XMLPARSE(text, is_doc, preserve_ws) */
1135  IS_XMLPI, /* XMLPI(name [, args]) */
1136  IS_XMLROOT, /* XMLROOT(xml, version, standalone) */
1137  IS_XMLSERIALIZE, /* XMLSERIALIZE(is_document, xmlval) */
1138  IS_DOCUMENT /* xmlval IS DOCUMENT */
1139 } XmlExprOp;
1140 
1141 typedef enum
1142 {
1145 } XmlOptionType;
1146 
1147 typedef struct XmlExpr
1148 {
1150  XmlExprOp op; /* xml function ID */
1151  char *name; /* name in xml(NAME foo ...) syntaxes */
1152  List *named_args; /* non-XML expressions for xml_attributes */
1153  List *arg_names; /* parallel list of Value strings */
1154  List *args; /* list of expressions */
1155  XmlOptionType xmloption; /* DOCUMENT or CONTENT */
1156  Oid type; /* target type/typmod for XMLSERIALIZE */
1158  int location; /* token location, or -1 if unknown */
1159 } XmlExpr;
1160 
1161 /* ----------------
1162  * NullTest
1163  *
1164  * NullTest represents the operation of testing a value for NULLness.
1165  * The appropriate test is performed and returned as a boolean Datum.
1166  *
1167  * When argisrow is false, this simply represents a test for the null value.
1168  *
1169  * When argisrow is true, the input expression must yield a rowtype, and
1170  * the node implements "row IS [NOT] NULL" per the SQL standard. This
1171  * includes checking individual fields for NULLness when the row datum
1172  * itself isn't NULL.
1173  *
1174  * NOTE: the combination of a rowtype input and argisrow==false does NOT
1175  * correspond to the SQL notation "row IS [NOT] NULL"; instead, this case
1176  * represents the SQL notation "row IS [NOT] DISTINCT FROM NULL".
1177  * ----------------
1178  */
1179 
1180 typedef enum NullTestType
1181 {
1183 } NullTestType;
1184 
1185 typedef struct NullTest
1186 {
1188  Expr *arg; /* input expression */
1189  NullTestType nulltesttype; /* IS NULL, IS NOT NULL */
1190  bool argisrow; /* T to perform field-by-field null checks */
1191  int location; /* token location, or -1 if unknown */
1192 } NullTest;
1193 
1194 /*
1195  * BooleanTest
1196  *
1197  * BooleanTest represents the operation of determining whether a boolean
1198  * is TRUE, FALSE, or UNKNOWN (ie, NULL). All six meaningful combinations
1199  * are supported. Note that a NULL input does *not* cause a NULL result.
1200  * The appropriate test is performed and returned as a boolean Datum.
1201  */
1202 
1203 typedef enum BoolTestType
1204 {
1206 } BoolTestType;
1207 
1208 typedef struct BooleanTest
1209 {
1211  Expr *arg; /* input expression */
1212  BoolTestType booltesttype; /* test type */
1213  int location; /* token location, or -1 if unknown */
1214 } BooleanTest;
1215 
1216 /*
1217  * CoerceToDomain
1218  *
1219  * CoerceToDomain represents the operation of coercing a value to a domain
1220  * type. At runtime (and not before) the precise set of constraints to be
1221  * checked will be determined. If the value passes, it is returned as the
1222  * result; if not, an error is raised. Note that this is equivalent to
1223  * RelabelType in the scenario where no constraints are applied.
1224  */
1225 typedef struct CoerceToDomain
1226 {
1228  Expr *arg; /* input expression */
1229  Oid resulttype; /* domain type ID (result type) */
1230  int32 resulttypmod; /* output typmod (currently always -1) */
1231  Oid resultcollid; /* OID of collation, or InvalidOid if none */
1232  CoercionForm coercionformat; /* how to display this node */
1233  int location; /* token location, or -1 if unknown */
1234 } CoerceToDomain;
1235 
1236 /*
1237  * Placeholder node for the value to be processed by a domain's check
1238  * constraint. This is effectively like a Param, but can be implemented more
1239  * simply since we need only one replacement value at a time.
1240  *
1241  * Note: the typeId/typeMod/collation will be set from the domain's base type,
1242  * not the domain itself. This is because we shouldn't consider the value
1243  * to be a member of the domain if we haven't yet checked its constraints.
1244  */
1245 typedef struct CoerceToDomainValue
1246 {
1248  Oid typeId; /* type for substituted value */
1249  int32 typeMod; /* typemod for substituted value */
1250  Oid collation; /* collation for the substituted value */
1251  int location; /* token location, or -1 if unknown */
1253 
1254 /*
1255  * Placeholder node for a DEFAULT marker in an INSERT or UPDATE command.
1256  *
1257  * This is not an executable expression: it must be replaced by the actual
1258  * column default expression during rewriting. But it is convenient to
1259  * treat it as an expression node during parsing and rewriting.
1260  */
1261 typedef struct SetToDefault
1262 {
1264  Oid typeId; /* type for substituted value */
1265  int32 typeMod; /* typemod for substituted value */
1266  Oid collation; /* collation for the substituted value */
1267  int location; /* token location, or -1 if unknown */
1268 } SetToDefault;
1269 
1270 /*
1271  * Node representing [WHERE] CURRENT OF cursor_name
1272  *
1273  * CURRENT OF is a bit like a Var, in that it carries the rangetable index
1274  * of the target relation being constrained; this aids placing the expression
1275  * correctly during planning. We can assume however that its "levelsup" is
1276  * always zero, due to the syntactic constraints on where it can appear.
1277  *
1278  * The referenced cursor can be represented either as a hardwired string
1279  * or as a reference to a run-time parameter of type REFCURSOR. The latter
1280  * case is for the convenience of plpgsql.
1281  */
1282 typedef struct CurrentOfExpr
1283 {
1285  Index cvarno; /* RT index of target relation */
1286  char *cursor_name; /* name of referenced cursor, or NULL */
1287  int cursor_param; /* refcursor parameter number, or 0 */
1288 } CurrentOfExpr;
1289 
1290 /*
1291  * NextValueExpr - get next value from sequence
1292  *
1293  * This has the same effect as calling the nextval() function, but it does not
1294  * check permissions on the sequence. This is used for identity columns,
1295  * where the sequence is an implicit dependency without its own permissions.
1296  */
1297 typedef struct NextValueExpr
1298 {
1302 } NextValueExpr;
1303 
1304 /*
1305  * InferenceElem - an element of a unique index inference specification
1306  *
1307  * This mostly matches the structure of IndexElems, but having a dedicated
1308  * primnode allows for a clean separation between the use of index parameters
1309  * by utility commands, and this node.
1310  */
1311 typedef struct InferenceElem
1312 {
1314  Node *expr; /* expression to infer from, or NULL */
1315  Oid infercollid; /* OID of collation, or InvalidOid */
1316  Oid inferopclass; /* OID of att opclass, or InvalidOid */
1317 } InferenceElem;
1318 
1319 /*--------------------
1320  * TargetEntry -
1321  * a target entry (used in query target lists)
1322  *
1323  * Strictly speaking, a TargetEntry isn't an expression node (since it can't
1324  * be evaluated by ExecEvalExpr). But we treat it as one anyway, since in
1325  * very many places it's convenient to process a whole query targetlist as a
1326  * single expression tree.
1327  *
1328  * In a SELECT's targetlist, resno should always be equal to the item's
1329  * ordinal position (counting from 1). However, in an INSERT or UPDATE
1330  * targetlist, resno represents the attribute number of the destination
1331  * column for the item; so there may be missing or out-of-order resnos.
1332  * It is even legal to have duplicated resnos; consider
1333  * UPDATE table SET arraycol[1] = ..., arraycol[2] = ..., ...
1334  * The two meanings come together in the executor, because the planner
1335  * transforms INSERT/UPDATE tlists into a normalized form with exactly
1336  * one entry for each column of the destination table. Before that's
1337  * happened, however, it is risky to assume that resno == position.
1338  * Generally get_tle_by_resno() should be used rather than list_nth()
1339  * to fetch tlist entries by resno, and only in SELECT should you assume
1340  * that resno is a unique identifier.
1341  *
1342  * resname is required to represent the correct column name in non-resjunk
1343  * entries of top-level SELECT targetlists, since it will be used as the
1344  * column title sent to the frontend. In most other contexts it is only
1345  * a debugging aid, and may be wrong or even NULL. (In particular, it may
1346  * be wrong in a tlist from a stored rule, if the referenced column has been
1347  * renamed by ALTER TABLE since the rule was made. Also, the planner tends
1348  * to store NULL rather than look up a valid name for tlist entries in
1349  * non-toplevel plan nodes.) In resjunk entries, resname should be either
1350  * a specific system-generated name (such as "ctid") or NULL; anything else
1351  * risks confusing ExecGetJunkAttribute!
1352  *
1353  * ressortgroupref is used in the representation of ORDER BY, GROUP BY, and
1354  * DISTINCT items. Targetlist entries with ressortgroupref=0 are not
1355  * sort/group items. If ressortgroupref>0, then this item is an ORDER BY,
1356  * GROUP BY, and/or DISTINCT target value. No two entries in a targetlist
1357  * may have the same nonzero ressortgroupref --- but there is no particular
1358  * meaning to the nonzero values, except as tags. (For example, one must
1359  * not assume that lower ressortgroupref means a more significant sort key.)
1360  * The order of the associated SortGroupClause lists determine the semantics.
1361  *
1362  * resorigtbl/resorigcol identify the source of the column, if it is a
1363  * simple reference to a column of a base table (or view). If it is not
1364  * a simple reference, these fields are zeroes.
1365  *
1366  * If resjunk is true then the column is a working column (such as a sort key)
1367  * that should be removed from the final output of the query. Resjunk columns
1368  * must have resnos that cannot duplicate any regular column's resno. Also
1369  * note that there are places that assume resjunk columns come after non-junk
1370  * columns.
1371  *--------------------
1372  */
1373 typedef struct TargetEntry
1374 {
1376  Expr *expr; /* expression to evaluate */
1377  AttrNumber resno; /* attribute number (see notes above) */
1378  char *resname; /* name of the column (could be NULL) */
1379  Index ressortgroupref; /* nonzero if referenced by a sort/group
1380  * clause */
1381  Oid resorigtbl; /* OID of column's source table */
1382  AttrNumber resorigcol; /* column's number in source table */
1383  bool resjunk; /* set to true to eliminate the attribute from
1384  * final target list */
1385 } TargetEntry;
1386 
1387 
1388 /* ----------------------------------------------------------------
1389  * node types for join trees
1390  *
1391  * The leaves of a join tree structure are RangeTblRef nodes. Above
1392  * these, JoinExpr nodes can appear to denote a specific kind of join
1393  * or qualified join. Also, FromExpr nodes can appear to denote an
1394  * ordinary cross-product join ("FROM foo, bar, baz WHERE ...").
1395  * FromExpr is like a JoinExpr of jointype JOIN_INNER, except that it
1396  * may have any number of child nodes, not just two.
1397  *
1398  * NOTE: the top level of a Query's jointree is always a FromExpr.
1399  * Even if the jointree contains no rels, there will be a FromExpr.
1400  *
1401  * NOTE: the qualification expressions present in JoinExpr nodes are
1402  * *in addition to* the query's main WHERE clause, which appears as the
1403  * qual of the top-level FromExpr. The reason for associating quals with
1404  * specific nodes in the jointree is that the position of a qual is critical
1405  * when outer joins are present. (If we enforce a qual too soon or too late,
1406  * that may cause the outer join to produce the wrong set of NULL-extended
1407  * rows.) If all joins are inner joins then all the qual positions are
1408  * semantically interchangeable.
1409  *
1410  * NOTE: in the raw output of gram.y, a join tree contains RangeVar,
1411  * RangeSubselect, and RangeFunction nodes, which are all replaced by
1412  * RangeTblRef nodes during the parse analysis phase. Also, the top-level
1413  * FromExpr is added during parse analysis; the grammar regards FROM and
1414  * WHERE as separate.
1415  * ----------------------------------------------------------------
1416  */
1417 
1418 /*
1419  * RangeTblRef - reference to an entry in the query's rangetable
1420  *
1421  * We could use direct pointers to the RT entries and skip having these
1422  * nodes, but multiple pointers to the same node in a querytree cause
1423  * lots of headaches, so it seems better to store an index into the RT.
1424  */
1425 typedef struct RangeTblRef
1426 {
1428  int rtindex;
1429 } RangeTblRef;
1430 
1431 /*----------
1432  * JoinExpr - for SQL JOIN expressions
1433  *
1434  * isNatural, usingClause, and quals are interdependent. The user can write
1435  * only one of NATURAL, USING(), or ON() (this is enforced by the grammar).
1436  * If he writes NATURAL then parse analysis generates the equivalent USING()
1437  * list, and from that fills in "quals" with the right equality comparisons.
1438  * If he writes USING() then "quals" is filled with equality comparisons.
1439  * If he writes ON() then only "quals" is set. Note that NATURAL/USING
1440  * are not equivalent to ON() since they also affect the output column list.
1441  *
1442  * alias is an Alias node representing the AS alias-clause attached to the
1443  * join expression, or NULL if no clause. NB: presence or absence of the
1444  * alias has a critical impact on semantics, because a join with an alias
1445  * restricts visibility of the tables/columns inside it.
1446  *
1447  * During parse analysis, an RTE is created for the Join, and its index
1448  * is filled into rtindex. This RTE is present mainly so that Vars can
1449  * be created that refer to the outputs of the join. The planner sometimes
1450  * generates JoinExprs internally; these can have rtindex = 0 if there are
1451  * no join alias variables referencing such joins.
1452  *----------
1453  */
1454 typedef struct JoinExpr
1455 {
1457  JoinType jointype; /* type of join */
1458  bool isNatural; /* Natural join? Will need to shape table */
1459  Node *larg; /* left subtree */
1460  Node *rarg; /* right subtree */
1461  List *usingClause; /* USING clause, if any (list of String) */
1462  Node *quals; /* qualifiers on join, if any */
1463  Alias *alias; /* user-written alias clause, if any */
1464  int rtindex; /* RT index assigned for join, or 0 */
1465 } JoinExpr;
1466 
1467 /*----------
1468  * FromExpr - represents a FROM ... WHERE ... construct
1469  *
1470  * This is both more flexible than a JoinExpr (it can have any number of
1471  * children, including zero) and less so --- we don't need to deal with
1472  * aliases and so on. The output column set is implicitly just the union
1473  * of the outputs of the children.
1474  *----------
1475  */
1476 typedef struct FromExpr
1477 {
1479  List *fromlist; /* List of join subtrees */
1480  Node *quals; /* qualifiers on join, if any */
1481 } FromExpr;
1482 
1483 /*----------
1484  * OnConflictExpr - represents an ON CONFLICT DO ... expression
1485  *
1486  * The optimizer requires a list of inference elements, and optionally a WHERE
1487  * clause to infer a unique index. The unique index (or, occasionally,
1488  * indexes) inferred are used to arbitrate whether or not the alternative ON
1489  * CONFLICT path is taken.
1490  *----------
1491  */
1492 typedef struct OnConflictExpr
1493 {
1495  OnConflictAction action; /* DO NOTHING or UPDATE? */
1496 
1497  /* Arbiter */
1498  List *arbiterElems; /* unique index arbiter list (of
1499  * InferenceElem's) */
1500  Node *arbiterWhere; /* unique index arbiter WHERE clause */
1501  Oid constraint; /* pg_constraint OID for arbiter */
1502 
1503  /* ON CONFLICT UPDATE */
1504  List *onConflictSet; /* List of ON CONFLICT SET TargetEntrys */
1505  Node *onConflictWhere; /* qualifiers to restrict UPDATE to */
1506  int exclRelIndex; /* RT index of 'excluded' relation */
1507  List *exclRelTlist; /* tlist of the EXCLUDED pseudo relation */
1508 } OnConflictExpr;
1509 
1510 
1511 /*
1512  * Node types to represent a partition pruning step.
1513  */
1514 
1515 /*
1516  * The base Node type. step_id is the global identifier of a given step
1517  * within a given pruning context.
1518  */
1519 typedef struct PartitionPruneStep
1520 {
1522  int step_id;
1524 
1525 /*----------
1526  * PartitionPruneStepOp - Information to prune using a set of mutually AND'd
1527  * OpExpr clauses
1528  *
1529  * This contains information extracted from up to partnatts OpExpr clauses,
1530  * where partnatts is the number of partition key columns. 'opstrategy' is the
1531  * strategy of the operator in the clause matched to the last partition key.
1532  * 'exprs' contains expressions which comprise the lookup key to be passed to
1533  * the partition bound search function. 'cmpfns' contains the OIDs of
1534  * comparison function used to compare aforementioned expressions with
1535  * partition bounds. Both 'exprs' and 'cmpfns' contain the same number of
1536  * items up to partnatts items.
1537  *
1538  * Once we find the offset of a partition bound using the lookup key, we
1539  * determine which partitions to include in the result based on the value of
1540  * 'opstrategy'. For example, if it were equality, we'd return just the
1541  * partition that would contain that key or a set of partitions if the key
1542  * didn't consist of all partitioning columns. For non-equality strategies,
1543  * we'd need to include other partitions as appropriate.
1544  *
1545  * 'nullkeys' is the set containing the offset of the partition keys (0 to
1546  * partnatts - 1) that were matched to an IS NULL clause. This is only
1547  * considered for hash partitioning as we need to pass which keys are null
1548  * to the hash partition bound search function. It is never possible to
1549  * have an expression be present in 'exprs' for a given partition key and
1550  * the corresponding bit set in 'nullkeys'.
1551  *----------
1552  */
1553 typedef struct PartitionPruneStepOp
1554 {
1556 
1562 
1563 /*----------
1564  * PartitionPruneStepCombine - Information to prune using a BoolExpr clause
1565  *
1566  * For BoolExpr clauses, we combine the set of partitions determined for each
1567  * of its argument clauses.
1568  *----------
1569  */
1571 {
1575 
1577 {
1579 
1583 
1584 /*----------
1585  * PartitionPruneInfo - Details required to allow the executor to prune
1586  * partitions.
1587  *
1588  * Here we store mapping details to allow translation of a partitioned table's
1589  * index into subnode indexes for node types which support arbitrary numbers
1590  * of sub nodes, such as Append.
1591  *----------
1592  */
1593 typedef struct PartitionPruneInfo
1594 {
1596  Oid reloid; /* Oid of partition rel */
1597  List *pruning_steps; /* List of PartitionPruneStep */
1598  Bitmapset *present_parts; /* Indexes of all partitions which subnodes
1599  * are present for. */
1600  int nparts; /* The length of the following two arrays */
1601  int *subnode_map; /* subnode index by partition id, or -1 */
1602  int *subpart_map; /* subpart index by partition id, or -1 */
1603  Bitmapset *extparams; /* All external paramids seen in prunesteps */
1604  Bitmapset *execparams; /* All exec paramids seen in prunesteps */
1606 
1607 #endif /* PRIMNODES_H */
Datum constvalue
Definition: primnodes.h:197
NodeTag type
Definition: primnodes.h:42
List * aggdistinct
Definition: primnodes.h:304
Oid funcresulttype
Definition: primnodes.h:451
Oid minmaxtype
Definition: primnodes.h:1071
bool multidims
Definition: primnodes.h:961
Expr xpr
Definition: primnodes.h:355
Bitmapset * present_parts
Definition: primnodes.h:1598
struct CaseWhen CaseWhen
struct OpExpr OpExpr
Oid firstColType
Definition: primnodes.h:694
struct FieldSelect FieldSelect
Expr * refassgnexpr
Definition: primnodes.h:411
List * args
Definition: primnodes.h:1075
Expr xpr
Definition: primnodes.h:910
PartitionPruneCombineOp
Definition: primnodes.h:1570
bool aggvariadic
Definition: primnodes.h:307
List * args
Definition: primnodes.h:991
Expr xpr
Definition: primnodes.h:1187
Node * docexpr
Definition: primnodes.h:85
struct CoerceToDomain CoerceToDomain
NodeTag type
Definition: primnodes.h:1494
Expr * arg
Definition: primnodes.h:772
Index varlevelsup
Definition: primnodes.h:174
OnCommitAction onCommit
Definition: primnodes.h:113
int plan_id
Definition: primnodes.h:690
List * args
Definition: primnodes.h:342
ParamKind
Definition: primnodes.h:234
char * name
Definition: primnodes.h:1151
List * refs
Definition: primnodes.h:344
struct FromExpr FromExpr
bool constbyval
Definition: primnodes.h:200
List * args
Definition: primnodes.h:360
List * args
Definition: primnodes.h:458
Oid wincollid
Definition: primnodes.h:358
int32 resulttypmod
Definition: primnodes.h:1230
List * colnames
Definition: primnodes.h:87
List * colnames
Definition: primnodes.h:44
Oid resulttype
Definition: primnodes.h:745
char * tableSpaceName
Definition: primnodes.h:114
List * coltypmods
Definition: primnodes.h:89
struct CoerceToDomainValue CoerceToDomainValue
struct Alias Alias
BoolTestType
Definition: primnodes.h:1203
Expr xpr
Definition: primnodes.h:399
Oid funccollid
Definition: primnodes.h:456
int location
Definition: primnodes.h:1158
Oid resulttype
Definition: primnodes.h:816
Bitmapset * extparams
Definition: primnodes.h:1603
XmlExprOp
Definition: primnodes.h:1129
OpExpr NullIfExpr
Definition: primnodes.h:525
RowCompareType rctype
Definition: primnodes.h:1039
List * opfamilies
Definition: primnodes.h:1041
NodeTag type
Definition: primnodes.h:82
Oid type
Definition: primnodes.h:1156
struct JoinExpr JoinExpr
Oid casecollid
Definition: primnodes.h:912
SubLinkType subLinkType
Definition: primnodes.h:685
Expr * arg
Definition: primnodes.h:795
Oid inputcollid
Definition: primnodes.h:298
ParamKind paramkind
Definition: primnodes.h:245
struct FuncExpr FuncExpr
struct CollateExpr CollateExpr
Definition: nodes.h:517
struct PartitionPruneStep PartitionPruneStep
CoercionForm coercionformat
Definition: primnodes.h:1232
uint16 StrategyNumber
Definition: stratnum.h:22
NodeTag type
Definition: primnodes.h:66
struct AlternativeSubPlan AlternativeSubPlan
Oid resorigtbl
Definition: primnodes.h:1381
List * args
Definition: primnodes.h:302
AttrNumber varattno
Definition: primnodes.h:169
Oid array_typeid
Definition: primnodes.h:957
Expr * arg
Definition: primnodes.h:743
List * paramIds
Definition: primnodes.h:688
bool funcretset
Definition: primnodes.h:452
struct SubPlan SubPlan
struct Expr Expr
struct ArrayRef ArrayRef
List * fromlist
Definition: primnodes.h:1479
Expr xpr
Definition: primnodes.h:1149
NullTestType
Definition: primnodes.h:1180
bool skipData
Definition: primnodes.h:116
Bitmapset * execparams
Definition: primnodes.h:1604
Oid casetype
Definition: primnodes.h:911
bool aggstar
Definition: primnodes.h:306
Expr xpr
Definition: primnodes.h:990
unsigned int Oid
Definition: postgres_ext.h:31
Expr xpr
Definition: primnodes.h:166
NodeTag
Definition: nodes.h:26
Index winref
Definition: primnodes.h:362
char * resname
Definition: primnodes.h:1378
List * arg_names
Definition: primnodes.h:1153
Definition: primnodes.h:164
PartitionPruneCombineOp combineOp
Definition: primnodes.h:1580
CoercionContext
Definition: primnodes.h:421
Node * quals
Definition: primnodes.h:1480
struct Var Var
int32 typeMod
Definition: primnodes.h:942
int location
Definition: primnodes.h:565
int location
Definition: primnodes.h:927
OnCommitAction
Definition: primnodes.h:48
SQLValueFunctionOp op
Definition: primnodes.h:1112
NodeTag type
Definition: primnodes.h:1478
List * colcollations
Definition: primnodes.h:90
signed int int32
Definition: c.h:313
struct RelabelType RelabelType
JoinType
Definition: nodes.h:681
List * arbiterElems
Definition: primnodes.h:1498
Expr xpr
Definition: primnodes.h:244
struct ConvertRowtypeExpr ConvertRowtypeExpr
char * schemaname
Definition: primnodes.h:68
Node * larg
Definition: primnodes.h:1459
int location
Definition: primnodes.h:74
int constlen
Definition: primnodes.h:196
Expr xpr
Definition: primnodes.h:496
char * relname
Definition: primnodes.h:69
Oid consttype
Definition: primnodes.h:193
List * aggargtypes
Definition: primnodes.h:300
struct RangeTblRef RangeTblRef
CoercionForm funcformat
Definition: primnodes.h:455
struct WindowFunc WindowFunc
struct RangeVar RangeVar
Index varnoold
Definition: primnodes.h:177
Oid opresulttype
Definition: primnodes.h:499
struct NextValueExpr NextValueExpr
MinMaxOp
Definition: primnodes.h:1062
bool resjunk
Definition: primnodes.h:1383
struct FieldStore FieldStore
Oid funcid
Definition: primnodes.h:450
List * colnames
Definition: primnodes.h:1007
Node * viewQuery
Definition: primnodes.h:115
struct RowExpr RowExpr
Oid paramcollid
Definition: primnodes.h:249
int location
Definition: primnodes.h:250
Oid vartype
Definition: primnodes.h:171
List * args
Definition: primnodes.h:1055
BoolExprType boolop
Definition: primnodes.h:563
struct XmlExpr XmlExpr
struct TableFunc TableFunc
Expr * arg
Definition: primnodes.h:1188
int location
Definition: primnodes.h:312
List * coldefexprs
Definition: primnodes.h:92
Oid constcollid
Definition: primnodes.h:195
Oid resultcollid
Definition: primnodes.h:748
List * ns_names
Definition: primnodes.h:84
struct CoerceViaIO CoerceViaIO
Node * rowexpr
Definition: primnodes.h:86
int location
Definition: primnodes.h:179
int location
Definition: primnodes.h:1008
struct Const Const
int32 typeMod
Definition: primnodes.h:1265
int location
Definition: primnodes.h:1076
List * exclRelTlist
Definition: primnodes.h:1507
List * refupperindexpr
Definition: primnodes.h:404
int location
Definition: primnodes.h:504
List * reflowerindexpr
Definition: primnodes.h:406
struct BoolExpr BoolExpr
List * aggorder
Definition: primnodes.h:303
Expr * arg
Definition: primnodes.h:1211
AttrNumber resno
Definition: primnodes.h:1377
Bitmapset * notnulls
Definition: primnodes.h:93
Index agglevelsup
Definition: primnodes.h:310
char * name
Definition: primnodes.h:480
Expr xpr
Definition: primnodes.h:192
char * cursor_name
Definition: primnodes.h:1286
List * aggdirectargs
Definition: primnodes.h:301
Oid resulttype
Definition: primnodes.h:775
Oid winfnoid
Definition: primnodes.h:356
Expr * arg
Definition: primnodes.h:815
List * elements
Definition: primnodes.h:960
struct BooleanTest BooleanTest
Expr * elemexpr
Definition: primnodes.h:840
PartitionPruneStep step
Definition: primnodes.h:1555
struct TargetEntry TargetEntry
Expr xpr
Definition: primnodes.h:956
int32 reftypmod
Definition: primnodes.h:402
struct MinMaxExpr MinMaxExpr
Oid opcollid
Definition: primnodes.h:501
struct InferenceElem InferenceElem
SQLValueFunctionOp
Definition: primnodes.h:1090
List * options
Definition: primnodes.h:112
List * newvals
Definition: primnodes.h:773
bool inh
Definition: primnodes.h:70
List * cols
Definition: primnodes.h:345
SubLinkType
Definition: primnodes.h:619
OnConflictAction action
Definition: primnodes.h:1495
bool isNatural
Definition: primnodes.h:1458
struct CurrentOfExpr CurrentOfExpr
List * usingClause
Definition: primnodes.h:1461
Expr xpr
Definition: primnodes.h:683
Index varno
Definition: primnodes.h:167
int ordinalitycol
Definition: primnodes.h:94
XmlExprOp op
Definition: primnodes.h:1150
List * args
Definition: primnodes.h:914
Oid refelemtype
Definition: primnodes.h:401
struct IntoClause IntoClause
CoercionForm coerceformat
Definition: primnodes.h:844
int location
Definition: primnodes.h:204
Node * quals
Definition: primnodes.h:1462
int location
Definition: primnodes.h:962
BoolTestType booltesttype
Definition: primnodes.h:1212
Index agglevelsup
Definition: primnodes.h:346
uintptr_t Datum
Definition: postgres.h:365
CoercionForm convertformat
Definition: primnodes.h:867
struct CaseTestExpr CaseTestExpr
Oid resultcollid
Definition: primnodes.h:818
Oid opfuncid
Definition: primnodes.h:498
Oid resulttype
Definition: primnodes.h:796
Node * testexpr
Definition: primnodes.h:687
unsigned int Index
Definition: c.h:442
List * coltypes
Definition: primnodes.h:88
NullTestType nulltesttype
Definition: primnodes.h:1189
int32 typmod
Definition: primnodes.h:1157
struct SQLValueFunction SQLValueFunction
Cost per_call_cost
Definition: primnodes.h:714
Oid resultcollid
Definition: primnodes.h:798
Oid aggfnoid
Definition: primnodes.h:295
List * colexprs
Definition: primnodes.h:91
List * named_args
Definition: primnodes.h:1152
int32 firstColTypmod
Definition: primnodes.h:695
struct ArrayExpr ArrayExpr
RowCompareType
Definition: primnodes.h:1025
List * args
Definition: primnodes.h:1154
struct ArrayCoerceExpr ArrayCoerceExpr
int32 paramtypmod
Definition: primnodes.h:248
char * plan_name
Definition: primnodes.h:692
int location
Definition: primnodes.h:820
Node * rarg
Definition: primnodes.h:1460
Alias * alias
Definition: primnodes.h:1463
Expr * arg
Definition: primnodes.h:479
struct NullTest NullTest
int location
Definition: primnodes.h:365
Oid inputcollid
Definition: primnodes.h:457
JoinType jointype
Definition: primnodes.h:1457
char * aliasname
Definition: primnodes.h:43
NodeTag type
Definition: primnodes.h:1427
NodeTag type
Definition: primnodes.h:1456
List * setParam
Definition: primnodes.h:708
List * ns_uris
Definition: primnodes.h:83
Expr * aggfilter
Definition: primnodes.h:361
Bitmapset * nullkeys
Definition: primnodes.h:1560
struct ScalarArrayOpExpr ScalarArrayOpExpr
Expr * expr
Definition: primnodes.h:1376
AggSplit aggsplit
Definition: primnodes.h:311
XmlOptionType xmloption
Definition: primnodes.h:1155
int paramid
Definition: primnodes.h:246
XmlOptionType
Definition: primnodes.h:1141
Oid array_collid
Definition: primnodes.h:958
bool unknownEqFalse
Definition: primnodes.h:701
int location
Definition: primnodes.h:1191
struct PartitionPruneStepOp PartitionPruneStepOp
AggSplit
Definition: nodes.h:765
struct GroupingFunc GroupingFunc
Oid row_typeid
Definition: primnodes.h:992
struct RowCompareExpr RowCompareExpr
Oid refcollid
Definition: primnodes.h:403
Oid inputcollid
Definition: primnodes.h:1073
Expr * arg
Definition: primnodes.h:881
Expr xpr
Definition: primnodes.h:562
Expr * aggfilter
Definition: primnodes.h:305
StrategyNumber opstrategy
Definition: primnodes.h:1557
int location
Definition: primnodes.h:916
List * parParam
Definition: primnodes.h:710
Oid inputcollid
Definition: primnodes.h:502
struct OnConflictExpr OnConflictExpr
Oid inputcollid
Definition: primnodes.h:359
List * args
Definition: primnodes.h:564
Expr xpr
Definition: primnodes.h:294
bool parallel_safe
Definition: primnodes.h:704
struct Param Param
NodeTag type
Definition: primnodes.h:108
int32 consttypmod
Definition: primnodes.h:194
Oid element_typeid
Definition: primnodes.h:959
char relpersistence
Definition: primnodes.h:72
Oid wintype
Definition: primnodes.h:357
CoercionForm coerceformat
Definition: primnodes.h:819
AttrNumber varoattno
Definition: primnodes.h:178
Oid refarraytype
Definition: primnodes.h:400
struct SubLink SubLink
Node * arbiterWhere
Definition: primnodes.h:1500
Expr xpr
Definition: primnodes.h:924
AttrNumber resorigcol
Definition: primnodes.h:1382
Oid aggcollid
Definition: primnodes.h:297
Expr xpr
Definition: primnodes.h:449
RangeVar * rel
Definition: primnodes.h:110
struct Aggref Aggref
List * fieldnums
Definition: primnodes.h:774
bool winagg
Definition: primnodes.h:364
Oid coalescetype
Definition: primnodes.h:1053
Expr xpr
Definition: primnodes.h:771
Oid aggtranstype
Definition: primnodes.h:299
List * onConflictSet
Definition: primnodes.h:1504
Oid varcollid
Definition: primnodes.h:173
Index ressortgroupref
Definition: primnodes.h:1379
Oid aggtype
Definition: primnodes.h:296
Alias * alias
Definition: primnodes.h:73
OpExpr DistinctExpr
Definition: primnodes.h:517
NodeTag type
Definition: primnodes.h:135
bool useHashTable
Definition: primnodes.h:699
bool argisrow
Definition: primnodes.h:1190
MinMaxOp op
Definition: primnodes.h:1074
Oid minmaxcollid
Definition: primnodes.h:1072
Oid firstColCollation
Definition: primnodes.h:696
struct SetToDefault SetToDefault
char aggkind
Definition: primnodes.h:309
Cost startup_cost
Definition: primnodes.h:713
int32 resulttypmod
Definition: primnodes.h:797
Expr * arg
Definition: primnodes.h:913
int location
Definition: primnodes.h:459
Oid opno
Definition: primnodes.h:497
struct CoalesceExpr CoalesceExpr
int32 resulttypmod
Definition: primnodes.h:842
Expr * result
Definition: primnodes.h:926
PartitionPruneStep step
Definition: primnodes.h:1578
List * colNames
Definition: primnodes.h:111
List * args
Definition: primnodes.h:503
List * inputcollids
Definition: primnodes.h:1042
int location
Definition: primnodes.h:95
CoercionForm relabelformat
Definition: primnodes.h:799
Expr * defresult
Definition: primnodes.h:915
Expr * expr
Definition: primnodes.h:925
int location
Definition: primnodes.h:883
CoercionForm row_format
Definition: primnodes.h:1006
struct PartitionPruneStepCombine PartitionPruneStepCombine
CoercionForm
Definition: primnodes.h:437
Node * onConflictWhere
Definition: primnodes.h:1505
int rtindex
Definition: primnodes.h:1464
Definition: pg_list.h:45
struct PartitionPruneInfo PartitionPruneInfo
OnConflictAction
Definition: nodes.h:807
int16 AttrNumber
Definition: attnum.h:21
Oid paramtype
Definition: primnodes.h:247
int location
Definition: primnodes.h:800
char * catalogname
Definition: primnodes.h:67
bool constisnull
Definition: primnodes.h:198
Oid coalescecollid
Definition: primnodes.h:1054
bool funcvariadic
Definition: primnodes.h:453
double Cost
Definition: nodes.h:648
struct CaseExpr CaseExpr
Expr * refexpr
Definition: primnodes.h:409
bool opretset
Definition: primnodes.h:500
struct NamedArgExpr NamedArgExpr
int32 resulttypmod
Definition: primnodes.h:747
bool winstar
Definition: primnodes.h:363
AttrNumber fieldnum
Definition: primnodes.h:744
BoolExprType
Definition: primnodes.h:555
int32 vartypmod
Definition: primnodes.h:172
List * args
Definition: primnodes.h:711