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-2024, 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 typedef enum OverridingKind
26 {
31 
32 
33 /* ----------------------------------------------------------------
34  * node definitions
35  * ----------------------------------------------------------------
36  */
37 
38 /*
39  * Alias -
40  * specifies an alias for a range variable; the alias might also
41  * specify renaming of columns within the table.
42  *
43  * Note: colnames is a list of String nodes. In Alias structs
44  * associated with RTEs, there may be entries corresponding to dropped
45  * columns; these are normally empty strings (""). See parsenodes.h for info.
46  */
47 typedef struct Alias
48 {
50  char *aliasname; /* aliased rel name (never qualified) */
51  List *colnames; /* optional list of column aliases */
53 
54 /* What to do at commit time for temporary relations */
55 typedef enum OnCommitAction
56 {
57  ONCOMMIT_NOOP, /* No ON COMMIT clause (do nothing) */
58  ONCOMMIT_PRESERVE_ROWS, /* ON COMMIT PRESERVE ROWS (do nothing) */
59  ONCOMMIT_DELETE_ROWS, /* ON COMMIT DELETE ROWS */
60  ONCOMMIT_DROP, /* ON COMMIT DROP */
62 
63 /*
64  * RangeVar - range variable, used in FROM clauses
65  *
66  * Also used to represent table names in utility statements; there, the alias
67  * field is not used, and inh tells whether to apply the operation
68  * recursively to child tables. In some contexts it is also useful to carry
69  * a TEMP table indication here.
70  */
71 typedef struct RangeVar
72 {
74 
75  /* the catalog (database) name, or NULL */
76  char *catalogname;
77 
78  /* the schema name, or NULL */
79  char *schemaname;
80 
81  /* the relation/sequence name */
82  char *relname;
83 
84  /* expand rel by inheritance? recursively act on children? */
85  bool inh;
86 
87  /* see RELPERSISTENCE_* in pg_class.h */
89 
90  /* table alias & optional column aliases */
92 
93  /* token location, or -1 if unknown */
96 
97 typedef enum TableFuncType
98 {
102 
103 /*
104  * TableFunc - node for a table function, such as XMLTABLE and JSON_TABLE.
105  *
106  * Entries in the ns_names list are either String nodes containing
107  * literal namespace names, or NULL pointers to represent DEFAULT.
108  */
109 typedef struct TableFunc
110 {
112  /* XMLTABLE or JSON_TABLE */
114  /* list of namespace URI expressions */
115  List *ns_uris pg_node_attr(query_jumble_ignore);
116  /* list of namespace names or NULL */
117  List *ns_names pg_node_attr(query_jumble_ignore);
118  /* input document expression */
120  /* row filter expression */
122  /* column names (list of String) */
123  List *colnames pg_node_attr(query_jumble_ignore);
124  /* OID list of column type OIDs */
125  List *coltypes pg_node_attr(query_jumble_ignore);
126  /* integer list of column typmods */
127  List *coltypmods pg_node_attr(query_jumble_ignore);
128  /* OID list of column collation OIDs */
129  List *colcollations pg_node_attr(query_jumble_ignore);
130  /* list of column filter expressions */
132  /* list of column default expressions */
133  List *coldefexprs pg_node_attr(query_jumble_ignore);
134  /* JSON_TABLE: list of column value expressions */
135  List *colvalexprs pg_node_attr(query_jumble_ignore);
136  /* JSON_TABLE: list of PASSING argument expressions */
137  List *passingvalexprs pg_node_attr(query_jumble_ignore);
138  /* nullability flag for each output column */
139  Bitmapset *notnulls pg_node_attr(query_jumble_ignore);
140  /* JSON_TABLE plan */
141  Node *plan pg_node_attr(query_jumble_ignore);
142  /* counts from 0; -1 if none specified */
143  int ordinalitycol pg_node_attr(query_jumble_ignore);
144  /* token location, or -1 if unknown */
147 
148 /*
149  * IntoClause - target information for SELECT INTO, CREATE TABLE AS, and
150  * CREATE MATERIALIZED VIEW
151  *
152  * For CREATE MATERIALIZED VIEW, viewQuery is the parsed-but-not-rewritten
153  * SELECT Query for the view; otherwise it's NULL. This is irrelevant in
154  * the query jumbling as CreateTableAsStmt already includes a reference to
155  * its own Query, so ignore it. (Although it's actually Query*, we declare
156  * it as Node* to avoid a forward reference.)
157  */
158 typedef struct IntoClause
159 {
161 
162  RangeVar *rel; /* target relation name */
163  List *colNames; /* column names to assign, or NIL */
164  char *accessMethod; /* table access method */
165  List *options; /* options from WITH clause */
166  OnCommitAction onCommit; /* what do we do at COMMIT? */
167  char *tableSpaceName; /* table space to use, or NULL */
168  /* materialized view's SELECT query */
169  Node *viewQuery pg_node_attr(query_jumble_ignore);
170  bool skipData; /* true for WITH NO DATA */
172 
173 
174 /* ----------------------------------------------------------------
175  * node types for executable expressions
176  * ----------------------------------------------------------------
177  */
178 
179 /*
180  * Expr - generic superclass for executable-expression nodes
181  *
182  * All node types that are used in executable expression trees should derive
183  * from Expr (that is, have Expr as their first field). Since Expr only
184  * contains NodeTag, this is a formality, but it is an easy form of
185  * documentation. See also the ExprState node types in execnodes.h.
186  */
187 typedef struct Expr
188 {
189  pg_node_attr(abstract)
190 
191  NodeTag type;
193 
194 /*
195  * Var - expression node representing a variable (ie, a table column)
196  *
197  * In the parser and planner, varno and varattno identify the semantic
198  * referent, which is a base-relation column unless the reference is to a join
199  * USING column that isn't semantically equivalent to either join input column
200  * (because it is a FULL join or the input column requires a type coercion).
201  * In those cases varno and varattno refer to the JOIN RTE. (Early in the
202  * planner, we replace such join references by the implied expression; but up
203  * till then we want join reference Vars to keep their original identity for
204  * query-printing purposes.)
205  *
206  * At the end of planning, Var nodes appearing in upper-level plan nodes are
207  * reassigned to point to the outputs of their subplans; for example, in a
208  * join node varno becomes INNER_VAR or OUTER_VAR and varattno becomes the
209  * index of the proper element of that subplan's target list. Similarly,
210  * INDEX_VAR is used to identify Vars that reference an index column rather
211  * than a heap column. (In ForeignScan and CustomScan plan nodes, INDEX_VAR
212  * is abused to signify references to columns of a custom scan tuple type.)
213  *
214  * ROWID_VAR is used in the planner to identify nonce variables that carry
215  * row identity information during UPDATE/DELETE/MERGE. This value should
216  * never be seen outside the planner.
217  *
218  * varnullingrels is the set of RT indexes of outer joins that can force
219  * the Var's value to null (at the point where it appears in the query).
220  * See optimizer/README for discussion of that.
221  *
222  * varlevelsup is greater than zero in Vars that represent outer references.
223  * Note that it affects the meaning of all of varno, varnullingrels, and
224  * varnosyn, all of which refer to the range table of that query level.
225  *
226  * In the parser, varnosyn and varattnosyn are either identical to
227  * varno/varattno, or they specify the column's position in an aliased JOIN
228  * RTE that hides the semantic referent RTE's refname. This is a syntactic
229  * identifier as opposed to the semantic identifier; it tells ruleutils.c
230  * how to print the Var properly. varnosyn/varattnosyn retain their values
231  * throughout planning and execution, so they are particularly helpful to
232  * identify Vars when debugging. Note, however, that a Var that is generated
233  * in the planner and doesn't correspond to any simple relation column may
234  * have varnosyn = varattnosyn = 0.
235  */
236 #define INNER_VAR (-1) /* reference to inner subplan */
237 #define OUTER_VAR (-2) /* reference to outer subplan */
238 #define INDEX_VAR (-3) /* reference to index column */
239 #define ROWID_VAR (-4) /* row identity column during planning */
240 
241 #define IS_SPECIAL_VARNO(varno) ((int) (varno) < 0)
242 
243 /* Symbols for the indexes of the special RTE entries in rules */
244 #define PRS2_OLD_VARNO 1
245 #define PRS2_NEW_VARNO 2
246 
247 typedef struct Var
248 {
250 
251  /*
252  * index of this var's relation in the range table, or
253  * INNER_VAR/OUTER_VAR/etc
254  */
255  int varno;
256 
257  /*
258  * attribute number of this var, or zero for all attrs ("whole-row Var")
259  */
261 
262  /* pg_type OID for the type of this var */
263  Oid vartype pg_node_attr(query_jumble_ignore);
264  /* pg_attribute typmod value */
265  int32 vartypmod pg_node_attr(query_jumble_ignore);
266  /* OID of collation, or InvalidOid if none */
267  Oid varcollid pg_node_attr(query_jumble_ignore);
268 
269  /*
270  * RT indexes of outer joins that can replace the Var's value with null.
271  * We can omit varnullingrels in the query jumble, because it's fully
272  * determined by varno/varlevelsup plus the Var's query location.
273  */
274  Bitmapset *varnullingrels pg_node_attr(query_jumble_ignore);
275 
276  /*
277  * for subquery variables referencing outer relations; 0 in a normal var,
278  * >0 means N levels up
279  */
281 
282  /*
283  * varnosyn/varattnosyn are ignored for equality, because Vars with
284  * different syntactic identifiers are semantically the same as long as
285  * their varno/varattno match.
286  */
287  /* syntactic relation index (0 if unknown) */
288  Index varnosyn pg_node_attr(equal_ignore, query_jumble_ignore);
289  /* syntactic attribute number */
290  AttrNumber varattnosyn pg_node_attr(equal_ignore, query_jumble_ignore);
291 
292  /* token location, or -1 if unknown */
294 } Var;
295 
296 /*
297  * Const
298  *
299  * Note: for varlena data types, we make a rule that a Const node's value
300  * must be in non-extended form (4-byte header, no compression or external
301  * references). This ensures that the Const node is self-contained and makes
302  * it more likely that equal() will see logically identical values as equal.
303  *
304  * Only the constant type OID is relevant for the query jumbling.
305  */
306 typedef struct Const
307 {
308  pg_node_attr(custom_copy_equal, custom_read_write)
309 
310  Expr xpr;
311  /* pg_type OID of the constant's datatype */
313  /* typmod value, if any */
314  int32 consttypmod pg_node_attr(query_jumble_ignore);
315  /* OID of collation, or InvalidOid if none */
316  Oid constcollid pg_node_attr(query_jumble_ignore);
317  /* typlen of the constant's datatype */
318  int constlen pg_node_attr(query_jumble_ignore);
319  /* the constant's value */
320  Datum constvalue pg_node_attr(query_jumble_ignore);
321  /* whether the constant is null (if true, constvalue is undefined) */
322  bool constisnull pg_node_attr(query_jumble_ignore);
323 
324  /*
325  * Whether this datatype is passed by value. If true, then all the
326  * information is stored in the Datum. If false, then the Datum contains
327  * a pointer to the information.
328  */
329  bool constbyval pg_node_attr(query_jumble_ignore);
330 
331  /*
332  * token location, or -1 if unknown. All constants are tracked as
333  * locations in query jumbling, to be marked as parameters.
334  */
335  ParseLoc location pg_node_attr(query_jumble_location);
337 
338 /*
339  * Param
340  *
341  * paramkind specifies the kind of parameter. The possible values
342  * for this field are:
343  *
344  * PARAM_EXTERN: The parameter value is supplied from outside the plan.
345  * Such parameters are numbered from 1 to n.
346  *
347  * PARAM_EXEC: The parameter is an internal executor parameter, used
348  * for passing values into and out of sub-queries or from
349  * nestloop joins to their inner scans.
350  * For historical reasons, such parameters are numbered from 0.
351  * These numbers are independent of PARAM_EXTERN numbers.
352  *
353  * PARAM_SUBLINK: The parameter represents an output column of a SubLink
354  * node's sub-select. The column number is contained in the
355  * `paramid' field. (This type of Param is converted to
356  * PARAM_EXEC during planning.)
357  *
358  * PARAM_MULTIEXPR: Like PARAM_SUBLINK, the parameter represents an
359  * output column of a SubLink node's sub-select, but here, the
360  * SubLink is always a MULTIEXPR SubLink. The high-order 16 bits
361  * of the `paramid' field contain the SubLink's subLinkId, and
362  * the low-order 16 bits contain the column number. (This type
363  * of Param is also converted to PARAM_EXEC during planning.)
364  */
365 typedef enum ParamKind
366 {
372 
373 typedef struct Param
374 {
376  ParamKind paramkind; /* kind of parameter. See above */
377  int paramid; /* numeric ID for parameter */
378  Oid paramtype; /* pg_type OID of parameter's datatype */
379  /* typmod value, if known */
380  int32 paramtypmod pg_node_attr(query_jumble_ignore);
381  /* OID of collation, or InvalidOid if none */
382  Oid paramcollid pg_node_attr(query_jumble_ignore);
383  /* token location, or -1 if unknown */
386 
387 /*
388  * Aggref
389  *
390  * The aggregate's args list is a targetlist, ie, a list of TargetEntry nodes.
391  *
392  * For a normal (non-ordered-set) aggregate, the non-resjunk TargetEntries
393  * represent the aggregate's regular arguments (if any) and resjunk TLEs can
394  * be added at the end to represent ORDER BY expressions that are not also
395  * arguments. As in a top-level Query, the TLEs can be marked with
396  * ressortgroupref indexes to let them be referenced by SortGroupClause
397  * entries in the aggorder and/or aggdistinct lists. This represents ORDER BY
398  * and DISTINCT operations to be applied to the aggregate input rows before
399  * they are passed to the transition function. The grammar only allows a
400  * simple "DISTINCT" specifier for the arguments, but we use the full
401  * query-level representation to allow more code sharing.
402  *
403  * For an ordered-set aggregate, the args list represents the WITHIN GROUP
404  * (aggregated) arguments, all of which will be listed in the aggorder list.
405  * DISTINCT is not supported in this case, so aggdistinct will be NIL.
406  * The direct arguments appear in aggdirectargs (as a list of plain
407  * expressions, not TargetEntry nodes).
408  *
409  * aggtranstype is the data type of the state transition values for this
410  * aggregate (resolved to an actual type, if agg's transtype is polymorphic).
411  * This is determined during planning and is InvalidOid before that.
412  *
413  * aggargtypes is an OID list of the data types of the direct and regular
414  * arguments. Normally it's redundant with the aggdirectargs and args lists,
415  * but in a combining aggregate, it's not because the args list has been
416  * replaced with a single argument representing the partial-aggregate
417  * transition values.
418  *
419  * aggpresorted is set by the query planner for ORDER BY and DISTINCT
420  * aggregates where the chosen plan provides presorted input for this
421  * aggregate during execution.
422  *
423  * aggsplit indicates the expected partial-aggregation mode for the Aggref's
424  * parent plan node. It's always set to AGGSPLIT_SIMPLE in the parser, but
425  * the planner might change it to something else. We use this mainly as
426  * a crosscheck that the Aggrefs match the plan; but note that when aggsplit
427  * indicates a non-final mode, aggtype reflects the transition data type
428  * not the SQL-level output type of the aggregate.
429  *
430  * aggno and aggtransno are -1 in the parse stage, and are set in planning.
431  * Aggregates with the same 'aggno' represent the same aggregate expression,
432  * and can share the result. Aggregates with same 'transno' but different
433  * 'aggno' can share the same transition state, only the final function needs
434  * to be called separately.
435  *
436  * Information related to collations, transition types and internal states
437  * are irrelevant for the query jumbling.
438  */
439 typedef struct Aggref
440 {
442 
443  /* pg_proc Oid of the aggregate */
445 
446  /* type Oid of result of the aggregate */
447  Oid aggtype pg_node_attr(query_jumble_ignore);
448 
449  /* OID of collation of result */
450  Oid aggcollid pg_node_attr(query_jumble_ignore);
451 
452  /* OID of collation that function should use */
453  Oid inputcollid pg_node_attr(query_jumble_ignore);
454 
455  /*
456  * type Oid of aggregate's transition value; ignored for equal since it
457  * might not be set yet
458  */
459  Oid aggtranstype pg_node_attr(equal_ignore, query_jumble_ignore);
460 
461  /* type Oids of direct and aggregated args */
462  List *aggargtypes pg_node_attr(query_jumble_ignore);
463 
464  /* direct arguments, if an ordered-set agg */
466 
467  /* aggregated arguments and sort expressions */
469 
470  /* ORDER BY (list of SortGroupClause) */
472 
473  /* DISTINCT (list of SortGroupClause) */
475 
476  /* FILTER expression, if any */
478 
479  /* true if argument list was really '*' */
480  bool aggstar pg_node_attr(query_jumble_ignore);
481 
482  /*
483  * true if variadic arguments have been combined into an array last
484  * argument
485  */
486  bool aggvariadic pg_node_attr(query_jumble_ignore);
487 
488  /* aggregate kind (see pg_aggregate.h) */
489  char aggkind pg_node_attr(query_jumble_ignore);
490 
491  /* aggregate input already sorted */
492  bool aggpresorted pg_node_attr(equal_ignore, query_jumble_ignore);
493 
494  /* > 0 if agg belongs to outer query */
495  Index agglevelsup pg_node_attr(query_jumble_ignore);
496 
497  /* expected agg-splitting mode of parent Agg */
498  AggSplit aggsplit pg_node_attr(query_jumble_ignore);
499 
500  /* unique ID within the Agg node */
501  int aggno pg_node_attr(query_jumble_ignore);
502 
503  /* unique ID of transition state in the Agg */
504  int aggtransno pg_node_attr(query_jumble_ignore);
505 
506  /* token location, or -1 if unknown */
509 
510 /*
511  * GroupingFunc
512  *
513  * A GroupingFunc is a GROUPING(...) expression, which behaves in many ways
514  * like an aggregate function (e.g. it "belongs" to a specific query level,
515  * which might not be the one immediately containing it), but also differs in
516  * an important respect: it never evaluates its arguments, they merely
517  * designate expressions from the GROUP BY clause of the query level to which
518  * it belongs.
519  *
520  * The spec defines the evaluation of GROUPING() purely by syntactic
521  * replacement, but we make it a real expression for optimization purposes so
522  * that one Agg node can handle multiple grouping sets at once. Evaluating the
523  * result only needs the column positions to check against the grouping set
524  * being projected. However, for EXPLAIN to produce meaningful output, we have
525  * to keep the original expressions around, since expression deparse does not
526  * give us any feasible way to get at the GROUP BY clause.
527  *
528  * Also, we treat two GroupingFunc nodes as equal if they have equal arguments
529  * lists and agglevelsup, without comparing the refs and cols annotations.
530  *
531  * In raw parse output we have only the args list; parse analysis fills in the
532  * refs list, and the planner fills in the cols list.
533  *
534  * All the fields used as information for an internal state are irrelevant
535  * for the query jumbling.
536  */
537 typedef struct GroupingFunc
538 {
540 
541  /* arguments, not evaluated but kept for benefit of EXPLAIN etc. */
542  List *args pg_node_attr(query_jumble_ignore);
543 
544  /* ressortgrouprefs of arguments */
545  List *refs pg_node_attr(equal_ignore);
546 
547  /* actual column positions set by planner */
548  List *cols pg_node_attr(equal_ignore, query_jumble_ignore);
549 
550  /* same as Aggref.agglevelsup */
552 
553  /* token location */
556 
557 /*
558  * WindowFunc
559  *
560  * Collation information is irrelevant for the query jumbling, as is the
561  * internal state information of the node like "winstar" and "winagg".
562  */
563 typedef struct WindowFunc
564 {
566  /* pg_proc Oid of the function */
568  /* type Oid of result of the window function */
569  Oid wintype pg_node_attr(query_jumble_ignore);
570  /* OID of collation of result */
571  Oid wincollid pg_node_attr(query_jumble_ignore);
572  /* OID of collation that function should use */
573  Oid inputcollid pg_node_attr(query_jumble_ignore);
574  /* arguments to the window function */
576  /* FILTER expression, if any */
578  /* index of associated WindowClause */
580  /* true if argument list was really '*' */
581  bool winstar pg_node_attr(query_jumble_ignore);
582  /* is function a simple aggregate? */
583  bool winagg pg_node_attr(query_jumble_ignore);
584  /* token location, or -1 if unknown */
587 
588 /*
589  * MergeSupportFunc
590  *
591  * A MergeSupportFunc is a merge support function expression that can only
592  * appear in the RETURNING list of a MERGE command. It returns information
593  * about the currently executing merge action.
594  *
595  * Currently, the only supported function is MERGE_ACTION(), which returns the
596  * command executed ("INSERT", "UPDATE", or "DELETE").
597  */
598 typedef struct MergeSupportFunc
599 {
601  /* type Oid of result */
603  /* OID of collation, or InvalidOid if none */
605  /* token location, or -1 if unknown */
608 
609 /*
610  * SubscriptingRef: describes a subscripting operation over a container
611  * (array, etc).
612  *
613  * A SubscriptingRef can describe fetching a single element from a container,
614  * fetching a part of a container (e.g. an array slice), storing a single
615  * element into a container, or storing a slice. The "store" cases work with
616  * an initial container value and a source value that is inserted into the
617  * appropriate part of the container; the result of the operation is an
618  * entire new modified container value.
619  *
620  * If reflowerindexpr = NIL, then we are fetching or storing a single container
621  * element at the subscripts given by refupperindexpr. Otherwise we are
622  * fetching or storing a container slice, that is a rectangular subcontainer
623  * with lower and upper bounds given by the index expressions.
624  * reflowerindexpr must be the same length as refupperindexpr when it
625  * is not NIL.
626  *
627  * In the slice case, individual expressions in the subscript lists can be
628  * NULL, meaning "substitute the array's current lower or upper bound".
629  * (Non-array containers may or may not support this.)
630  *
631  * refcontainertype is the actual container type that determines the
632  * subscripting semantics. (This will generally be either the exposed type of
633  * refexpr, or the base type if that is a domain.) refelemtype is the type of
634  * the container's elements; this is saved for the use of the subscripting
635  * functions, but is not used by the core code. refrestype, reftypmod, and
636  * refcollid describe the type of the SubscriptingRef's result. In a store
637  * expression, refrestype will always match refcontainertype; in a fetch,
638  * it could be refelemtype for an element fetch, or refcontainertype for a
639  * slice fetch, or possibly something else as determined by type-specific
640  * subscripting logic. Likewise, reftypmod and refcollid will match the
641  * container's properties in a store, but could be different in a fetch.
642  *
643  * Any internal state data is ignored for the query jumbling.
644  *
645  * Note: for the cases where a container is returned, if refexpr yields a R/W
646  * expanded container, then the implementation is allowed to modify that
647  * object in-place and return the same object.
648  */
649 typedef struct SubscriptingRef
650 {
652  /* type of the container proper */
653  Oid refcontainertype pg_node_attr(query_jumble_ignore);
654  /* the container type's pg_type.typelem */
655  Oid refelemtype pg_node_attr(query_jumble_ignore);
656  /* type of the SubscriptingRef's result */
657  Oid refrestype pg_node_attr(query_jumble_ignore);
658  /* typmod of the result */
659  int32 reftypmod pg_node_attr(query_jumble_ignore);
660  /* collation of result, or InvalidOid if none */
661  Oid refcollid pg_node_attr(query_jumble_ignore);
662  /* expressions that evaluate to upper container indexes */
664 
665  /*
666  * expressions that evaluate to lower container indexes, or NIL for single
667  * container element.
668  */
670  /* the expression that evaluates to a container value */
672  /* expression for the source value, or NULL if fetch */
675 
676 /*
677  * CoercionContext - distinguishes the allowed set of type casts
678  *
679  * NB: ordering of the alternatives is significant; later (larger) values
680  * allow more casts than earlier ones.
681  */
682 typedef enum CoercionContext
683 {
684  COERCION_IMPLICIT, /* coercion in context of expression */
685  COERCION_ASSIGNMENT, /* coercion in context of assignment */
686  COERCION_PLPGSQL, /* if no assignment cast, use CoerceViaIO */
687  COERCION_EXPLICIT, /* explicit cast operation */
689 
690 /*
691  * CoercionForm - how to display a FuncExpr or related node
692  *
693  * "Coercion" is a bit of a misnomer, since this value records other
694  * special syntaxes besides casts, but for now we'll keep this naming.
695  *
696  * NB: equal() ignores CoercionForm fields, therefore this *must* not carry
697  * any semantically significant information. We need that behavior so that
698  * the planner will consider equivalent implicit and explicit casts to be
699  * equivalent. In cases where those actually behave differently, the coercion
700  * function's arguments will be different.
701  */
702 typedef enum CoercionForm
703 {
704  COERCE_EXPLICIT_CALL, /* display as a function call */
705  COERCE_EXPLICIT_CAST, /* display as an explicit cast */
706  COERCE_IMPLICIT_CAST, /* implicit cast, so hide it */
707  COERCE_SQL_SYNTAX, /* display with SQL-mandated special syntax */
709 
710 /*
711  * FuncExpr - expression node for a function call
712  *
713  * Collation information is irrelevant for the query jumbling, only the
714  * arguments and the function OID matter.
715  */
716 typedef struct FuncExpr
717 {
719  /* PG_PROC OID of the function */
721  /* PG_TYPE OID of result value */
722  Oid funcresulttype pg_node_attr(query_jumble_ignore);
723  /* true if function returns set */
724  bool funcretset pg_node_attr(query_jumble_ignore);
725 
726  /*
727  * true if variadic arguments have been combined into an array last
728  * argument
729  */
730  bool funcvariadic pg_node_attr(query_jumble_ignore);
731  /* how to display this function call */
732  CoercionForm funcformat pg_node_attr(query_jumble_ignore);
733  /* OID of collation of result */
734  Oid funccollid pg_node_attr(query_jumble_ignore);
735  /* OID of collation that function should use */
736  Oid inputcollid pg_node_attr(query_jumble_ignore);
737  /* arguments to the function */
739  /* token location, or -1 if unknown */
742 
743 /*
744  * NamedArgExpr - a named argument of a function
745  *
746  * This node type can only appear in the args list of a FuncCall or FuncExpr
747  * node. We support pure positional call notation (no named arguments),
748  * named notation (all arguments are named), and mixed notation (unnamed
749  * arguments followed by named ones).
750  *
751  * Parse analysis sets argnumber to the positional index of the argument,
752  * but doesn't rearrange the argument list.
753  *
754  * The planner will convert argument lists to pure positional notation
755  * during expression preprocessing, so execution never sees a NamedArgExpr.
756  */
757 typedef struct NamedArgExpr
758 {
760  /* the argument expression */
762  /* the name */
763  char *name pg_node_attr(query_jumble_ignore);
764  /* argument's number in positional notation */
766  /* argument name location, or -1 if unknown */
769 
770 /*
771  * OpExpr - expression node for an operator invocation
772  *
773  * Semantically, this is essentially the same as a function call.
774  *
775  * Note that opfuncid is not necessarily filled in immediately on creation
776  * of the node. The planner makes sure it is valid before passing the node
777  * tree to the executor, but during parsing/planning opfuncid can be 0.
778  * Therefore, equal() will accept a zero value as being equal to other values.
779  *
780  * Internal state information and collation data is irrelevant for the query
781  * jumbling.
782  */
783 typedef struct OpExpr
784 {
786 
787  /* PG_OPERATOR OID of the operator */
789 
790  /* PG_PROC OID of underlying function */
791  Oid opfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore);
792 
793  /* PG_TYPE OID of result value */
794  Oid opresulttype pg_node_attr(query_jumble_ignore);
795 
796  /* true if operator returns set */
797  bool opretset pg_node_attr(query_jumble_ignore);
798 
799  /* OID of collation of result */
800  Oid opcollid pg_node_attr(query_jumble_ignore);
801 
802  /* OID of collation that operator should use */
803  Oid inputcollid pg_node_attr(query_jumble_ignore);
804 
805  /* arguments to the operator (1 or 2) */
807 
808  /* token location, or -1 if unknown */
811 
812 /*
813  * DistinctExpr - expression node for "x IS DISTINCT FROM y"
814  *
815  * Except for the nodetag, this is represented identically to an OpExpr
816  * referencing the "=" operator for x and y.
817  * We use "=", not the more obvious "<>", because more datatypes have "="
818  * than "<>". This means the executor must invert the operator result.
819  * Note that the operator function won't be called at all if either input
820  * is NULL, since then the result can be determined directly.
821  */
823 
824 /*
825  * NullIfExpr - a NULLIF expression
826  *
827  * Like DistinctExpr, this is represented the same as an OpExpr referencing
828  * the "=" operator for x and y.
829  */
831 
832 /*
833  * ScalarArrayOpExpr - expression node for "scalar op ANY/ALL (array)"
834  *
835  * The operator must yield boolean. It is applied to the left operand
836  * and each element of the righthand array, and the results are combined
837  * with OR or AND (for ANY or ALL respectively). The node representation
838  * is almost the same as for the underlying operator, but we need a useOr
839  * flag to remember whether it's ANY or ALL, and we don't have to store
840  * the result type (or the collation) because it must be boolean.
841  *
842  * A ScalarArrayOpExpr with a valid hashfuncid is evaluated during execution
843  * by building a hash table containing the Const values from the RHS arg.
844  * This table is probed during expression evaluation. The planner will set
845  * hashfuncid to the hash function which must be used to build and probe the
846  * hash table. The executor determines if it should use hash-based checks or
847  * the more traditional means based on if the hashfuncid is set or not.
848  *
849  * When performing hashed NOT IN, the negfuncid will also be set to the
850  * equality function which the hash table must use to build and probe the hash
851  * table. opno and opfuncid will remain set to the <> operator and its
852  * corresponding function and won't be used during execution. For
853  * non-hashtable based NOT INs, negfuncid will be set to InvalidOid. See
854  * convert_saop_to_hashed_saop().
855  *
856  * Similar to OpExpr, opfuncid, hashfuncid, and negfuncid are not necessarily
857  * filled in right away, so will be ignored for equality if they are not set
858  * yet.
859  *
860  * OID entries of the internal function types are irrelevant for the query
861  * jumbling, but the operator OID and the arguments are.
862  */
863 typedef struct ScalarArrayOpExpr
864 {
866 
867  /* PG_OPERATOR OID of the operator */
869 
870  /* PG_PROC OID of comparison function */
871  Oid opfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore);
872 
873  /* PG_PROC OID of hash func or InvalidOid */
874  Oid hashfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore);
875 
876  /* PG_PROC OID of negator of opfuncid function or InvalidOid. See above */
877  Oid negfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore);
878 
879  /* true for ANY, false for ALL */
880  bool useOr;
881 
882  /* OID of collation that operator should use */
883  Oid inputcollid pg_node_attr(query_jumble_ignore);
884 
885  /* the scalar and array operands */
887 
888  /* token location, or -1 if unknown */
891 
892 /*
893  * BoolExpr - expression node for the basic Boolean operators AND, OR, NOT
894  *
895  * Notice the arguments are given as a List. For NOT, of course the list
896  * must always have exactly one element. For AND and OR, there can be two
897  * or more arguments.
898  */
899 typedef enum BoolExprType
900 {
903 
904 typedef struct BoolExpr
905 {
906  pg_node_attr(custom_read_write)
907 
908  Expr xpr;
910  List *args; /* arguments to this expression */
911  ParseLoc location; /* token location, or -1 if unknown */
913 
914 /*
915  * SubLink
916  *
917  * A SubLink represents a subselect appearing in an expression, and in some
918  * cases also the combining operator(s) just above it. The subLinkType
919  * indicates the form of the expression represented:
920  * EXISTS_SUBLINK EXISTS(SELECT ...)
921  * ALL_SUBLINK (lefthand) op ALL (SELECT ...)
922  * ANY_SUBLINK (lefthand) op ANY (SELECT ...)
923  * ROWCOMPARE_SUBLINK (lefthand) op (SELECT ...)
924  * EXPR_SUBLINK (SELECT with single targetlist item ...)
925  * MULTIEXPR_SUBLINK (SELECT with multiple targetlist items ...)
926  * ARRAY_SUBLINK ARRAY(SELECT with single targetlist item ...)
927  * CTE_SUBLINK WITH query (never actually part of an expression)
928  * For ALL, ANY, and ROWCOMPARE, the lefthand is a list of expressions of the
929  * same length as the subselect's targetlist. ROWCOMPARE will *always* have
930  * a list with more than one entry; if the subselect has just one target
931  * then the parser will create an EXPR_SUBLINK instead (and any operator
932  * above the subselect will be represented separately).
933  * ROWCOMPARE, EXPR, and MULTIEXPR require the subselect to deliver at most
934  * one row (if it returns no rows, the result is NULL).
935  * ALL, ANY, and ROWCOMPARE require the combining operators to deliver boolean
936  * results. ALL and ANY combine the per-row results using AND and OR
937  * semantics respectively.
938  * ARRAY requires just one target column, and creates an array of the target
939  * column's type using any number of rows resulting from the subselect.
940  *
941  * SubLink is classed as an Expr node, but it is not actually executable;
942  * it must be replaced in the expression tree by a SubPlan node during
943  * planning.
944  *
945  * NOTE: in the raw output of gram.y, testexpr contains just the raw form
946  * of the lefthand expression (if any), and operName is the String name of
947  * the combining operator. Also, subselect is a raw parsetree. During parse
948  * analysis, the parser transforms testexpr into a complete boolean expression
949  * that compares the lefthand value(s) to PARAM_SUBLINK nodes representing the
950  * output columns of the subselect. And subselect is transformed to a Query.
951  * This is the representation seen in saved rules and in the rewriter.
952  *
953  * In EXISTS, EXPR, MULTIEXPR, and ARRAY SubLinks, testexpr and operName
954  * are unused and are always null.
955  *
956  * subLinkId is currently used only for MULTIEXPR SubLinks, and is zero in
957  * other SubLinks. This number identifies different multiple-assignment
958  * subqueries within an UPDATE statement's SET list. It is unique only
959  * within a particular targetlist. The output column(s) of the MULTIEXPR
960  * are referenced by PARAM_MULTIEXPR Params appearing elsewhere in the tlist.
961  *
962  * The CTE_SUBLINK case never occurs in actual SubLink nodes, but it is used
963  * in SubPlans generated for WITH subqueries.
964  */
965 typedef enum SubLinkType
966 {
974  CTE_SUBLINK, /* for SubPlans only */
976 
977 
978 typedef struct SubLink
979 {
981  SubLinkType subLinkType; /* see above */
982  int subLinkId; /* ID (1..n); 0 if not MULTIEXPR */
983  Node *testexpr; /* outer-query test for ALL/ANY/ROWCOMPARE */
984  /* originally specified operator name */
985  List *operName pg_node_attr(query_jumble_ignore);
986  /* subselect as Query* or raw parsetree */
988  ParseLoc location; /* token location, or -1 if unknown */
990 
991 /*
992  * SubPlan - executable expression node for a subplan (sub-SELECT)
993  *
994  * The planner replaces SubLink nodes in expression trees with SubPlan
995  * nodes after it has finished planning the subquery. SubPlan references
996  * a sub-plantree stored in the subplans list of the toplevel PlannedStmt.
997  * (We avoid a direct link to make it easier to copy expression trees
998  * without causing multiple processing of the subplan.)
999  *
1000  * In an ordinary subplan, testexpr points to an executable expression
1001  * (OpExpr, an AND/OR tree of OpExprs, or RowCompareExpr) for the combining
1002  * operator(s); the left-hand arguments are the original lefthand expressions,
1003  * and the right-hand arguments are PARAM_EXEC Param nodes representing the
1004  * outputs of the sub-select. (NOTE: runtime coercion functions may be
1005  * inserted as well.) This is just the same expression tree as testexpr in
1006  * the original SubLink node, but the PARAM_SUBLINK nodes are replaced by
1007  * suitably numbered PARAM_EXEC nodes.
1008  *
1009  * If the sub-select becomes an initplan rather than a subplan, the executable
1010  * expression is part of the outer plan's expression tree (and the SubPlan
1011  * node itself is not, but rather is found in the outer plan's initPlan
1012  * list). In this case testexpr is NULL to avoid duplication.
1013  *
1014  * The planner also derives lists of the values that need to be passed into
1015  * and out of the subplan. Input values are represented as a list "args" of
1016  * expressions to be evaluated in the outer-query context (currently these
1017  * args are always just Vars, but in principle they could be any expression).
1018  * The values are assigned to the global PARAM_EXEC params indexed by parParam
1019  * (the parParam and args lists must have the same ordering). setParam is a
1020  * list of the PARAM_EXEC params that are computed by the sub-select, if it
1021  * is an initplan or MULTIEXPR plan; they are listed in order by sub-select
1022  * output column position. (parParam and setParam are integer Lists, not
1023  * Bitmapsets, because their ordering is significant.)
1024  *
1025  * Also, the planner computes startup and per-call costs for use of the
1026  * SubPlan. Note that these include the cost of the subquery proper,
1027  * evaluation of the testexpr if any, and any hashtable management overhead.
1028  */
1029 typedef struct SubPlan
1030 {
1031  pg_node_attr(no_query_jumble)
1032 
1033  Expr xpr;
1034  /* Fields copied from original SubLink: */
1035  SubLinkType subLinkType; /* see above */
1036  /* The combining operators, transformed to an executable expression: */
1037  Node *testexpr; /* OpExpr or RowCompareExpr expression tree */
1038  List *paramIds; /* IDs of Params embedded in the above */
1039  /* Identification of the Plan tree to use: */
1040  int plan_id; /* Index (from 1) in PlannedStmt.subplans */
1041  /* Identification of the SubPlan for EXPLAIN and debugging purposes: */
1042  char *plan_name; /* A name assigned during planning */
1043  /* Extra data useful for determining subplan's output type: */
1044  Oid firstColType; /* Type of first column of subplan result */
1045  int32 firstColTypmod; /* Typmod of first column of subplan result */
1046  Oid firstColCollation; /* Collation of first column of subplan
1047  * result */
1048  /* Information about execution strategy: */
1049  bool useHashTable; /* true to store subselect output in a hash
1050  * table (implies we are doing "IN") */
1051  bool unknownEqFalse; /* true if it's okay to return FALSE when the
1052  * spec result is UNKNOWN; this allows much
1053  * simpler handling of null values */
1054  bool parallel_safe; /* is the subplan parallel-safe? */
1055  /* Note: parallel_safe does not consider contents of testexpr or args */
1056  /* Information for passing params into and out of the subselect: */
1057  /* setParam and parParam are lists of integers (param IDs) */
1058  List *setParam; /* initplan and MULTIEXPR subqueries have to
1059  * set these Params for parent plan */
1060  List *parParam; /* indices of input Params from parent plan */
1061  List *args; /* exprs to pass as parParam values */
1062  /* Estimated execution costs: */
1063  Cost startup_cost; /* one-time setup cost */
1064  Cost per_call_cost; /* cost for each subplan evaluation */
1066 
1067 /*
1068  * AlternativeSubPlan - expression node for a choice among SubPlans
1069  *
1070  * This is used only transiently during planning: by the time the plan
1071  * reaches the executor, all AlternativeSubPlan nodes have been removed.
1072  *
1073  * The subplans are given as a List so that the node definition need not
1074  * change if there's ever more than two alternatives. For the moment,
1075  * though, there are always exactly two; and the first one is the fast-start
1076  * plan.
1077  */
1078 typedef struct AlternativeSubPlan
1079 {
1080  pg_node_attr(no_query_jumble)
1081 
1082  Expr xpr;
1083  List *subplans; /* SubPlan(s) with equivalent results */
1085 
1086 /* ----------------
1087  * FieldSelect
1088  *
1089  * FieldSelect represents the operation of extracting one field from a tuple
1090  * value. At runtime, the input expression is expected to yield a rowtype
1091  * Datum. The specified field number is extracted and returned as a Datum.
1092  * ----------------
1093  */
1094 
1095 typedef struct FieldSelect
1096 {
1098  Expr *arg; /* input expression */
1099  AttrNumber fieldnum; /* attribute number of field to extract */
1100  /* type of the field (result type of this node) */
1101  Oid resulttype pg_node_attr(query_jumble_ignore);
1102  /* output typmod (usually -1) */
1103  int32 resulttypmod pg_node_attr(query_jumble_ignore);
1104  /* OID of collation of the field */
1105  Oid resultcollid pg_node_attr(query_jumble_ignore);
1107 
1108 /* ----------------
1109  * FieldStore
1110  *
1111  * FieldStore represents the operation of modifying one field in a tuple
1112  * value, yielding a new tuple value (the input is not touched!). Like
1113  * the assign case of SubscriptingRef, this is used to implement UPDATE of a
1114  * portion of a column.
1115  *
1116  * resulttype is always a named composite type (not a domain). To update
1117  * a composite domain value, apply CoerceToDomain to the FieldStore.
1118  *
1119  * A single FieldStore can actually represent updates of several different
1120  * fields. The parser only generates FieldStores with single-element lists,
1121  * but the planner will collapse multiple updates of the same base column
1122  * into one FieldStore.
1123  * ----------------
1124  */
1125 
1126 typedef struct FieldStore
1127 {
1129  Expr *arg; /* input tuple value */
1130  List *newvals; /* new value(s) for field(s) */
1131  /* integer list of field attnums */
1132  List *fieldnums pg_node_attr(query_jumble_ignore);
1133  /* type of result (same as type of arg) */
1134  Oid resulttype pg_node_attr(query_jumble_ignore);
1135  /* Like RowExpr, we deliberately omit a typmod and collation here */
1137 
1138 /* ----------------
1139  * RelabelType
1140  *
1141  * RelabelType represents a "dummy" type coercion between two binary-
1142  * compatible datatypes, such as reinterpreting the result of an OID
1143  * expression as an int4. It is a no-op at runtime; we only need it
1144  * to provide a place to store the correct type to be attributed to
1145  * the expression result during type resolution. (We can't get away
1146  * with just overwriting the type field of the input expression node,
1147  * so we need a separate node to show the coercion's result type.)
1148  * ----------------
1149  */
1150 
1151 typedef struct RelabelType
1152 {
1154  Expr *arg; /* input expression */
1155  Oid resulttype; /* output type of coercion expression */
1156  /* output typmod (usually -1) */
1157  int32 resulttypmod pg_node_attr(query_jumble_ignore);
1158  /* OID of collation, or InvalidOid if none */
1159  Oid resultcollid pg_node_attr(query_jumble_ignore);
1160  /* how to display this node */
1161  CoercionForm relabelformat pg_node_attr(query_jumble_ignore);
1162  ParseLoc location; /* token location, or -1 if unknown */
1164 
1165 /* ----------------
1166  * CoerceViaIO
1167  *
1168  * CoerceViaIO represents a type coercion between two types whose textual
1169  * representations are compatible, implemented by invoking the source type's
1170  * typoutput function then the destination type's typinput function.
1171  * ----------------
1172  */
1173 
1174 typedef struct CoerceViaIO
1175 {
1177  Expr *arg; /* input expression */
1178  Oid resulttype; /* output type of coercion */
1179  /* output typmod is not stored, but is presumed -1 */
1180  /* OID of collation, or InvalidOid if none */
1181  Oid resultcollid pg_node_attr(query_jumble_ignore);
1182  /* how to display this node */
1183  CoercionForm coerceformat pg_node_attr(query_jumble_ignore);
1184  ParseLoc location; /* token location, or -1 if unknown */
1186 
1187 /* ----------------
1188  * ArrayCoerceExpr
1189  *
1190  * ArrayCoerceExpr represents a type coercion from one array type to another,
1191  * which is implemented by applying the per-element coercion expression
1192  * "elemexpr" to each element of the source array. Within elemexpr, the
1193  * source element is represented by a CaseTestExpr node. Note that even if
1194  * elemexpr is a no-op (that is, just CaseTestExpr + RelabelType), the
1195  * coercion still requires some effort: we have to fix the element type OID
1196  * stored in the array header.
1197  * ----------------
1198  */
1199 
1200 typedef struct ArrayCoerceExpr
1201 {
1203  Expr *arg; /* input expression (yields an array) */
1204  Expr *elemexpr; /* expression representing per-element work */
1205  Oid resulttype; /* output type of coercion (an array type) */
1206  /* output typmod (also element typmod) */
1207  int32 resulttypmod pg_node_attr(query_jumble_ignore);
1208  /* OID of collation, or InvalidOid if none */
1209  Oid resultcollid pg_node_attr(query_jumble_ignore);
1210  /* how to display this node */
1211  CoercionForm coerceformat pg_node_attr(query_jumble_ignore);
1212  ParseLoc location; /* token location, or -1 if unknown */
1214 
1215 /* ----------------
1216  * ConvertRowtypeExpr
1217  *
1218  * ConvertRowtypeExpr represents a type coercion from one composite type
1219  * to another, where the source type is guaranteed to contain all the columns
1220  * needed for the destination type plus possibly others; the columns need not
1221  * be in the same positions, but are matched up by name. This is primarily
1222  * used to convert a whole-row value of an inheritance child table into a
1223  * valid whole-row value of its parent table's rowtype. Both resulttype
1224  * and the exposed type of "arg" must be named composite types (not domains).
1225  * ----------------
1226  */
1227 
1228 typedef struct ConvertRowtypeExpr
1229 {
1231  Expr *arg; /* input expression */
1232  Oid resulttype; /* output type (always a composite type) */
1233  /* Like RowExpr, we deliberately omit a typmod and collation here */
1234  /* how to display this node */
1235  CoercionForm convertformat pg_node_attr(query_jumble_ignore);
1236  ParseLoc location; /* token location, or -1 if unknown */
1238 
1239 /*----------
1240  * CollateExpr - COLLATE
1241  *
1242  * The planner replaces CollateExpr with RelabelType during expression
1243  * preprocessing, so execution never sees a CollateExpr.
1244  *----------
1245  */
1246 typedef struct CollateExpr
1247 {
1249  Expr *arg; /* input expression */
1250  Oid collOid; /* collation's OID */
1251  ParseLoc location; /* token location, or -1 if unknown */
1253 
1254 /*----------
1255  * CaseExpr - a CASE expression
1256  *
1257  * We support two distinct forms of CASE expression:
1258  * CASE WHEN boolexpr THEN expr [ WHEN boolexpr THEN expr ... ]
1259  * CASE testexpr WHEN compexpr THEN expr [ WHEN compexpr THEN expr ... ]
1260  * These are distinguishable by the "arg" field being NULL in the first case
1261  * and the testexpr in the second case.
1262  *
1263  * In the raw grammar output for the second form, the condition expressions
1264  * of the WHEN clauses are just the comparison values. Parse analysis
1265  * converts these to valid boolean expressions of the form
1266  * CaseTestExpr '=' compexpr
1267  * where the CaseTestExpr node is a placeholder that emits the correct
1268  * value at runtime. This structure is used so that the testexpr need be
1269  * evaluated only once. Note that after parse analysis, the condition
1270  * expressions always yield boolean.
1271  *
1272  * Note: we can test whether a CaseExpr has been through parse analysis
1273  * yet by checking whether casetype is InvalidOid or not.
1274  *----------
1275  */
1276 typedef struct CaseExpr
1277 {
1279  /* type of expression result */
1280  Oid casetype pg_node_attr(query_jumble_ignore);
1281  /* OID of collation, or InvalidOid if none */
1282  Oid casecollid pg_node_attr(query_jumble_ignore);
1283  Expr *arg; /* implicit equality comparison argument */
1284  List *args; /* the arguments (list of WHEN clauses) */
1285  Expr *defresult; /* the default result (ELSE clause) */
1286  ParseLoc location; /* token location, or -1 if unknown */
1288 
1289 /*
1290  * CaseWhen - one arm of a CASE expression
1291  */
1292 typedef struct CaseWhen
1293 {
1295  Expr *expr; /* condition expression */
1296  Expr *result; /* substitution result */
1297  ParseLoc location; /* token location, or -1 if unknown */
1299 
1300 /*
1301  * Placeholder node for the test value to be processed by a CASE expression.
1302  * This is effectively like a Param, but can be implemented more simply
1303  * since we need only one replacement value at a time.
1304  *
1305  * We also abuse this node type for some other purposes, including:
1306  * * Placeholder for the current array element value in ArrayCoerceExpr;
1307  * see build_coercion_expression().
1308  * * Nested FieldStore/SubscriptingRef assignment expressions in INSERT/UPDATE;
1309  * see transformAssignmentIndirection().
1310  * * Placeholder for intermediate results in some SQL/JSON expression nodes,
1311  * such as JsonConstructorExpr.
1312  *
1313  * The uses in CaseExpr and ArrayCoerceExpr are safe only to the extent that
1314  * there is not any other CaseExpr or ArrayCoerceExpr between the value source
1315  * node and its child CaseTestExpr(s). This is true in the parse analysis
1316  * output, but the planner's function-inlining logic has to be careful not to
1317  * break it.
1318  *
1319  * The nested-assignment-expression case is safe because the only node types
1320  * that can be above such CaseTestExprs are FieldStore and SubscriptingRef.
1321  */
1322 typedef struct CaseTestExpr
1323 {
1325  Oid typeId; /* type for substituted value */
1326  /* typemod for substituted value */
1327  int32 typeMod pg_node_attr(query_jumble_ignore);
1328  /* collation for the substituted value */
1329  Oid collation pg_node_attr(query_jumble_ignore);
1331 
1332 /*
1333  * ArrayExpr - an ARRAY[] expression
1334  *
1335  * Note: if multidims is false, the constituent expressions all yield the
1336  * scalar type identified by element_typeid. If multidims is true, the
1337  * constituent expressions all yield arrays of element_typeid (ie, the same
1338  * type as array_typeid); at runtime we must check for compatible subscripts.
1339  */
1340 typedef struct ArrayExpr
1341 {
1343  /* type of expression result */
1344  Oid array_typeid pg_node_attr(query_jumble_ignore);
1345  /* OID of collation, or InvalidOid if none */
1346  Oid array_collid pg_node_attr(query_jumble_ignore);
1347  /* common type of array elements */
1348  Oid element_typeid pg_node_attr(query_jumble_ignore);
1349  /* the array elements or sub-arrays */
1351  /* true if elements are sub-arrays */
1352  bool multidims pg_node_attr(query_jumble_ignore);
1353  /* token location, or -1 if unknown */
1356 
1357 /*
1358  * RowExpr - a ROW() expression
1359  *
1360  * Note: the list of fields must have a one-for-one correspondence with
1361  * physical fields of the associated rowtype, although it is okay for it
1362  * to be shorter than the rowtype. That is, the N'th list element must
1363  * match up with the N'th physical field. When the N'th physical field
1364  * is a dropped column (attisdropped) then the N'th list element can just
1365  * be a NULL constant. (This case can only occur for named composite types,
1366  * not RECORD types, since those are built from the RowExpr itself rather
1367  * than vice versa.) It is important not to assume that length(args) is
1368  * the same as the number of columns logically present in the rowtype.
1369  *
1370  * colnames provides field names if the ROW() result is of type RECORD.
1371  * Names *must* be provided if row_typeid is RECORDOID; but if it is a
1372  * named composite type, colnames will be ignored in favor of using the
1373  * type's cataloged field names, so colnames should be NIL. Like the
1374  * args list, colnames is defined to be one-for-one with physical fields
1375  * of the rowtype (although dropped columns shouldn't appear in the
1376  * RECORD case, so this fine point is currently moot).
1377  */
1378 typedef struct RowExpr
1379 {
1381  List *args; /* the fields */
1382 
1383  /* RECORDOID or a composite type's ID */
1384  Oid row_typeid pg_node_attr(query_jumble_ignore);
1385 
1386  /*
1387  * row_typeid cannot be a domain over composite, only plain composite. To
1388  * create a composite domain value, apply CoerceToDomain to the RowExpr.
1389  *
1390  * Note: we deliberately do NOT store a typmod. Although a typmod will be
1391  * associated with specific RECORD types at runtime, it will differ for
1392  * different backends, and so cannot safely be stored in stored
1393  * parsetrees. We must assume typmod -1 for a RowExpr node.
1394  *
1395  * We don't need to store a collation either. The result type is
1396  * necessarily composite, and composite types never have a collation.
1397  */
1398 
1399  /* how to display this node */
1400  CoercionForm row_format pg_node_attr(query_jumble_ignore);
1401 
1402  /* list of String, or NIL */
1403  List *colnames pg_node_attr(query_jumble_ignore);
1404 
1405  ParseLoc location; /* token location, or -1 if unknown */
1407 
1408 /*
1409  * RowCompareExpr - row-wise comparison, such as (a, b) <= (1, 2)
1410  *
1411  * We support row comparison for any operator that can be determined to
1412  * act like =, <>, <, <=, >, or >= (we determine this by looking for the
1413  * operator in btree opfamilies). Note that the same operator name might
1414  * map to a different operator for each pair of row elements, since the
1415  * element datatypes can vary.
1416  *
1417  * A RowCompareExpr node is only generated for the < <= > >= cases;
1418  * the = and <> cases are translated to simple AND or OR combinations
1419  * of the pairwise comparisons. However, we include = and <> in the
1420  * RowCompareType enum for the convenience of parser logic.
1421  */
1422 typedef enum RowCompareType
1423 {
1424  /* Values of this enum are chosen to match btree strategy numbers */
1425  ROWCOMPARE_LT = 1, /* BTLessStrategyNumber */
1426  ROWCOMPARE_LE = 2, /* BTLessEqualStrategyNumber */
1427  ROWCOMPARE_EQ = 3, /* BTEqualStrategyNumber */
1428  ROWCOMPARE_GE = 4, /* BTGreaterEqualStrategyNumber */
1429  ROWCOMPARE_GT = 5, /* BTGreaterStrategyNumber */
1430  ROWCOMPARE_NE = 6, /* no such btree strategy */
1432 
1433 typedef struct RowCompareExpr
1434 {
1436 
1437  /* LT LE GE or GT, never EQ or NE */
1439  /* OID list of pairwise comparison ops */
1440  List *opnos pg_node_attr(query_jumble_ignore);
1441  /* OID list of containing operator families */
1442  List *opfamilies pg_node_attr(query_jumble_ignore);
1443  /* OID list of collations for comparisons */
1444  List *inputcollids pg_node_attr(query_jumble_ignore);
1445  /* the left-hand input arguments */
1447  /* the right-hand input arguments */
1450 
1451 /*
1452  * CoalesceExpr - a COALESCE expression
1453  */
1454 typedef struct CoalesceExpr
1455 {
1457  /* type of expression result */
1458  Oid coalescetype pg_node_attr(query_jumble_ignore);
1459  /* OID of collation, or InvalidOid if none */
1460  Oid coalescecollid pg_node_attr(query_jumble_ignore);
1461  /* the arguments */
1463  /* token location, or -1 if unknown */
1466 
1467 /*
1468  * MinMaxExpr - a GREATEST or LEAST function
1469  */
1470 typedef enum MinMaxOp
1471 {
1473  IS_LEAST
1475 
1476 typedef struct MinMaxExpr
1477 {
1479  /* common type of arguments and result */
1480  Oid minmaxtype pg_node_attr(query_jumble_ignore);
1481  /* OID of collation of result */
1482  Oid minmaxcollid pg_node_attr(query_jumble_ignore);
1483  /* OID of collation that function should use */
1484  Oid inputcollid pg_node_attr(query_jumble_ignore);
1485  /* function to execute */
1487  /* the arguments */
1489  /* token location, or -1 if unknown */
1492 
1493 /*
1494  * SQLValueFunction - parameterless functions with special grammar productions
1495  *
1496  * The SQL standard categorizes some of these as <datetime value function>
1497  * and others as <general value specification>. We call 'em SQLValueFunctions
1498  * for lack of a better term. We store type and typmod of the result so that
1499  * some code doesn't need to know each function individually, and because
1500  * we would need to store typmod anyway for some of the datetime functions.
1501  * Note that currently, all variants return non-collating datatypes, so we do
1502  * not need a collation field; also, all these functions are stable.
1503  */
1505 {
1522 
1523 typedef struct SQLValueFunction
1524 {
1526  SQLValueFunctionOp op; /* which function this is */
1527 
1528  /*
1529  * Result type/typmod. Type is fully determined by "op", so no need to
1530  * include this Oid in the query jumbling.
1531  */
1532  Oid type pg_node_attr(query_jumble_ignore);
1534  ParseLoc location; /* token location, or -1 if unknown */
1536 
1537 /*
1538  * XmlExpr - various SQL/XML functions requiring special grammar productions
1539  *
1540  * 'name' carries the "NAME foo" argument (already XML-escaped).
1541  * 'named_args' and 'arg_names' represent an xml_attribute list.
1542  * 'args' carries all other arguments.
1543  *
1544  * Note: result type/typmod/collation are not stored, but can be deduced
1545  * from the XmlExprOp. The type/typmod fields are just used for display
1546  * purposes, and are NOT necessarily the true result type of the node.
1547  */
1548 typedef enum XmlExprOp
1549 {
1550  IS_XMLCONCAT, /* XMLCONCAT(args) */
1551  IS_XMLELEMENT, /* XMLELEMENT(name, xml_attributes, args) */
1552  IS_XMLFOREST, /* XMLFOREST(xml_attributes) */
1553  IS_XMLPARSE, /* XMLPARSE(text, is_doc, preserve_ws) */
1554  IS_XMLPI, /* XMLPI(name [, args]) */
1555  IS_XMLROOT, /* XMLROOT(xml, version, standalone) */
1556  IS_XMLSERIALIZE, /* XMLSERIALIZE(is_document, xmlval, indent) */
1557  IS_DOCUMENT, /* xmlval IS DOCUMENT */
1559 
1560 typedef enum XmlOptionType
1561 {
1565 
1566 typedef struct XmlExpr
1567 {
1569  /* xml function ID */
1571  /* name in xml(NAME foo ...) syntaxes */
1572  char *name pg_node_attr(query_jumble_ignore);
1573  /* non-XML expressions for xml_attributes */
1575  /* parallel list of String values */
1576  List *arg_names pg_node_attr(query_jumble_ignore);
1577  /* list of expressions */
1579  /* DOCUMENT or CONTENT */
1580  XmlOptionType xmloption pg_node_attr(query_jumble_ignore);
1581  /* INDENT option for XMLSERIALIZE */
1582  bool indent;
1583  /* target type/typmod for XMLSERIALIZE */
1584  Oid type pg_node_attr(query_jumble_ignore);
1585  int32 typmod pg_node_attr(query_jumble_ignore);
1586  /* token location, or -1 if unknown */
1589 
1590 /*
1591  * JsonEncoding -
1592  * representation of JSON ENCODING clause
1593  */
1594 typedef enum JsonEncoding
1595 {
1596  JS_ENC_DEFAULT, /* unspecified */
1601 
1602 /*
1603  * JsonFormatType -
1604  * enumeration of JSON formats used in JSON FORMAT clause
1605  */
1606 typedef enum JsonFormatType
1607 {
1608  JS_FORMAT_DEFAULT, /* unspecified */
1609  JS_FORMAT_JSON, /* FORMAT JSON [ENCODING ...] */
1610  JS_FORMAT_JSONB, /* implicit internal format for RETURNING
1611  * jsonb */
1613 
1614 /*
1615  * JsonFormat -
1616  * representation of JSON FORMAT clause
1617  */
1618 typedef struct JsonFormat
1619 {
1621  JsonFormatType format_type; /* format type */
1622  JsonEncoding encoding; /* JSON encoding */
1623  ParseLoc location; /* token location, or -1 if unknown */
1625 
1626 /*
1627  * JsonReturning -
1628  * transformed representation of JSON RETURNING clause
1629  */
1630 typedef struct JsonReturning
1631 {
1633  JsonFormat *format; /* output JSON format */
1634  Oid typid; /* target type Oid */
1635  int32 typmod; /* target type modifier */
1637 
1638 /*
1639  * JsonValueExpr -
1640  * representation of JSON value expression (expr [FORMAT JsonFormat])
1641  *
1642  * The actual value is obtained by evaluating formatted_expr. raw_expr is
1643  * only there for displaying the original user-written expression and is not
1644  * evaluated by ExecInterpExpr() and eval_const_exprs_mutator().
1645  */
1646 typedef struct JsonValueExpr
1647 {
1649  Expr *raw_expr; /* raw expression */
1650  Expr *formatted_expr; /* formatted expression */
1651  JsonFormat *format; /* FORMAT clause, if specified */
1653 
1655 {
1664 
1665 /*
1666  * JsonConstructorExpr -
1667  * wrapper over FuncExpr/Aggref/WindowFunc for SQL/JSON constructors
1668  */
1669 typedef struct JsonConstructorExpr
1670 {
1672  JsonConstructorType type; /* constructor type */
1674  Expr *func; /* underlying json[b]_xxx() function call */
1675  Expr *coercion; /* coercion to RETURNING type */
1676  JsonReturning *returning; /* RETURNING clause */
1677  bool absent_on_null; /* ABSENT ON NULL? */
1678  bool unique; /* WITH UNIQUE KEYS? (JSON_OBJECT[AGG] only) */
1681 
1682 /*
1683  * JsonValueType -
1684  * representation of JSON item type in IS JSON predicate
1685  */
1686 typedef enum JsonValueType
1687 {
1688  JS_TYPE_ANY, /* IS JSON [VALUE] */
1689  JS_TYPE_OBJECT, /* IS JSON OBJECT */
1690  JS_TYPE_ARRAY, /* IS JSON ARRAY */
1691  JS_TYPE_SCALAR, /* IS JSON SCALAR */
1693 
1694 /*
1695  * JsonIsPredicate -
1696  * representation of IS JSON predicate
1697  */
1698 typedef struct JsonIsPredicate
1699 {
1701  Node *expr; /* subject expression */
1702  JsonFormat *format; /* FORMAT clause, if specified */
1703  JsonValueType item_type; /* JSON item type */
1704  bool unique_keys; /* check key uniqueness? */
1705  ParseLoc location; /* token location, or -1 if unknown */
1707 
1708 /* Nodes used in SQL/JSON query functions */
1709 
1710 /*
1711  * JsonWrapper -
1712  * representation of WRAPPER clause for JSON_QUERY()
1713  */
1714 typedef enum JsonWrapper
1715 {
1721 
1722 /*
1723  * JsonBehaviorType -
1724  * enumeration of behavior types used in SQL/JSON ON ERROR/EMPTY clauses
1725  *
1726  * If enum members are reordered, get_json_behavior() from ruleutils.c
1727  * must be updated accordingly.
1728  */
1729 typedef enum JsonBehaviorType
1730 {
1741 
1742 /*
1743  * JsonBehavior
1744  * Specifications for ON ERROR / ON EMPTY behaviors of SQL/JSON
1745  * query functions specified by a JsonExpr
1746  *
1747  * 'expr' is the expression to emit when a given behavior (EMPTY or ERROR)
1748  * occurs on evaluating the SQL/JSON query function. 'coerce' is set to true
1749  * if 'expr' isn't already of the expected target type given by
1750  * JsonExpr.returning.
1751  */
1752 typedef struct JsonBehavior
1753 {
1755 
1758  bool coerce;
1759  ParseLoc location; /* token location, or -1 if unknown */
1761 
1762 /*
1763  * JsonExprOp -
1764  * enumeration of SQL/JSON query function types
1765  */
1766 typedef enum JsonExprOp
1767 {
1768  JSON_EXISTS_OP, /* JSON_EXISTS() */
1769  JSON_QUERY_OP, /* JSON_QUERY() */
1770  JSON_VALUE_OP, /* JSON_VALUE() */
1771  JSON_TABLE_OP, /* JSON_TABLE() */
1773 
1774 /*
1775  * JsonExpr -
1776  * Transformed representation of JSON_VALUE(), JSON_QUERY(), and
1777  * JSON_EXISTS()
1778  */
1779 typedef struct JsonExpr
1780 {
1782 
1784 
1785  char *column_name; /* JSON_TABLE() column name or NULL if this is
1786  * not for a JSON_TABLE() */
1787 
1788  /* jsonb-valued expression to query */
1790 
1791  /* Format of the above expression needed by ruleutils.c */
1793 
1794  /* jsonpath-valued expression containing the query pattern */
1796 
1797  /* Expected type/format of the output. */
1799 
1800  /* Information about the PASSING argument expressions */
1803 
1804  /* User-specified or default ON EMPTY and ON ERROR behaviors */
1807 
1808  /*
1809  * Information about converting the result of jsonpath functions
1810  * JsonPathQuery() and JsonPathValue() to the RETURNING type.
1811  *
1812  * coercion_expr is a cast expression if the parser can find it for the
1813  * source and the target type. If not, either use_io_coercion or
1814  * use_json_coercion is set to determine the coercion method to use at
1815  * runtime; see coerceJsonExprOutput() and ExecInitJsonExpr().
1816  */
1820 
1821  /* WRAPPER specification for JSON_QUERY */
1823 
1824  /* KEEP or OMIT QUOTES for singleton scalars returned by JSON_QUERY() */
1826 
1827  /* JsonExpr's collation, if coercion_expr is NULL. */
1829 
1830  /* Original JsonFuncExpr's location */
1833 
1834 /*
1835  * JsonTablePath
1836  * A JSON path expression to be computed as part of evaluating
1837  * a JSON_TABLE plan node
1838  */
1839 typedef struct JsonTablePath
1840 {
1842 
1844  char *name;
1846 
1847 /*
1848  * JsonTablePlan -
1849  * Abstract class to represent different types of JSON_TABLE "plans".
1850  * A plan is used to generate a "row pattern" value by evaluating a JSON
1851  * path expression against an input JSON document, which is then used for
1852  * populating JSON_TABLE() columns
1853  */
1854 typedef struct JsonTablePlan
1855 {
1856  pg_node_attr(abstract)
1857 
1858  NodeTag type;
1860 
1861 /*
1862  * JSON_TABLE plan to evaluate a JSON path expression and NESTED paths, if
1863  * any.
1864  */
1865 typedef struct JsonTablePathScan
1866 {
1868 
1869  /* JSON path to evaluate */
1871 
1872  /*
1873  * ERROR/EMPTY ON ERROR behavior; only significant in the plan for the
1874  * top-level path.
1875  */
1877 
1878  /* Plan(s) for nested columns, if any. */
1880 
1881  /*
1882  * 0-based index in TableFunc.colvalexprs of the 1st and the last column
1883  * covered by this plan. Both are -1 if all columns are nested and thus
1884  * computed by the child plan(s).
1885  */
1886  int colMin;
1887  int colMax;
1889 
1890 /*
1891  * JsonTableSiblingJoin -
1892  * Plan to join rows of sibling NESTED COLUMNS clauses in the same parent
1893  * COLUMNS clause
1894  */
1895 typedef struct JsonTableSiblingJoin
1896 {
1898 
1902 
1903 /* ----------------
1904  * NullTest
1905  *
1906  * NullTest represents the operation of testing a value for NULLness.
1907  * The appropriate test is performed and returned as a boolean Datum.
1908  *
1909  * When argisrow is false, this simply represents a test for the null value.
1910  *
1911  * When argisrow is true, the input expression must yield a rowtype, and
1912  * the node implements "row IS [NOT] NULL" per the SQL standard. This
1913  * includes checking individual fields for NULLness when the row datum
1914  * itself isn't NULL.
1915  *
1916  * NOTE: the combination of a rowtype input and argisrow==false does NOT
1917  * correspond to the SQL notation "row IS [NOT] NULL"; instead, this case
1918  * represents the SQL notation "row IS [NOT] DISTINCT FROM NULL".
1919  * ----------------
1920  */
1921 
1922 typedef enum NullTestType
1923 {
1926 
1927 typedef struct NullTest
1928 {
1930  Expr *arg; /* input expression */
1931  NullTestType nulltesttype; /* IS NULL, IS NOT NULL */
1932  /* T to perform field-by-field null checks */
1933  bool argisrow pg_node_attr(query_jumble_ignore);
1934  ParseLoc location; /* token location, or -1 if unknown */
1936 
1937 /*
1938  * BooleanTest
1939  *
1940  * BooleanTest represents the operation of determining whether a boolean
1941  * is TRUE, FALSE, or UNKNOWN (ie, NULL). All six meaningful combinations
1942  * are supported. Note that a NULL input does *not* cause a NULL result.
1943  * The appropriate test is performed and returned as a boolean Datum.
1944  */
1945 
1946 typedef enum BoolTestType
1947 {
1950 
1951 typedef struct BooleanTest
1952 {
1954  Expr *arg; /* input expression */
1955  BoolTestType booltesttype; /* test type */
1956  ParseLoc location; /* token location, or -1 if unknown */
1958 
1959 
1960 /*
1961  * MergeAction
1962  *
1963  * Transformed representation of a WHEN clause in a MERGE statement
1964  */
1965 
1966 typedef enum MergeMatchKind
1967 {
1972 
1973 #define NUM_MERGE_MATCH_KINDS (MERGE_WHEN_NOT_MATCHED_BY_TARGET + 1)
1974 
1975 typedef struct MergeAction
1976 {
1978  MergeMatchKind matchKind; /* MATCHED/NOT MATCHED BY SOURCE/TARGET */
1979  CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
1980  /* OVERRIDING clause */
1981  OverridingKind override pg_node_attr(query_jumble_ignore);
1982  Node *qual; /* transformed WHEN conditions */
1983  List *targetList; /* the target list (of TargetEntry) */
1984  /* target attribute numbers of an UPDATE */
1985  List *updateColnos pg_node_attr(query_jumble_ignore);
1987 
1988 /*
1989  * CoerceToDomain
1990  *
1991  * CoerceToDomain represents the operation of coercing a value to a domain
1992  * type. At runtime (and not before) the precise set of constraints to be
1993  * checked will be determined. If the value passes, it is returned as the
1994  * result; if not, an error is raised. Note that this is equivalent to
1995  * RelabelType in the scenario where no constraints are applied.
1996  */
1997 typedef struct CoerceToDomain
1998 {
2000  Expr *arg; /* input expression */
2001  Oid resulttype; /* domain type ID (result type) */
2002  /* output typmod (currently always -1) */
2003  int32 resulttypmod pg_node_attr(query_jumble_ignore);
2004  /* OID of collation, or InvalidOid if none */
2005  Oid resultcollid pg_node_attr(query_jumble_ignore);
2006  /* how to display this node */
2007  CoercionForm coercionformat pg_node_attr(query_jumble_ignore);
2008  ParseLoc location; /* token location, or -1 if unknown */
2010 
2011 /*
2012  * Placeholder node for the value to be processed by a domain's check
2013  * constraint. This is effectively like a Param, but can be implemented more
2014  * simply since we need only one replacement value at a time.
2015  *
2016  * Note: the typeId/typeMod/collation will be set from the domain's base type,
2017  * not the domain itself. This is because we shouldn't consider the value
2018  * to be a member of the domain if we haven't yet checked its constraints.
2019  */
2020 typedef struct CoerceToDomainValue
2021 {
2023  /* type for substituted value */
2025  /* typemod for substituted value */
2026  int32 typeMod pg_node_attr(query_jumble_ignore);
2027  /* collation for the substituted value */
2028  Oid collation pg_node_attr(query_jumble_ignore);
2029  /* token location, or -1 if unknown */
2032 
2033 /*
2034  * Placeholder node for a DEFAULT marker in an INSERT or UPDATE command.
2035  *
2036  * This is not an executable expression: it must be replaced by the actual
2037  * column default expression during rewriting. But it is convenient to
2038  * treat it as an expression node during parsing and rewriting.
2039  */
2040 typedef struct SetToDefault
2041 {
2043  /* type for substituted value */
2045  /* typemod for substituted value */
2046  int32 typeMod pg_node_attr(query_jumble_ignore);
2047  /* collation for the substituted value */
2048  Oid collation pg_node_attr(query_jumble_ignore);
2049  /* token location, or -1 if unknown */
2052 
2053 /*
2054  * Node representing [WHERE] CURRENT OF cursor_name
2055  *
2056  * CURRENT OF is a bit like a Var, in that it carries the rangetable index
2057  * of the target relation being constrained; this aids placing the expression
2058  * correctly during planning. We can assume however that its "levelsup" is
2059  * always zero, due to the syntactic constraints on where it can appear.
2060  * Also, cvarno will always be a true RT index, never INNER_VAR etc.
2061  *
2062  * The referenced cursor can be represented either as a hardwired string
2063  * or as a reference to a run-time parameter of type REFCURSOR. The latter
2064  * case is for the convenience of plpgsql.
2065  */
2066 typedef struct CurrentOfExpr
2067 {
2069  Index cvarno; /* RT index of target relation */
2070  char *cursor_name; /* name of referenced cursor, or NULL */
2071  int cursor_param; /* refcursor parameter number, or 0 */
2073 
2074 /*
2075  * NextValueExpr - get next value from sequence
2076  *
2077  * This has the same effect as calling the nextval() function, but it does not
2078  * check permissions on the sequence. This is used for identity columns,
2079  * where the sequence is an implicit dependency without its own permissions.
2080  */
2081 typedef struct NextValueExpr
2082 {
2087 
2088 /*
2089  * InferenceElem - an element of a unique index inference specification
2090  *
2091  * This mostly matches the structure of IndexElems, but having a dedicated
2092  * primnode allows for a clean separation between the use of index parameters
2093  * by utility commands, and this node.
2094  */
2095 typedef struct InferenceElem
2096 {
2098  Node *expr; /* expression to infer from, or NULL */
2099  Oid infercollid; /* OID of collation, or InvalidOid */
2100  Oid inferopclass; /* OID of att opclass, or InvalidOid */
2102 
2103 /*--------------------
2104  * TargetEntry -
2105  * a target entry (used in query target lists)
2106  *
2107  * Strictly speaking, a TargetEntry isn't an expression node (since it can't
2108  * be evaluated by ExecEvalExpr). But we treat it as one anyway, since in
2109  * very many places it's convenient to process a whole query targetlist as a
2110  * single expression tree.
2111  *
2112  * In a SELECT's targetlist, resno should always be equal to the item's
2113  * ordinal position (counting from 1). However, in an INSERT or UPDATE
2114  * targetlist, resno represents the attribute number of the destination
2115  * column for the item; so there may be missing or out-of-order resnos.
2116  * It is even legal to have duplicated resnos; consider
2117  * UPDATE table SET arraycol[1] = ..., arraycol[2] = ..., ...
2118  * In an INSERT, the rewriter and planner will normalize the tlist by
2119  * reordering it into physical column order and filling in default values
2120  * for any columns not assigned values by the original query. In an UPDATE,
2121  * after the rewriter merges multiple assignments for the same column, the
2122  * planner extracts the target-column numbers into a separate "update_colnos"
2123  * list, and then renumbers the tlist elements serially. Thus, tlist resnos
2124  * match ordinal position in all tlists seen by the executor; but it is wrong
2125  * to assume that before planning has happened.
2126  *
2127  * resname is required to represent the correct column name in non-resjunk
2128  * entries of top-level SELECT targetlists, since it will be used as the
2129  * column title sent to the frontend. In most other contexts it is only
2130  * a debugging aid, and may be wrong or even NULL. (In particular, it may
2131  * be wrong in a tlist from a stored rule, if the referenced column has been
2132  * renamed by ALTER TABLE since the rule was made. Also, the planner tends
2133  * to store NULL rather than look up a valid name for tlist entries in
2134  * non-toplevel plan nodes.) In resjunk entries, resname should be either
2135  * a specific system-generated name (such as "ctid") or NULL; anything else
2136  * risks confusing ExecGetJunkAttribute!
2137  *
2138  * ressortgroupref is used in the representation of ORDER BY, GROUP BY, and
2139  * DISTINCT items. Targetlist entries with ressortgroupref=0 are not
2140  * sort/group items. If ressortgroupref>0, then this item is an ORDER BY,
2141  * GROUP BY, and/or DISTINCT target value. No two entries in a targetlist
2142  * may have the same nonzero ressortgroupref --- but there is no particular
2143  * meaning to the nonzero values, except as tags. (For example, one must
2144  * not assume that lower ressortgroupref means a more significant sort key.)
2145  * The order of the associated SortGroupClause lists determine the semantics.
2146  *
2147  * resorigtbl/resorigcol identify the source of the column, if it is a
2148  * simple reference to a column of a base table (or view). If it is not
2149  * a simple reference, these fields are zeroes.
2150  *
2151  * If resjunk is true then the column is a working column (such as a sort key)
2152  * that should be removed from the final output of the query. Resjunk columns
2153  * must have resnos that cannot duplicate any regular column's resno. Also
2154  * note that there are places that assume resjunk columns come after non-junk
2155  * columns.
2156  *--------------------
2157  */
2158 typedef struct TargetEntry
2159 {
2161  /* expression to evaluate */
2163  /* attribute number (see notes above) */
2165  /* name of the column (could be NULL) */
2166  char *resname pg_node_attr(query_jumble_ignore);
2167  /* nonzero if referenced by a sort/group clause */
2169  /* OID of column's source table */
2170  Oid resorigtbl pg_node_attr(query_jumble_ignore);
2171  /* column's number in source table */
2172  AttrNumber resorigcol pg_node_attr(query_jumble_ignore);
2173  /* set to true to eliminate the attribute from final target list */
2174  bool resjunk pg_node_attr(query_jumble_ignore);
2176 
2177 
2178 /* ----------------------------------------------------------------
2179  * node types for join trees
2180  *
2181  * The leaves of a join tree structure are RangeTblRef nodes. Above
2182  * these, JoinExpr nodes can appear to denote a specific kind of join
2183  * or qualified join. Also, FromExpr nodes can appear to denote an
2184  * ordinary cross-product join ("FROM foo, bar, baz WHERE ...").
2185  * FromExpr is like a JoinExpr of jointype JOIN_INNER, except that it
2186  * may have any number of child nodes, not just two.
2187  *
2188  * NOTE: the top level of a Query's jointree is always a FromExpr.
2189  * Even if the jointree contains no rels, there will be a FromExpr.
2190  *
2191  * NOTE: the qualification expressions present in JoinExpr nodes are
2192  * *in addition to* the query's main WHERE clause, which appears as the
2193  * qual of the top-level FromExpr. The reason for associating quals with
2194  * specific nodes in the jointree is that the position of a qual is critical
2195  * when outer joins are present. (If we enforce a qual too soon or too late,
2196  * that may cause the outer join to produce the wrong set of NULL-extended
2197  * rows.) If all joins are inner joins then all the qual positions are
2198  * semantically interchangeable.
2199  *
2200  * NOTE: in the raw output of gram.y, a join tree contains RangeVar,
2201  * RangeSubselect, and RangeFunction nodes, which are all replaced by
2202  * RangeTblRef nodes during the parse analysis phase. Also, the top-level
2203  * FromExpr is added during parse analysis; the grammar regards FROM and
2204  * WHERE as separate.
2205  * ----------------------------------------------------------------
2206  */
2207 
2208 /*
2209  * RangeTblRef - reference to an entry in the query's rangetable
2210  *
2211  * We could use direct pointers to the RT entries and skip having these
2212  * nodes, but multiple pointers to the same node in a querytree cause
2213  * lots of headaches, so it seems better to store an index into the RT.
2214  */
2215 typedef struct RangeTblRef
2216 {
2218  int rtindex;
2220 
2221 /*----------
2222  * JoinExpr - for SQL JOIN expressions
2223  *
2224  * isNatural, usingClause, and quals are interdependent. The user can write
2225  * only one of NATURAL, USING(), or ON() (this is enforced by the grammar).
2226  * If he writes NATURAL then parse analysis generates the equivalent USING()
2227  * list, and from that fills in "quals" with the right equality comparisons.
2228  * If he writes USING() then "quals" is filled with equality comparisons.
2229  * If he writes ON() then only "quals" is set. Note that NATURAL/USING
2230  * are not equivalent to ON() since they also affect the output column list.
2231  *
2232  * alias is an Alias node representing the AS alias-clause attached to the
2233  * join expression, or NULL if no clause. NB: presence or absence of the
2234  * alias has a critical impact on semantics, because a join with an alias
2235  * restricts visibility of the tables/columns inside it.
2236  *
2237  * join_using_alias is an Alias node representing the join correlation
2238  * name that SQL:2016 and later allow to be attached to JOIN/USING.
2239  * Its column alias list includes only the common column names from USING,
2240  * and it does not restrict visibility of the join's input tables.
2241  *
2242  * During parse analysis, an RTE is created for the Join, and its index
2243  * is filled into rtindex. This RTE is present mainly so that Vars can
2244  * be created that refer to the outputs of the join. The planner sometimes
2245  * generates JoinExprs internally; these can have rtindex = 0 if there are
2246  * no join alias variables referencing such joins.
2247  *----------
2248  */
2249 typedef struct JoinExpr
2250 {
2252  JoinType jointype; /* type of join */
2253  bool isNatural; /* Natural join? Will need to shape table */
2254  Node *larg; /* left subtree */
2255  Node *rarg; /* right subtree */
2256  /* USING clause, if any (list of String) */
2257  List *usingClause pg_node_attr(query_jumble_ignore);
2258  /* alias attached to USING clause, if any */
2259  Alias *join_using_alias pg_node_attr(query_jumble_ignore);
2260  /* qualifiers on join, if any */
2262  /* user-written alias clause, if any */
2263  Alias *alias pg_node_attr(query_jumble_ignore);
2264  /* RT index assigned for join, or 0 */
2265  int rtindex;
2267 
2268 /*----------
2269  * FromExpr - represents a FROM ... WHERE ... construct
2270  *
2271  * This is both more flexible than a JoinExpr (it can have any number of
2272  * children, including zero) and less so --- we don't need to deal with
2273  * aliases and so on. The output column set is implicitly just the union
2274  * of the outputs of the children.
2275  *----------
2276  */
2277 typedef struct FromExpr
2278 {
2280  List *fromlist; /* List of join subtrees */
2281  Node *quals; /* qualifiers on join, if any */
2283 
2284 /*----------
2285  * OnConflictExpr - represents an ON CONFLICT DO ... expression
2286  *
2287  * The optimizer requires a list of inference elements, and optionally a WHERE
2288  * clause to infer a unique index. The unique index (or, occasionally,
2289  * indexes) inferred are used to arbitrate whether or not the alternative ON
2290  * CONFLICT path is taken.
2291  *----------
2292  */
2293 typedef struct OnConflictExpr
2294 {
2296  OnConflictAction action; /* DO NOTHING or UPDATE? */
2297 
2298  /* Arbiter */
2299  List *arbiterElems; /* unique index arbiter list (of
2300  * InferenceElem's) */
2301  Node *arbiterWhere; /* unique index arbiter WHERE clause */
2302  Oid constraint; /* pg_constraint OID for arbiter */
2303 
2304  /* ON CONFLICT UPDATE */
2305  List *onConflictSet; /* List of ON CONFLICT SET TargetEntrys */
2306  Node *onConflictWhere; /* qualifiers to restrict UPDATE to */
2307  int exclRelIndex; /* RT index of 'excluded' relation */
2308  List *exclRelTlist; /* tlist of the EXCLUDED pseudo relation */
2310 
2311 #endif /* PRIMNODES_H */
int16 AttrNumber
Definition: attnum.h:21
signed int int32
Definition: c.h:494
unsigned int Index
Definition: c.h:614
double Cost
Definition: nodes.h:251
OnConflictAction
Definition: nodes.h:416
CmdType
Definition: nodes.h:263
NodeTag
Definition: nodes.h:27
AggSplit
Definition: nodes.h:374
int ParseLoc
Definition: nodes.h:240
JoinType
Definition: nodes.h:288
#define plan(x)
Definition: pg_regress.c:162
uintptr_t Datum
Definition: postgres.h:64
unsigned int Oid
Definition: postgres_ext.h:31
BoolTestType
Definition: primnodes.h:1947
@ IS_NOT_TRUE
Definition: primnodes.h:1948
@ IS_NOT_FALSE
Definition: primnodes.h:1948
@ IS_NOT_UNKNOWN
Definition: primnodes.h:1948
@ IS_TRUE
Definition: primnodes.h:1948
@ IS_UNKNOWN
Definition: primnodes.h:1948
@ IS_FALSE
Definition: primnodes.h:1948
struct ArrayExpr ArrayExpr
struct FieldSelect FieldSelect
struct CoalesceExpr CoalesceExpr
struct Aggref Aggref
SubLinkType
Definition: primnodes.h:966
@ ARRAY_SUBLINK
Definition: primnodes.h:973
@ ANY_SUBLINK
Definition: primnodes.h:969
@ MULTIEXPR_SUBLINK
Definition: primnodes.h:972
@ CTE_SUBLINK
Definition: primnodes.h:974
@ EXPR_SUBLINK
Definition: primnodes.h:971
@ ROWCOMPARE_SUBLINK
Definition: primnodes.h:970
@ ALL_SUBLINK
Definition: primnodes.h:968
@ EXISTS_SUBLINK
Definition: primnodes.h:967
struct AlternativeSubPlan AlternativeSubPlan
JsonFormatType
Definition: primnodes.h:1607
@ JS_FORMAT_JSONB
Definition: primnodes.h:1610
@ JS_FORMAT_DEFAULT
Definition: primnodes.h:1608
@ JS_FORMAT_JSON
Definition: primnodes.h:1609
struct InferenceElem InferenceElem
struct ArrayCoerceExpr ArrayCoerceExpr
struct TargetEntry TargetEntry
MinMaxOp
Definition: primnodes.h:1471
@ IS_LEAST
Definition: primnodes.h:1473
@ IS_GREATEST
Definition: primnodes.h:1472
TableFuncType
Definition: primnodes.h:98
@ TFT_XMLTABLE
Definition: primnodes.h:99
@ TFT_JSON_TABLE
Definition: primnodes.h:100
struct CaseWhen CaseWhen
BoolExprType
Definition: primnodes.h:900
@ AND_EXPR
Definition: primnodes.h:901
@ OR_EXPR
Definition: primnodes.h:901
@ NOT_EXPR
Definition: primnodes.h:901
struct SetToDefault SetToDefault
JsonEncoding
Definition: primnodes.h:1595
@ JS_ENC_DEFAULT
Definition: primnodes.h:1596
@ JS_ENC_UTF32
Definition: primnodes.h:1599
@ JS_ENC_UTF8
Definition: primnodes.h:1597
@ JS_ENC_UTF16
Definition: primnodes.h:1598
struct JsonReturning JsonReturning
struct CaseExpr CaseExpr
struct JsonBehavior JsonBehavior
struct WindowFunc WindowFunc
XmlOptionType
Definition: primnodes.h:1561
@ XMLOPTION_CONTENT
Definition: primnodes.h:1563
@ XMLOPTION_DOCUMENT
Definition: primnodes.h:1562
SQLValueFunctionOp
Definition: primnodes.h:1505
@ SVFOP_CURRENT_CATALOG
Definition: primnodes.h:1519
@ SVFOP_LOCALTIME_N
Definition: primnodes.h:1512
@ SVFOP_CURRENT_TIMESTAMP
Definition: primnodes.h:1509
@ SVFOP_LOCALTIME
Definition: primnodes.h:1511
@ SVFOP_CURRENT_TIMESTAMP_N
Definition: primnodes.h:1510
@ SVFOP_CURRENT_ROLE
Definition: primnodes.h:1515
@ SVFOP_USER
Definition: primnodes.h:1517
@ SVFOP_CURRENT_SCHEMA
Definition: primnodes.h:1520
@ SVFOP_LOCALTIMESTAMP_N
Definition: primnodes.h:1514
@ SVFOP_CURRENT_DATE
Definition: primnodes.h:1506
@ SVFOP_CURRENT_TIME_N
Definition: primnodes.h:1508
@ SVFOP_CURRENT_TIME
Definition: primnodes.h:1507
@ SVFOP_LOCALTIMESTAMP
Definition: primnodes.h:1513
@ SVFOP_CURRENT_USER
Definition: primnodes.h:1516
@ SVFOP_SESSION_USER
Definition: primnodes.h:1518
ParamKind
Definition: primnodes.h:366
@ PARAM_MULTIEXPR
Definition: primnodes.h:370
@ PARAM_EXTERN
Definition: primnodes.h:367
@ PARAM_SUBLINK
Definition: primnodes.h:369
@ PARAM_EXEC
Definition: primnodes.h:368
struct CoerceToDomainValue CoerceToDomainValue
struct Var Var
JsonWrapper
Definition: primnodes.h:1715
@ JSW_UNCONDITIONAL
Definition: primnodes.h:1719
@ JSW_CONDITIONAL
Definition: primnodes.h:1718
@ JSW_UNSPEC
Definition: primnodes.h:1716
@ JSW_NONE
Definition: primnodes.h:1717
struct IntoClause IntoClause
struct MinMaxExpr MinMaxExpr
OpExpr DistinctExpr
Definition: primnodes.h:822
struct NamedArgExpr NamedArgExpr
XmlExprOp
Definition: primnodes.h:1549
@ IS_DOCUMENT
Definition: primnodes.h:1557
@ IS_XMLFOREST
Definition: primnodes.h:1552
@ IS_XMLCONCAT
Definition: primnodes.h:1550
@ IS_XMLPI
Definition: primnodes.h:1554
@ IS_XMLPARSE
Definition: primnodes.h:1553
@ IS_XMLSERIALIZE
Definition: primnodes.h:1556
@ IS_XMLROOT
Definition: primnodes.h:1555
@ IS_XMLELEMENT
Definition: primnodes.h:1551
struct JsonIsPredicate JsonIsPredicate
struct JoinExpr JoinExpr
struct CoerceToDomain CoerceToDomain
struct SubLink SubLink
struct NextValueExpr NextValueExpr
struct JsonExpr JsonExpr
struct BoolExpr BoolExpr
struct OpExpr OpExpr
RowCompareType
Definition: primnodes.h:1423
@ ROWCOMPARE_GT
Definition: primnodes.h:1429
@ ROWCOMPARE_LT
Definition: primnodes.h:1425
@ ROWCOMPARE_NE
Definition: primnodes.h:1430
@ ROWCOMPARE_LE
Definition: primnodes.h:1426
@ ROWCOMPARE_EQ
Definition: primnodes.h:1427
@ ROWCOMPARE_GE
Definition: primnodes.h:1428
JsonBehaviorType
Definition: primnodes.h:1730
@ JSON_BEHAVIOR_ERROR
Definition: primnodes.h:1732
@ JSON_BEHAVIOR_TRUE
Definition: primnodes.h:1734
@ JSON_BEHAVIOR_DEFAULT
Definition: primnodes.h:1739
@ JSON_BEHAVIOR_EMPTY
Definition: primnodes.h:1733
@ JSON_BEHAVIOR_FALSE
Definition: primnodes.h:1735
@ JSON_BEHAVIOR_NULL
Definition: primnodes.h:1731
@ JSON_BEHAVIOR_EMPTY_OBJECT
Definition: primnodes.h:1738
@ JSON_BEHAVIOR_UNKNOWN
Definition: primnodes.h:1736
@ JSON_BEHAVIOR_EMPTY_ARRAY
Definition: primnodes.h:1737
struct OnConflictExpr OnConflictExpr
struct FuncExpr FuncExpr
OnCommitAction
Definition: primnodes.h:56
@ ONCOMMIT_DELETE_ROWS
Definition: primnodes.h:59
@ ONCOMMIT_NOOP
Definition: primnodes.h:57
@ ONCOMMIT_PRESERVE_ROWS
Definition: primnodes.h:58
@ ONCOMMIT_DROP
Definition: primnodes.h:60
struct GroupingFunc GroupingFunc
struct XmlExpr XmlExpr
struct SubPlan SubPlan
struct CollateExpr CollateExpr
struct ConvertRowtypeExpr ConvertRowtypeExpr
struct MergeAction MergeAction
struct RowExpr RowExpr
struct RangeTblRef RangeTblRef
JsonExprOp
Definition: primnodes.h:1767
@ JSON_QUERY_OP
Definition: primnodes.h:1769
@ JSON_TABLE_OP
Definition: primnodes.h:1771
@ JSON_EXISTS_OP
Definition: primnodes.h:1768
@ JSON_VALUE_OP
Definition: primnodes.h:1770
struct BooleanTest BooleanTest
CoercionForm
Definition: primnodes.h:703
@ COERCE_SQL_SYNTAX
Definition: primnodes.h:707
@ COERCE_IMPLICIT_CAST
Definition: primnodes.h:706
@ COERCE_EXPLICIT_CAST
Definition: primnodes.h:705
@ COERCE_EXPLICIT_CALL
Definition: primnodes.h:704
struct CaseTestExpr CaseTestExpr
OverridingKind
Definition: primnodes.h:26
@ OVERRIDING_NOT_SET
Definition: primnodes.h:27
@ OVERRIDING_SYSTEM_VALUE
Definition: primnodes.h:29
@ OVERRIDING_USER_VALUE
Definition: primnodes.h:28
struct SQLValueFunction SQLValueFunction
NullTestType
Definition: primnodes.h:1923
@ IS_NULL
Definition: primnodes.h:1924
@ IS_NOT_NULL
Definition: primnodes.h:1924
struct JsonConstructorExpr JsonConstructorExpr
struct CurrentOfExpr CurrentOfExpr
JsonValueType
Definition: primnodes.h:1687
@ JS_TYPE_ANY
Definition: primnodes.h:1688
@ JS_TYPE_ARRAY
Definition: primnodes.h:1690
@ JS_TYPE_OBJECT
Definition: primnodes.h:1689
@ JS_TYPE_SCALAR
Definition: primnodes.h:1691
struct NullTest NullTest
MergeMatchKind
Definition: primnodes.h:1967
@ MERGE_WHEN_NOT_MATCHED_BY_TARGET
Definition: primnodes.h:1970
@ MERGE_WHEN_NOT_MATCHED_BY_SOURCE
Definition: primnodes.h:1969
@ MERGE_WHEN_MATCHED
Definition: primnodes.h:1968
struct RowCompareExpr RowCompareExpr
struct JsonTablePath JsonTablePath
struct TableFunc TableFunc
struct JsonTablePathScan JsonTablePathScan
struct JsonTableSiblingJoin JsonTableSiblingJoin
struct ScalarArrayOpExpr ScalarArrayOpExpr
struct JsonFormat JsonFormat
struct Param Param
struct Alias Alias
CoercionContext
Definition: primnodes.h:683
@ COERCION_PLPGSQL
Definition: primnodes.h:686
@ COERCION_ASSIGNMENT
Definition: primnodes.h:685
@ COERCION_EXPLICIT
Definition: primnodes.h:687
@ COERCION_IMPLICIT
Definition: primnodes.h:684
struct RelabelType RelabelType
struct CoerceViaIO CoerceViaIO
struct RangeVar RangeVar
JsonConstructorType
Definition: primnodes.h:1655
@ JSCTOR_JSON_SERIALIZE
Definition: primnodes.h:1662
@ JSCTOR_JSON_ARRAYAGG
Definition: primnodes.h:1659
@ JSCTOR_JSON_PARSE
Definition: primnodes.h:1660
@ JSCTOR_JSON_OBJECT
Definition: primnodes.h:1656
@ JSCTOR_JSON_SCALAR
Definition: primnodes.h:1661
@ JSCTOR_JSON_ARRAY
Definition: primnodes.h:1657
@ JSCTOR_JSON_OBJECTAGG
Definition: primnodes.h:1658
OpExpr NullIfExpr
Definition: primnodes.h:830
struct Const Const
struct SubscriptingRef SubscriptingRef
struct JsonValueExpr JsonValueExpr
struct MergeSupportFunc MergeSupportFunc
struct FromExpr FromExpr
struct FieldStore FieldStore
int aggtransno pg_node_attr(query_jumble_ignore)
Index agglevelsup pg_node_attr(query_jumble_ignore)
char aggkind pg_node_attr(query_jumble_ignore)
Oid inputcollid pg_node_attr(query_jumble_ignore)
Oid aggfnoid
Definition: primnodes.h:444
Expr xpr
Definition: primnodes.h:441
List * aggdistinct
Definition: primnodes.h:474
AggSplit aggsplit pg_node_attr(query_jumble_ignore)
List * aggdirectargs
Definition: primnodes.h:465
bool aggstar pg_node_attr(query_jumble_ignore)
Oid aggtranstype pg_node_attr(equal_ignore, query_jumble_ignore)
Oid aggcollid pg_node_attr(query_jumble_ignore)
List * args
Definition: primnodes.h:468
Expr * aggfilter
Definition: primnodes.h:477
int aggno pg_node_attr(query_jumble_ignore)
Oid aggtype pg_node_attr(query_jumble_ignore)
bool aggvariadic pg_node_attr(query_jumble_ignore)
List *aggargtypes pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:507
List * aggorder
Definition: primnodes.h:471
bool aggpresorted pg_node_attr(equal_ignore, query_jumble_ignore)
char * aliasname
Definition: primnodes.h:50
NodeTag type
Definition: primnodes.h:49
List * colnames
Definition: primnodes.h:51
pg_node_attr(no_query_jumble) Expr xpr
Oid resultcollid pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:1212
CoercionForm coerceformat pg_node_attr(query_jumble_ignore)
int32 resulttypmod pg_node_attr(query_jumble_ignore)
Oid element_typeid pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:1354
Oid array_collid pg_node_attr(query_jumble_ignore)
List * elements
Definition: primnodes.h:1350
Expr xpr
Definition: primnodes.h:1342
bool multidims pg_node_attr(query_jumble_ignore)
Oid array_typeid pg_node_attr(query_jumble_ignore)
pg_node_attr(custom_read_write) Expr xpr
BoolExprType boolop
Definition: primnodes.h:909
List * args
Definition: primnodes.h:910
ParseLoc location
Definition: primnodes.h:911
ParseLoc location
Definition: primnodes.h:1956
BoolTestType booltesttype
Definition: primnodes.h:1955
Expr * arg
Definition: primnodes.h:1954
Expr * arg
Definition: primnodes.h:1283
Oid casecollid pg_node_attr(query_jumble_ignore)
Expr xpr
Definition: primnodes.h:1278
ParseLoc location
Definition: primnodes.h:1286
Oid casetype pg_node_attr(query_jumble_ignore)
Expr * defresult
Definition: primnodes.h:1285
List * args
Definition: primnodes.h:1284
int32 typeMod pg_node_attr(query_jumble_ignore)
Oid collation pg_node_attr(query_jumble_ignore)
Expr * result
Definition: primnodes.h:1296
Expr * expr
Definition: primnodes.h:1295
Expr xpr
Definition: primnodes.h:1294
ParseLoc location
Definition: primnodes.h:1297
Oid coalescetype pg_node_attr(query_jumble_ignore)
List * args
Definition: primnodes.h:1462
Oid coalescecollid pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:1464
Oid collation pg_node_attr(query_jumble_ignore)
int32 typeMod pg_node_attr(query_jumble_ignore)
int32 resulttypmod pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:2008
CoercionForm coercionformat pg_node_attr(query_jumble_ignore)
Oid resultcollid pg_node_attr(query_jumble_ignore)
Expr * arg
Definition: primnodes.h:1177
CoercionForm coerceformat pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:1184
Oid resulttype
Definition: primnodes.h:1178
Oid resultcollid pg_node_attr(query_jumble_ignore)
Expr * arg
Definition: primnodes.h:1249
ParseLoc location
Definition: primnodes.h:1251
ParseLoc location pg_node_attr(query_jumble_location)
Oid consttype
Definition: primnodes.h:312
Datum constvalue pg_node_attr(query_jumble_ignore)
bool constbyval pg_node_attr(query_jumble_ignore)
pg_node_attr(custom_copy_equal, custom_read_write) Expr xpr
bool constisnull pg_node_attr(query_jumble_ignore)
int constlen pg_node_attr(query_jumble_ignore)
int32 consttypmod pg_node_attr(query_jumble_ignore)
Oid constcollid pg_node_attr(query_jumble_ignore)
CoercionForm convertformat pg_node_attr(query_jumble_ignore)
char * cursor_name
Definition: primnodes.h:2070
pg_node_attr(abstract) NodeTag type
int32 resulttypmod pg_node_attr(query_jumble_ignore)
AttrNumber fieldnum
Definition: primnodes.h:1099
Oid resulttype pg_node_attr(query_jumble_ignore)
Expr * arg
Definition: primnodes.h:1098
Oid resultcollid pg_node_attr(query_jumble_ignore)
Oid resulttype pg_node_attr(query_jumble_ignore)
List *fieldnums pg_node_attr(query_jumble_ignore)
List * newvals
Definition: primnodes.h:1130
Expr * arg
Definition: primnodes.h:1129
Node * quals
Definition: primnodes.h:2281
NodeTag type
Definition: primnodes.h:2279
List * fromlist
Definition: primnodes.h:2280
bool funcvariadic pg_node_attr(query_jumble_ignore)
Oid inputcollid pg_node_attr(query_jumble_ignore)
Oid funccollid pg_node_attr(query_jumble_ignore)
Expr xpr
Definition: primnodes.h:718
bool funcretset pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:740
Oid funcid
Definition: primnodes.h:720
List * args
Definition: primnodes.h:738
CoercionForm funcformat pg_node_attr(query_jumble_ignore)
Oid funcresulttype pg_node_attr(query_jumble_ignore)
List *args pg_node_attr(query_jumble_ignore)
List *refs pg_node_attr(equal_ignore)
Index agglevelsup
Definition: primnodes.h:551
List *cols pg_node_attr(equal_ignore, query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:554
Node *viewQuery pg_node_attr(query_jumble_ignore)
List * colNames
Definition: primnodes.h:163
char * tableSpaceName
Definition: primnodes.h:167
bool skipData
Definition: primnodes.h:170
OnCommitAction onCommit
Definition: primnodes.h:166
NodeTag type
Definition: primnodes.h:160
List * options
Definition: primnodes.h:165
char * accessMethod
Definition: primnodes.h:164
RangeVar * rel
Definition: primnodes.h:162
Node * quals
Definition: primnodes.h:2261
List *usingClause pg_node_attr(query_jumble_ignore)
Alias *join_using_alias pg_node_attr(query_jumble_ignore)
Alias *alias pg_node_attr(query_jumble_ignore)
JoinType jointype
Definition: primnodes.h:2252
int rtindex
Definition: primnodes.h:2265
Node * larg
Definition: primnodes.h:2254
bool isNatural
Definition: primnodes.h:2253
NodeTag type
Definition: primnodes.h:2251
Node * rarg
Definition: primnodes.h:2255
Node * expr
Definition: primnodes.h:1757
ParseLoc location
Definition: primnodes.h:1759
JsonBehaviorType btype
Definition: primnodes.h:1756
NodeTag type
Definition: primnodes.h:1754
JsonReturning * returning
Definition: primnodes.h:1676
JsonConstructorType type
Definition: primnodes.h:1672
char * column_name
Definition: primnodes.h:1785
Node * formatted_expr
Definition: primnodes.h:1789
ParseLoc location
Definition: primnodes.h:1831
List * passing_values
Definition: primnodes.h:1802
JsonBehavior * on_empty
Definition: primnodes.h:1805
JsonFormat * format
Definition: primnodes.h:1792
Expr xpr
Definition: primnodes.h:1781
List * passing_names
Definition: primnodes.h:1801
Node * path_spec
Definition: primnodes.h:1795
bool use_io_coercion
Definition: primnodes.h:1818
Oid collation
Definition: primnodes.h:1828
JsonReturning * returning
Definition: primnodes.h:1798
bool use_json_coercion
Definition: primnodes.h:1819
JsonWrapper wrapper
Definition: primnodes.h:1822
JsonExprOp op
Definition: primnodes.h:1783
JsonBehavior * on_error
Definition: primnodes.h:1806
bool omit_quotes
Definition: primnodes.h:1825
Node * coercion_expr
Definition: primnodes.h:1817
ParseLoc location
Definition: primnodes.h:1623
NodeTag type
Definition: primnodes.h:1620
JsonEncoding encoding
Definition: primnodes.h:1622
JsonFormatType format_type
Definition: primnodes.h:1621
JsonFormat * format
Definition: primnodes.h:1702
JsonValueType item_type
Definition: primnodes.h:1703
ParseLoc location
Definition: primnodes.h:1705
JsonFormat * format
Definition: primnodes.h:1633
NodeTag type
Definition: primnodes.h:1632
JsonTablePath * path
Definition: primnodes.h:1870
JsonTablePlan * child
Definition: primnodes.h:1879
JsonTablePlan plan
Definition: primnodes.h:1867
NodeTag type
Definition: primnodes.h:1841
Const * value
Definition: primnodes.h:1843
pg_node_attr(abstract) NodeTag type
JsonTablePlan * rplan
Definition: primnodes.h:1900
JsonTablePlan * lplan
Definition: primnodes.h:1899
JsonTablePlan plan
Definition: primnodes.h:1897
Expr * formatted_expr
Definition: primnodes.h:1650
JsonFormat * format
Definition: primnodes.h:1651
NodeTag type
Definition: primnodes.h:1648
Expr * raw_expr
Definition: primnodes.h:1649
Definition: pg_list.h:54
List *updateColnos pg_node_attr(query_jumble_ignore)
OverridingKind override pg_node_attr(query_jumble_ignore)
NodeTag type
Definition: primnodes.h:1977
Node * qual
Definition: primnodes.h:1982
CmdType commandType
Definition: primnodes.h:1979
List * targetList
Definition: primnodes.h:1983
MergeMatchKind matchKind
Definition: primnodes.h:1978
ParseLoc location
Definition: primnodes.h:606
List * args
Definition: primnodes.h:1488
Oid minmaxcollid pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:1490
Oid inputcollid pg_node_attr(query_jumble_ignore)
Oid minmaxtype pg_node_attr(query_jumble_ignore)
MinMaxOp op
Definition: primnodes.h:1486
Expr * arg
Definition: primnodes.h:761
char *name pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:767
Definition: nodes.h:129
NullTestType nulltesttype
Definition: primnodes.h:1931
Expr xpr
Definition: primnodes.h:1929
bool argisrow pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:1934
Expr * arg
Definition: primnodes.h:1930
List * arbiterElems
Definition: primnodes.h:2299
OnConflictAction action
Definition: primnodes.h:2296
List * onConflictSet
Definition: primnodes.h:2305
List * exclRelTlist
Definition: primnodes.h:2308
NodeTag type
Definition: primnodes.h:2295
Node * onConflictWhere
Definition: primnodes.h:2306
Node * arbiterWhere
Definition: primnodes.h:2301
Oid opfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore)
Oid opcollid pg_node_attr(query_jumble_ignore)
Oid opresulttype pg_node_attr(query_jumble_ignore)
Oid inputcollid pg_node_attr(query_jumble_ignore)
bool opretset pg_node_attr(query_jumble_ignore)
Oid opno
Definition: primnodes.h:788
List * args
Definition: primnodes.h:806
ParseLoc location
Definition: primnodes.h:809
Expr xpr
Definition: primnodes.h:785
ParseLoc location
Definition: primnodes.h:384
Expr xpr
Definition: primnodes.h:375
int paramid
Definition: primnodes.h:377
Oid paramtype
Definition: primnodes.h:378
ParamKind paramkind
Definition: primnodes.h:376
int32 paramtypmod pg_node_attr(query_jumble_ignore)
Oid paramcollid pg_node_attr(query_jumble_ignore)
NodeTag type
Definition: primnodes.h:2217
char * relname
Definition: primnodes.h:82
bool inh
Definition: primnodes.h:85
Alias * alias
Definition: primnodes.h:91
char relpersistence
Definition: primnodes.h:88
char * catalogname
Definition: primnodes.h:76
ParseLoc location
Definition: primnodes.h:94
char * schemaname
Definition: primnodes.h:79
NodeTag type
Definition: primnodes.h:73
int32 resulttypmod pg_node_attr(query_jumble_ignore)
Oid resulttype
Definition: primnodes.h:1155
Oid resultcollid pg_node_attr(query_jumble_ignore)
CoercionForm relabelformat pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:1162
Expr * arg
Definition: primnodes.h:1154
List *inputcollids pg_node_attr(query_jumble_ignore)
RowCompareType rctype
Definition: primnodes.h:1438
List *opfamilies pg_node_attr(query_jumble_ignore)
List *opnos pg_node_attr(query_jumble_ignore)
Expr xpr
Definition: primnodes.h:1380
CoercionForm row_format pg_node_attr(query_jumble_ignore)
List * args
Definition: primnodes.h:1381
ParseLoc location
Definition: primnodes.h:1405
List *colnames pg_node_attr(query_jumble_ignore)
Oid row_typeid pg_node_attr(query_jumble_ignore)
Oid type pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:1534
SQLValueFunctionOp op
Definition: primnodes.h:1526
Oid hashfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore)
Oid negfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:889
Oid inputcollid pg_node_attr(query_jumble_ignore)
Oid opfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore)
int32 typeMod pg_node_attr(query_jumble_ignore)
Oid collation pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:2050
int plan_id
Definition: primnodes.h:1040
char * plan_name
Definition: primnodes.h:1042
List * args
Definition: primnodes.h:1061
List * paramIds
Definition: primnodes.h:1038
bool useHashTable
Definition: primnodes.h:1049
Node * testexpr
Definition: primnodes.h:1037
int32 firstColTypmod
Definition: primnodes.h:1045
pg_node_attr(no_query_jumble) Expr xpr
List * parParam
Definition: primnodes.h:1060
bool parallel_safe
Definition: primnodes.h:1054
List * setParam
Definition: primnodes.h:1058
bool unknownEqFalse
Definition: primnodes.h:1051
Cost startup_cost
Definition: primnodes.h:1063
Oid firstColCollation
Definition: primnodes.h:1046
Cost per_call_cost
Definition: primnodes.h:1064
SubLinkType subLinkType
Definition: primnodes.h:1035
Oid firstColType
Definition: primnodes.h:1044
Oid refelemtype pg_node_attr(query_jumble_ignore)
Oid refcollid pg_node_attr(query_jumble_ignore)
Oid refrestype pg_node_attr(query_jumble_ignore)
Oid refcontainertype pg_node_attr(query_jumble_ignore)
int32 reftypmod pg_node_attr(query_jumble_ignore)
Expr * refassgnexpr
Definition: primnodes.h:673
List * refupperindexpr
Definition: primnodes.h:663
Expr * refexpr
Definition: primnodes.h:671
List * reflowerindexpr
Definition: primnodes.h:669
List *colnames pg_node_attr(query_jumble_ignore)
List *colvalexprs pg_node_attr(query_jumble_ignore)
ParseLoc location
Definition: primnodes.h:145
List *coltypes pg_node_attr(query_jumble_ignore)
Node *plan pg_node_attr(query_jumble_ignore)
Bitmapset *notnulls pg_node_attr(query_jumble_ignore)
List *ns_names pg_node_attr(query_jumble_ignore)
List *coldefexprs pg_node_attr(query_jumble_ignore)
Node * docexpr
Definition: primnodes.h:119
List *colcollations pg_node_attr(query_jumble_ignore)
int ordinalitycol pg_node_attr(query_jumble_ignore)
NodeTag type
Definition: primnodes.h:111
List *passingvalexprs pg_node_attr(query_jumble_ignore)
List *coltypmods pg_node_attr(query_jumble_ignore)
Node * rowexpr
Definition: primnodes.h:121
List * colexprs
Definition: primnodes.h:131
TableFuncType functype
Definition: primnodes.h:113
List *ns_uris pg_node_attr(query_jumble_ignore)
char *resname pg_node_attr(query_jumble_ignore)
Expr * expr
Definition: primnodes.h:2162
AttrNumber resorigcol pg_node_attr(query_jumble_ignore)
bool resjunk pg_node_attr(query_jumble_ignore)
Oid resorigtbl pg_node_attr(query_jumble_ignore)
AttrNumber resno
Definition: primnodes.h:2164
Index ressortgroupref
Definition: primnodes.h:2168
Definition: primnodes.h:248
ParseLoc location
Definition: primnodes.h:293
AttrNumber varattno
Definition: primnodes.h:260
int32 vartypmod pg_node_attr(query_jumble_ignore)
Oid varcollid pg_node_attr(query_jumble_ignore)
Expr xpr
Definition: primnodes.h:249
int varno
Definition: primnodes.h:255
AttrNumber varattnosyn pg_node_attr(equal_ignore, query_jumble_ignore)
Index varlevelsup
Definition: primnodes.h:280
Bitmapset *varnullingrels pg_node_attr(query_jumble_ignore)
Oid vartype pg_node_attr(query_jumble_ignore)
Index varnosyn pg_node_attr(equal_ignore, query_jumble_ignore)
Expr xpr
Definition: primnodes.h:565
List * args
Definition: primnodes.h:575
Index winref
Definition: primnodes.h:579
bool winagg pg_node_attr(query_jumble_ignore)
Oid inputcollid pg_node_attr(query_jumble_ignore)
Expr * aggfilter
Definition: primnodes.h:577
ParseLoc location
Definition: primnodes.h:585
Oid wincollid pg_node_attr(query_jumble_ignore)
Oid wintype pg_node_attr(query_jumble_ignore)
bool winstar pg_node_attr(query_jumble_ignore)
Oid winfnoid
Definition: primnodes.h:567
List *arg_names pg_node_attr(query_jumble_ignore)
int32 typmod pg_node_attr(query_jumble_ignore)
List * args
Definition: primnodes.h:1578
Expr xpr
Definition: primnodes.h:1568
ParseLoc location
Definition: primnodes.h:1587
bool indent
Definition: primnodes.h:1582
XmlOptionType xmloption pg_node_attr(query_jumble_ignore)
char *name pg_node_attr(query_jumble_ignore)
List * named_args
Definition: primnodes.h:1574
XmlExprOp op
Definition: primnodes.h:1570
Oid type pg_node_attr(query_jumble_ignore)
const char * type
const char * name
int xmloption
Definition: xml.c:110