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