PostgreSQL Source Code  git master
parsenodes.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * parsenodes.h
4  * definitions for parse tree nodes
5  *
6  * Many of the node types used in parsetrees include a "location" field.
7  * This is a byte (not character) offset in the original source text, to be
8  * used for positioning an error cursor when there is an error related to
9  * the node. Access to the original source text is needed to make use of
10  * the location. At the topmost (statement) level, we also provide a
11  * statement length, likewise measured in bytes, for convenience in
12  * identifying statement boundaries in multi-statement source strings.
13  *
14  *
15  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
16  * Portions Copyright (c) 1994, Regents of the University of California
17  *
18  * src/include/nodes/parsenodes.h
19  *
20  *-------------------------------------------------------------------------
21  */
22 #ifndef PARSENODES_H
23 #define PARSENODES_H
24 
25 #include "common/relpath.h"
26 #include "nodes/bitmapset.h"
27 #include "nodes/lockoptions.h"
28 #include "nodes/primnodes.h"
29 #include "nodes/value.h"
30 #include "partitioning/partdefs.h"
31 
32 
33 /* Possible sources of a Query */
34 typedef enum QuerySource
35 {
36  QSRC_ORIGINAL, /* original parsetree (explicit query) */
37  QSRC_PARSER, /* added by parse analysis (now unused) */
38  QSRC_INSTEAD_RULE, /* added by unconditional INSTEAD rule */
39  QSRC_QUAL_INSTEAD_RULE, /* added by conditional INSTEAD rule */
40  QSRC_NON_INSTEAD_RULE, /* added by non-INSTEAD rule */
42 
43 /* Sort ordering options for ORDER BY and CREATE INDEX */
44 typedef enum SortByDir
45 {
49  SORTBY_USING, /* not allowed in CREATE INDEX ... */
51 
52 typedef enum SortByNulls
53 {
58 
59 /* Options for [ ALL | DISTINCT ] */
60 typedef enum SetQuantifier
61 {
66 
67 /*
68  * Grantable rights are encoded so that we can OR them together in a bitmask.
69  * The present representation of AclItem limits us to 32 distinct rights,
70  * even though AclMode is defined as uint64. See utils/acl.h.
71  *
72  * Caution: changing these codes breaks stored ACLs, hence forces initdb.
73  */
74 typedef uint64 AclMode; /* a bitmask of privilege bits */
75 
76 #define ACL_INSERT (1<<0) /* for relations */
77 #define ACL_SELECT (1<<1)
78 #define ACL_UPDATE (1<<2)
79 #define ACL_DELETE (1<<3)
80 #define ACL_TRUNCATE (1<<4)
81 #define ACL_REFERENCES (1<<5)
82 #define ACL_TRIGGER (1<<6)
83 #define ACL_EXECUTE (1<<7) /* for functions */
84 #define ACL_USAGE (1<<8) /* for various object types */
85 #define ACL_CREATE (1<<9) /* for namespaces and databases */
86 #define ACL_CREATE_TEMP (1<<10) /* for databases */
87 #define ACL_CONNECT (1<<11) /* for databases */
88 #define ACL_SET (1<<12) /* for configuration parameters */
89 #define ACL_ALTER_SYSTEM (1<<13) /* for configuration parameters */
90 #define ACL_MAINTAIN (1<<14) /* for relations */
91 #define N_ACL_RIGHTS 15 /* 1 plus the last 1<<x */
92 #define ACL_NO_RIGHTS 0
93 /* Currently, SELECT ... FOR [KEY] UPDATE/SHARE requires UPDATE privileges */
94 #define ACL_SELECT_FOR_UPDATE ACL_UPDATE
95 
96 
97 /*****************************************************************************
98  * Query Tree
99  *****************************************************************************/
100 
101 /*
102  * Query -
103  * Parse analysis turns all statements into a Query tree
104  * for further processing by the rewriter and planner.
105  *
106  * Utility statements (i.e. non-optimizable statements) have the
107  * utilityStmt field set, and the rest of the Query is mostly dummy.
108  *
109  * Planning converts a Query tree into a Plan tree headed by a PlannedStmt
110  * node --- the Query structure is not used by the executor.
111  *
112  * All the fields ignored for the query jumbling are not semantically
113  * significant (such as alias names), as is ignored anything that can
114  * be deduced from child nodes (else we'd just be double-hashing that
115  * piece of information).
116  */
117 typedef struct Query
118 {
120 
121  CmdType commandType; /* select|insert|update|delete|merge|utility */
122 
123  /* where did I come from? */
124  QuerySource querySource pg_node_attr(query_jumble_ignore);
125 
126  /*
127  * query identifier (can be set by plugins); ignored for equal, as it
128  * might not be set; also not stored. This is the result of the query
129  * jumble, hence ignored.
130  */
131  uint64 queryId pg_node_attr(equal_ignore, query_jumble_ignore, read_write_ignore, read_as(0));
132 
133  /* do I set the command result tag? */
134  bool canSetTag pg_node_attr(query_jumble_ignore);
135 
136  Node *utilityStmt; /* non-null if commandType == CMD_UTILITY */
137 
138  /*
139  * rtable index of target relation for INSERT/UPDATE/DELETE/MERGE; 0 for
140  * SELECT. This is ignored in the query jumble as unrelated to the
141  * compilation of the query ID.
142  */
143  int resultRelation pg_node_attr(query_jumble_ignore);
144 
145  /* has aggregates in tlist or havingQual */
146  bool hasAggs pg_node_attr(query_jumble_ignore);
147  /* has window functions in tlist */
148  bool hasWindowFuncs pg_node_attr(query_jumble_ignore);
149  /* has set-returning functions in tlist */
150  bool hasTargetSRFs pg_node_attr(query_jumble_ignore);
151  /* has subquery SubLink */
152  bool hasSubLinks pg_node_attr(query_jumble_ignore);
153  /* distinctClause is from DISTINCT ON */
154  bool hasDistinctOn pg_node_attr(query_jumble_ignore);
155  /* WITH RECURSIVE was specified */
156  bool hasRecursive pg_node_attr(query_jumble_ignore);
157  /* has INSERT/UPDATE/DELETE in WITH */
158  bool hasModifyingCTE pg_node_attr(query_jumble_ignore);
159  /* FOR [KEY] UPDATE/SHARE was specified */
160  bool hasForUpdate pg_node_attr(query_jumble_ignore);
161  /* rewriter has applied some RLS policy */
162  bool hasRowSecurity pg_node_attr(query_jumble_ignore);
163  /* is a RETURN statement */
164  bool isReturn pg_node_attr(query_jumble_ignore);
165 
166  List *cteList; /* WITH list (of CommonTableExpr's) */
167 
168  List *rtable; /* list of range table entries */
169 
170  /*
171  * list of RTEPermissionInfo nodes for the rtable entries having
172  * perminfoindex > 0
173  */
174  List *rteperminfos pg_node_attr(query_jumble_ignore);
175  FromExpr *jointree; /* table join tree (FROM and WHERE clauses);
176  * also USING clause for MERGE */
177 
178  List *mergeActionList; /* list of actions for MERGE (only) */
179  /* whether to use outer join */
180  bool mergeUseOuterJoin pg_node_attr(query_jumble_ignore);
181 
182  /*
183  * rtable index of target relation for MERGE to pull data. Initially, this
184  * is the same as resultRelation, but after query rewriting, if the target
185  * relation is a trigger-updatable view, this is the index of the expanded
186  * view subquery, whereas resultRelation is the index of the target view.
187  */
188  int mergeTargetRelation pg_node_attr(query_jumble_ignore);
189 
190  List *targetList; /* target list (of TargetEntry) */
191 
192  /* OVERRIDING clause */
193  OverridingKind override pg_node_attr(query_jumble_ignore);
194 
195  OnConflictExpr *onConflict; /* ON CONFLICT DO [NOTHING | UPDATE] */
196 
197  List *returningList; /* return-values list (of TargetEntry) */
198 
199  List *groupClause; /* a list of SortGroupClause's */
200  bool groupDistinct; /* is the group by clause distinct? */
201 
202  List *groupingSets; /* a list of GroupingSet's if present */
203 
204  Node *havingQual; /* qualifications applied to groups */
205 
206  List *windowClause; /* a list of WindowClause's */
207 
208  List *distinctClause; /* a list of SortGroupClause's */
209 
210  List *sortClause; /* a list of SortGroupClause's */
211 
212  Node *limitOffset; /* # of result tuples to skip (int8 expr) */
213  Node *limitCount; /* # of result tuples to return (int8 expr) */
214  LimitOption limitOption; /* limit type */
215 
216  List *rowMarks; /* a list of RowMarkClause's */
217 
218  Node *setOperations; /* set-operation tree if this is top level of
219  * a UNION/INTERSECT/EXCEPT query */
220 
221  /*
222  * A list of pg_constraint OIDs that the query depends on to be
223  * semantically valid
224  */
225  List *constraintDeps pg_node_attr(query_jumble_ignore);
226 
227  /* a list of WithCheckOption's (added during rewrite) */
228  List *withCheckOptions pg_node_attr(query_jumble_ignore);
229 
230  /*
231  * The following two fields identify the portion of the source text string
232  * containing this query. They are typically only populated in top-level
233  * Queries, not in sub-queries. When not set, they might both be zero, or
234  * both be -1 meaning "unknown".
235  */
236  /* start location, or -1 if unknown */
238  /* length in bytes; 0 means "rest of string" */
239  int stmt_len pg_node_attr(query_jumble_ignore);
241 
242 
243 /****************************************************************************
244  * Supporting data structures for Parse Trees
245  *
246  * Most of these node types appear in raw parsetrees output by the grammar,
247  * and get transformed to something else by the analyzer. A few of them
248  * are used as-is in transformed querytrees.
249  ****************************************************************************/
250 
251 /*
252  * TypeName - specifies a type in definitions
253  *
254  * For TypeName structures generated internally, it is often easier to
255  * specify the type by OID than by name. If "names" is NIL then the
256  * actual type OID is given by typeOid, otherwise typeOid is unused.
257  * Similarly, if "typmods" is NIL then the actual typmod is expected to
258  * be prespecified in typemod, otherwise typemod is unused.
259  *
260  * If pct_type is true, then names is actually a field name and we look up
261  * the type of that field. Otherwise (the normal case), names is a type
262  * name possibly qualified with schema and database name.
263  */
264 typedef struct TypeName
265 {
267  List *names; /* qualified name (list of String nodes) */
268  Oid typeOid; /* type identified by OID */
269  bool setof; /* is a set? */
270  bool pct_type; /* %TYPE specified? */
271  List *typmods; /* type modifier expression(s) */
272  int32 typemod; /* prespecified type modifier */
273  List *arrayBounds; /* array bounds */
274  int location; /* token location, or -1 if unknown */
276 
277 /*
278  * ColumnRef - specifies a reference to a column, or possibly a whole tuple
279  *
280  * The "fields" list must be nonempty. It can contain String nodes
281  * (representing names) and A_Star nodes (representing occurrence of a '*').
282  * Currently, A_Star must appear only as the last list element --- the grammar
283  * is responsible for enforcing this!
284  *
285  * Note: any container subscripting or selection of fields from composite columns
286  * is represented by an A_Indirection node above the ColumnRef. However,
287  * for simplicity in the normal case, initial field selection from a table
288  * name is represented within ColumnRef and not by adding A_Indirection.
289  */
290 typedef struct ColumnRef
291 {
293  List *fields; /* field names (String nodes) or A_Star */
294  int location; /* token location, or -1 if unknown */
296 
297 /*
298  * ParamRef - specifies a $n parameter reference
299  */
300 typedef struct ParamRef
301 {
303  int number; /* the number of the parameter */
304  int location; /* token location, or -1 if unknown */
306 
307 /*
308  * A_Expr - infix, prefix, and postfix expressions
309  */
310 typedef enum A_Expr_Kind
311 {
312  AEXPR_OP, /* normal operator */
313  AEXPR_OP_ANY, /* scalar op ANY (array) */
314  AEXPR_OP_ALL, /* scalar op ALL (array) */
315  AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */
316  AEXPR_NOT_DISTINCT, /* IS NOT DISTINCT FROM - name must be "=" */
317  AEXPR_NULLIF, /* NULLIF - name must be "=" */
318  AEXPR_IN, /* [NOT] IN - name must be "=" or "<>" */
319  AEXPR_LIKE, /* [NOT] LIKE - name must be "~~" or "!~~" */
320  AEXPR_ILIKE, /* [NOT] ILIKE - name must be "~~*" or "!~~*" */
321  AEXPR_SIMILAR, /* [NOT] SIMILAR - name must be "~" or "!~" */
322  AEXPR_BETWEEN, /* name must be "BETWEEN" */
323  AEXPR_NOT_BETWEEN, /* name must be "NOT BETWEEN" */
324  AEXPR_BETWEEN_SYM, /* name must be "BETWEEN SYMMETRIC" */
325  AEXPR_NOT_BETWEEN_SYM, /* name must be "NOT BETWEEN SYMMETRIC" */
327 
328 typedef struct A_Expr
329 {
330  pg_node_attr(custom_read_write)
331 
332  NodeTag type;
333  A_Expr_Kind kind; /* see above */
334  List *name; /* possibly-qualified name of operator */
335  Node *lexpr; /* left argument, or NULL if none */
336  Node *rexpr; /* right argument, or NULL if none */
337  int location; /* token location, or -1 if unknown */
339 
340 /*
341  * A_Const - a literal constant
342  *
343  * Value nodes are inline for performance. You can treat 'val' as a node,
344  * as in IsA(&val, Integer). 'val' is not valid if isnull is true.
345  */
346 union ValUnion
347 {
354 };
355 
356 typedef struct A_Const
357 {
358  pg_node_attr(custom_copy_equal, custom_read_write, custom_query_jumble)
359 
360  NodeTag type;
361  union ValUnion val;
362  bool isnull; /* SQL NULL constant */
363  int location; /* token location, or -1 if unknown */
365 
366 /*
367  * TypeCast - a CAST expression
368  */
369 typedef struct TypeCast
370 {
372  Node *arg; /* the expression being casted */
373  TypeName *typeName; /* the target type */
374  int location; /* token location, or -1 if unknown */
376 
377 /*
378  * CollateClause - a COLLATE expression
379  */
380 typedef struct CollateClause
381 {
383  Node *arg; /* input expression */
384  List *collname; /* possibly-qualified collation name */
385  int location; /* token location, or -1 if unknown */
387 
388 /*
389  * RoleSpec - a role name or one of a few special values.
390  */
391 typedef enum RoleSpecType
392 {
393  ROLESPEC_CSTRING, /* role name is stored as a C string */
394  ROLESPEC_CURRENT_ROLE, /* role spec is CURRENT_ROLE */
395  ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
396  ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
397  ROLESPEC_PUBLIC, /* role name is "public" */
399 
400 typedef struct RoleSpec
401 {
403  RoleSpecType roletype; /* Type of this rolespec */
404  char *rolename; /* filled only for ROLESPEC_CSTRING */
405  int location; /* token location, or -1 if unknown */
407 
408 /*
409  * FuncCall - a function or aggregate invocation
410  *
411  * agg_order (if not NIL) indicates we saw 'foo(... ORDER BY ...)', or if
412  * agg_within_group is true, it was 'foo(...) WITHIN GROUP (ORDER BY ...)'.
413  * agg_star indicates we saw a 'foo(*)' construct, while agg_distinct
414  * indicates we saw 'foo(DISTINCT ...)'. In any of these cases, the
415  * construct *must* be an aggregate call. Otherwise, it might be either an
416  * aggregate or some other kind of function. However, if FILTER or OVER is
417  * present it had better be an aggregate or window function.
418  *
419  * Normally, you'd initialize this via makeFuncCall() and then only change the
420  * parts of the struct its defaults don't match afterwards, as needed.
421  */
422 typedef struct FuncCall
423 {
425  List *funcname; /* qualified name of function */
426  List *args; /* the arguments (list of exprs) */
427  List *agg_order; /* ORDER BY (list of SortBy) */
428  Node *agg_filter; /* FILTER clause, if any */
429  struct WindowDef *over; /* OVER clause, if any */
430  bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */
431  bool agg_star; /* argument was really '*' */
432  bool agg_distinct; /* arguments were labeled DISTINCT */
433  bool func_variadic; /* last argument was labeled VARIADIC */
434  CoercionForm funcformat; /* how to display this node */
435  int location; /* token location, or -1 if unknown */
437 
438 /*
439  * A_Star - '*' representing all columns of a table or compound field
440  *
441  * This can appear within ColumnRef.fields, A_Indirection.indirection, and
442  * ResTarget.indirection lists.
443  */
444 typedef struct A_Star
445 {
448 
449 /*
450  * A_Indices - array subscript or slice bounds ([idx] or [lidx:uidx])
451  *
452  * In slice case, either or both of lidx and uidx can be NULL (omitted).
453  * In non-slice case, uidx holds the single subscript and lidx is always NULL.
454  */
455 typedef struct A_Indices
456 {
458  bool is_slice; /* true if slice (i.e., colon present) */
459  Node *lidx; /* slice lower bound, if any */
460  Node *uidx; /* subscript, or slice upper bound if any */
462 
463 /*
464  * A_Indirection - select a field and/or array element from an expression
465  *
466  * The indirection list can contain A_Indices nodes (representing
467  * subscripting), String nodes (representing field selection --- the
468  * string value is the name of the field to select), and A_Star nodes
469  * (representing selection of all fields of a composite type).
470  * For example, a complex selection operation like
471  * (foo).field1[42][7].field2
472  * would be represented with a single A_Indirection node having a 4-element
473  * indirection list.
474  *
475  * Currently, A_Star must appear only as the last list element --- the grammar
476  * is responsible for enforcing this!
477  */
478 typedef struct A_Indirection
479 {
481  Node *arg; /* the thing being selected from */
482  List *indirection; /* subscripts and/or field names and/or * */
484 
485 /*
486  * A_ArrayExpr - an ARRAY[] construct
487  */
488 typedef struct A_ArrayExpr
489 {
491  List *elements; /* array element expressions */
492  int location; /* token location, or -1 if unknown */
494 
495 /*
496  * ResTarget -
497  * result target (used in target list of pre-transformed parse trees)
498  *
499  * In a SELECT target list, 'name' is the column label from an
500  * 'AS ColumnLabel' clause, or NULL if there was none, and 'val' is the
501  * value expression itself. The 'indirection' field is not used.
502  *
503  * INSERT uses ResTarget in its target-column-names list. Here, 'name' is
504  * the name of the destination column, 'indirection' stores any subscripts
505  * attached to the destination, and 'val' is not used.
506  *
507  * In an UPDATE target list, 'name' is the name of the destination column,
508  * 'indirection' stores any subscripts attached to the destination, and
509  * 'val' is the expression to assign.
510  *
511  * See A_Indirection for more info about what can appear in 'indirection'.
512  */
513 typedef struct ResTarget
514 {
516  char *name; /* column name or NULL */
517  List *indirection; /* subscripts, field names, and '*', or NIL */
518  Node *val; /* the value expression to compute or assign */
519  int location; /* token location, or -1 if unknown */
521 
522 /*
523  * MultiAssignRef - element of a row source expression for UPDATE
524  *
525  * In an UPDATE target list, when we have SET (a,b,c) = row-valued-expression,
526  * we generate separate ResTarget items for each of a,b,c. Their "val" trees
527  * are MultiAssignRef nodes numbered 1..n, linking to a common copy of the
528  * row-valued-expression (which parse analysis will process only once, when
529  * handling the MultiAssignRef with colno=1).
530  */
531 typedef struct MultiAssignRef
532 {
534  Node *source; /* the row-valued expression */
535  int colno; /* column number for this target (1..n) */
536  int ncolumns; /* number of targets in the construct */
538 
539 /*
540  * SortBy - for ORDER BY clause
541  */
542 typedef struct SortBy
543 {
545  Node *node; /* expression to sort on */
546  SortByDir sortby_dir; /* ASC/DESC/USING/default */
547  SortByNulls sortby_nulls; /* NULLS FIRST/LAST */
548  List *useOp; /* name of op to use, if SORTBY_USING */
549  int location; /* operator location, or -1 if none/unknown */
551 
552 /*
553  * WindowDef - raw representation of WINDOW and OVER clauses
554  *
555  * For entries in a WINDOW list, "name" is the window name being defined.
556  * For OVER clauses, we use "name" for the "OVER window" syntax, or "refname"
557  * for the "OVER (window)" syntax, which is subtly different --- the latter
558  * implies overriding the window frame clause.
559  */
560 typedef struct WindowDef
561 {
563  char *name; /* window's own name */
564  char *refname; /* referenced window name, if any */
565  List *partitionClause; /* PARTITION BY expression list */
566  List *orderClause; /* ORDER BY (list of SortBy) */
567  int frameOptions; /* frame_clause options, see below */
568  Node *startOffset; /* expression for starting bound, if any */
569  Node *endOffset; /* expression for ending bound, if any */
570  int location; /* parse location, or -1 if none/unknown */
572 
573 /*
574  * frameOptions is an OR of these bits. The NONDEFAULT and BETWEEN bits are
575  * used so that ruleutils.c can tell which properties were specified and
576  * which were defaulted; the correct behavioral bits must be set either way.
577  * The START_foo and END_foo options must come in pairs of adjacent bits for
578  * the convenience of gram.y, even though some of them are useless/invalid.
579  */
580 #define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */
581 #define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */
582 #define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */
583 #define FRAMEOPTION_GROUPS 0x00008 /* GROUPS behavior */
584 #define FRAMEOPTION_BETWEEN 0x00010 /* BETWEEN given? */
585 #define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00020 /* start is U. P. */
586 #define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00040 /* (disallowed) */
587 #define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00080 /* (disallowed) */
588 #define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00100 /* end is U. F. */
589 #define FRAMEOPTION_START_CURRENT_ROW 0x00200 /* start is C. R. */
590 #define FRAMEOPTION_END_CURRENT_ROW 0x00400 /* end is C. R. */
591 #define FRAMEOPTION_START_OFFSET_PRECEDING 0x00800 /* start is O. P. */
592 #define FRAMEOPTION_END_OFFSET_PRECEDING 0x01000 /* end is O. P. */
593 #define FRAMEOPTION_START_OFFSET_FOLLOWING 0x02000 /* start is O. F. */
594 #define FRAMEOPTION_END_OFFSET_FOLLOWING 0x04000 /* end is O. F. */
595 #define FRAMEOPTION_EXCLUDE_CURRENT_ROW 0x08000 /* omit C.R. */
596 #define FRAMEOPTION_EXCLUDE_GROUP 0x10000 /* omit C.R. & peers */
597 #define FRAMEOPTION_EXCLUDE_TIES 0x20000 /* omit C.R.'s peers */
598 
599 #define FRAMEOPTION_START_OFFSET \
600  (FRAMEOPTION_START_OFFSET_PRECEDING | FRAMEOPTION_START_OFFSET_FOLLOWING)
601 #define FRAMEOPTION_END_OFFSET \
602  (FRAMEOPTION_END_OFFSET_PRECEDING | FRAMEOPTION_END_OFFSET_FOLLOWING)
603 #define FRAMEOPTION_EXCLUSION \
604  (FRAMEOPTION_EXCLUDE_CURRENT_ROW | FRAMEOPTION_EXCLUDE_GROUP | \
605  FRAMEOPTION_EXCLUDE_TIES)
606 
607 #define FRAMEOPTION_DEFAULTS \
608  (FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \
609  FRAMEOPTION_END_CURRENT_ROW)
610 
611 /*
612  * RangeSubselect - subquery appearing in a FROM clause
613  */
614 typedef struct RangeSubselect
615 {
617  bool lateral; /* does it have LATERAL prefix? */
618  Node *subquery; /* the untransformed sub-select clause */
619  Alias *alias; /* table alias & optional column aliases */
621 
622 /*
623  * RangeFunction - function call appearing in a FROM clause
624  *
625  * functions is a List because we use this to represent the construct
626  * ROWS FROM(func1(...), func2(...), ...). Each element of this list is a
627  * two-element sublist, the first element being the untransformed function
628  * call tree, and the second element being a possibly-empty list of ColumnDef
629  * nodes representing any columndef list attached to that function within the
630  * ROWS FROM() syntax.
631  *
632  * alias and coldeflist represent any alias and/or columndef list attached
633  * at the top level. (We disallow coldeflist appearing both here and
634  * per-function, but that's checked in parse analysis, not by the grammar.)
635  */
636 typedef struct RangeFunction
637 {
639  bool lateral; /* does it have LATERAL prefix? */
640  bool ordinality; /* does it have WITH ORDINALITY suffix? */
641  bool is_rowsfrom; /* is result of ROWS FROM() syntax? */
642  List *functions; /* per-function information, see above */
643  Alias *alias; /* table alias & optional column aliases */
644  List *coldeflist; /* list of ColumnDef nodes to describe result
645  * of function returning RECORD */
647 
648 /*
649  * RangeTableFunc - raw form of "table functions" such as XMLTABLE
650  */
651 typedef struct RangeTableFunc
652 {
654  bool lateral; /* does it have LATERAL prefix? */
655  Node *docexpr; /* document expression */
656  Node *rowexpr; /* row generator expression */
657  List *namespaces; /* list of namespaces as ResTarget */
658  List *columns; /* list of RangeTableFuncCol */
659  Alias *alias; /* table alias & optional column aliases */
660  int location; /* token location, or -1 if unknown */
662 
663 /*
664  * RangeTableFuncCol - one column in a RangeTableFunc->columns
665  *
666  * If for_ordinality is true (FOR ORDINALITY), then the column is an int4
667  * column and the rest of the fields are ignored.
668  */
669 typedef struct RangeTableFuncCol
670 {
672  char *colname; /* name of generated column */
673  TypeName *typeName; /* type of generated column */
674  bool for_ordinality; /* does it have FOR ORDINALITY? */
675  bool is_not_null; /* does it have NOT NULL? */
676  Node *colexpr; /* column filter expression */
677  Node *coldefexpr; /* column default value expression */
678  int location; /* token location, or -1 if unknown */
680 
681 /*
682  * RangeTableSample - TABLESAMPLE appearing in a raw FROM clause
683  *
684  * This node, appearing only in raw parse trees, represents
685  * <relation> TABLESAMPLE <method> (<params>) REPEATABLE (<num>)
686  * Currently, the <relation> can only be a RangeVar, but we might in future
687  * allow RangeSubselect and other options. Note that the RangeTableSample
688  * is wrapped around the node representing the <relation>, rather than being
689  * a subfield of it.
690  */
691 typedef struct RangeTableSample
692 {
694  Node *relation; /* relation to be sampled */
695  List *method; /* sampling method name (possibly qualified) */
696  List *args; /* argument(s) for sampling method */
697  Node *repeatable; /* REPEATABLE expression, or NULL if none */
698  int location; /* method name location, or -1 if unknown */
700 
701 /*
702  * ColumnDef - column definition (used in various creates)
703  *
704  * If the column has a default value, we may have the value expression
705  * in either "raw" form (an untransformed parse tree) or "cooked" form
706  * (a post-parse-analysis, executable expression tree), depending on
707  * how this ColumnDef node was created (by parsing, or by inheritance
708  * from an existing relation). We should never have both in the same node!
709  *
710  * Similarly, we may have a COLLATE specification in either raw form
711  * (represented as a CollateClause with arg==NULL) or cooked form
712  * (the collation's OID).
713  *
714  * The constraints list may contain a CONSTR_DEFAULT item in a raw
715  * parsetree produced by gram.y, but transformCreateStmt will remove
716  * the item and set raw_default instead. CONSTR_DEFAULT items
717  * should not appear in any subsequent processing.
718  */
719 typedef struct ColumnDef
720 {
722  char *colname; /* name of column */
723  TypeName *typeName; /* type of column */
724  char *compression; /* compression method for column */
725  int inhcount; /* number of times column is inherited */
726  bool is_local; /* column has local (non-inherited) def'n */
727  bool is_not_null; /* NOT NULL constraint specified? */
728  bool is_from_type; /* column definition came from table type */
729  char storage; /* attstorage setting, or 0 for default */
730  char *storage_name; /* attstorage setting name or NULL for default */
731  Node *raw_default; /* default value (untransformed parse tree) */
732  Node *cooked_default; /* default value (transformed expr tree) */
733  char identity; /* attidentity setting */
734  RangeVar *identitySequence; /* to store identity sequence name for
735  * ALTER TABLE ... ADD COLUMN */
736  char generated; /* attgenerated setting */
737  CollateClause *collClause; /* untransformed COLLATE spec, if any */
738  Oid collOid; /* collation OID (InvalidOid if not set) */
739  List *constraints; /* other constraints on column */
740  List *fdwoptions; /* per-column FDW options */
741  int location; /* parse location, or -1 if none/unknown */
743 
744 /*
745  * TableLikeClause - CREATE TABLE ( ... LIKE ... ) clause
746  */
747 typedef struct TableLikeClause
748 {
751  bits32 options; /* OR of TableLikeOption flags */
752  Oid relationOid; /* If table has been looked up, its OID */
754 
755 typedef enum TableLikeOption
756 {
768 
769 /*
770  * IndexElem - index parameters (used in CREATE INDEX, and in ON CONFLICT)
771  *
772  * For a plain index attribute, 'name' is the name of the table column to
773  * index, and 'expr' is NULL. For an index expression, 'name' is NULL and
774  * 'expr' is the expression tree.
775  */
776 typedef struct IndexElem
777 {
779  char *name; /* name of attribute to index, or NULL */
780  Node *expr; /* expression to index, or NULL */
781  char *indexcolname; /* name for index column; NULL = default */
782  List *collation; /* name of collation; NIL = default */
783  List *opclass; /* name of desired opclass; NIL = default */
784  List *opclassopts; /* opclass-specific options, or NIL */
785  SortByDir ordering; /* ASC/DESC/default */
786  SortByNulls nulls_ordering; /* FIRST/LAST/default */
788 
789 /*
790  * DefElem - a generic "name = value" option definition
791  *
792  * In some contexts the name can be qualified. Also, certain SQL commands
793  * allow a SET/ADD/DROP action to be attached to option settings, so it's
794  * convenient to carry a field for that too. (Note: currently, it is our
795  * practice that the grammar allows namespace and action only in statements
796  * where they are relevant; C code can just ignore those fields in other
797  * statements.)
798  */
799 typedef enum DefElemAction
800 {
801  DEFELEM_UNSPEC, /* no action given */
806 
807 typedef struct DefElem
808 {
810  char *defnamespace; /* NULL if unqualified name */
811  char *defname;
812  Node *arg; /* typically Integer, Float, String, or
813  * TypeName */
814  DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */
815  int location; /* token location, or -1 if unknown */
817 
818 /*
819  * LockingClause - raw representation of FOR [NO KEY] UPDATE/[KEY] SHARE
820  * options
821  *
822  * Note: lockedRels == NIL means "all relations in query". Otherwise it
823  * is a list of RangeVar nodes. (We use RangeVar mainly because it carries
824  * a location field --- currently, parse analysis insists on unqualified
825  * names in LockingClause.)
826  */
827 typedef struct LockingClause
828 {
830  List *lockedRels; /* FOR [KEY] UPDATE/SHARE relations */
832  LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
834 
835 /*
836  * XMLSERIALIZE (in raw parse tree only)
837  */
838 typedef struct XmlSerialize
839 {
841  XmlOptionType xmloption; /* DOCUMENT or CONTENT */
844  bool indent; /* [NO] INDENT */
845  int location; /* token location, or -1 if unknown */
847 
848 /* Partitioning related definitions */
849 
850 /*
851  * PartitionElem - parse-time representation of a single partition key
852  *
853  * expr can be either a raw expression tree or a parse-analyzed expression.
854  * We don't store these on-disk, though.
855  */
856 typedef struct PartitionElem
857 {
859  char *name; /* name of column to partition on, or NULL */
860  Node *expr; /* expression to partition on, or NULL */
861  List *collation; /* name of collation; NIL = default */
862  List *opclass; /* name of desired opclass; NIL = default */
863  int location; /* token location, or -1 if unknown */
865 
866 typedef enum PartitionStrategy
867 {
872 
873 /*
874  * PartitionSpec - parse-time representation of a partition key specification
875  *
876  * This represents the key space we will be partitioning on.
877  */
878 typedef struct PartitionSpec
879 {
882  List *partParams; /* List of PartitionElems */
883  int location; /* token location, or -1 if unknown */
885 
886 /*
887  * PartitionBoundSpec - a partition bound specification
888  *
889  * This represents the portion of the partition key space assigned to a
890  * particular partition. These are stored on disk in pg_class.relpartbound.
891  */
893 {
895 
896  char strategy; /* see PARTITION_STRATEGY codes above */
897  bool is_default; /* is it a default partition bound? */
898 
899  /* Partitioning info for HASH strategy: */
900  int modulus;
902 
903  /* Partitioning info for LIST strategy: */
904  List *listdatums; /* List of Consts (or A_Consts in raw tree) */
905 
906  /* Partitioning info for RANGE strategy: */
907  List *lowerdatums; /* List of PartitionRangeDatums */
908  List *upperdatums; /* List of PartitionRangeDatums */
909 
910  int location; /* token location, or -1 if unknown */
911 };
912 
913 /*
914  * PartitionRangeDatum - one of the values in a range partition bound
915  *
916  * This can be MINVALUE, MAXVALUE or a specific bounded value.
917  */
919 {
920  PARTITION_RANGE_DATUM_MINVALUE = -1, /* less than any other value */
921  PARTITION_RANGE_DATUM_VALUE = 0, /* a specific (bounded) value */
922  PARTITION_RANGE_DATUM_MAXVALUE = 1, /* greater than any other value */
924 
925 typedef struct PartitionRangeDatum
926 {
928 
930  Node *value; /* Const (or A_Const in raw tree), if kind is
931  * PARTITION_RANGE_DATUM_VALUE, else NULL */
932 
933  int location; /* token location, or -1 if unknown */
935 
936 /*
937  * PartitionCmd - info for ALTER TABLE/INDEX ATTACH/DETACH PARTITION commands
938  */
939 typedef struct PartitionCmd
940 {
942  RangeVar *name; /* name of partition to attach/detach */
943  PartitionBoundSpec *bound; /* FOR VALUES, if attaching */
946 
947 /****************************************************************************
948  * Nodes for a Query tree
949  ****************************************************************************/
950 
951 /*--------------------
952  * RangeTblEntry -
953  * A range table is a List of RangeTblEntry nodes.
954  *
955  * A range table entry may represent a plain relation, a sub-select in
956  * FROM, or the result of a JOIN clause. (Only explicit JOIN syntax
957  * produces an RTE, not the implicit join resulting from multiple FROM
958  * items. This is because we only need the RTE to deal with SQL features
959  * like outer joins and join-output-column aliasing.) Other special
960  * RTE types also exist, as indicated by RTEKind.
961  *
962  * Note that we consider RTE_RELATION to cover anything that has a pg_class
963  * entry. relkind distinguishes the sub-cases.
964  *
965  * alias is an Alias node representing the AS alias-clause attached to the
966  * FROM expression, or NULL if no clause.
967  *
968  * eref is the table reference name and column reference names (either
969  * real or aliases). Note that system columns (OID etc) are not included
970  * in the column list.
971  * eref->aliasname is required to be present, and should generally be used
972  * to identify the RTE for error messages etc.
973  *
974  * In RELATION RTEs, the colnames in both alias and eref are indexed by
975  * physical attribute number; this means there must be colname entries for
976  * dropped columns. When building an RTE we insert empty strings ("") for
977  * dropped columns. Note however that a stored rule may have nonempty
978  * colnames for columns dropped since the rule was created (and for that
979  * matter the colnames might be out of date due to column renamings).
980  * The same comments apply to FUNCTION RTEs when a function's return type
981  * is a named composite type.
982  *
983  * In JOIN RTEs, the colnames in both alias and eref are one-to-one with
984  * joinaliasvars entries. A JOIN RTE will omit columns of its inputs when
985  * those columns are known to be dropped at parse time. Again, however,
986  * a stored rule might contain entries for columns dropped since the rule
987  * was created. (This is only possible for columns not actually referenced
988  * in the rule.) When loading a stored rule, we replace the joinaliasvars
989  * items for any such columns with null pointers. (We can't simply delete
990  * them from the joinaliasvars list, because that would affect the attnums
991  * of Vars referencing the rest of the list.)
992  *
993  * inFromCl marks those range variables that are listed in the FROM clause.
994  * It's false for RTEs that are added to a query behind the scenes, such
995  * as the NEW and OLD variables for a rule, or the subqueries of a UNION.
996  * This flag is not used during parsing (except in transformLockingClause,
997  * q.v.); the parser now uses a separate "namespace" data structure to
998  * control visibility. But it is needed by ruleutils.c to determine
999  * whether RTEs should be shown in decompiled queries.
1000  *
1001  * securityQuals is a list of security barrier quals (boolean expressions),
1002  * to be tested in the listed order before returning a row from the
1003  * relation. It is always NIL in parser output. Entries are added by the
1004  * rewriter to implement security-barrier views and/or row-level security.
1005  * Note that the planner turns each boolean expression into an implicitly
1006  * AND'ed sublist, as is its usual habit with qualification expressions.
1007  *--------------------
1008  */
1009 typedef enum RTEKind
1010 {
1011  RTE_RELATION, /* ordinary relation reference */
1012  RTE_SUBQUERY, /* subquery in FROM */
1013  RTE_JOIN, /* join */
1014  RTE_FUNCTION, /* function in FROM */
1015  RTE_TABLEFUNC, /* TableFunc(.., column list) */
1016  RTE_VALUES, /* VALUES (<exprlist>), (<exprlist>), ... */
1017  RTE_CTE, /* common table expr (WITH list element) */
1018  RTE_NAMEDTUPLESTORE, /* tuplestore, e.g. for AFTER triggers */
1019  RTE_RESULT, /* RTE represents an empty FROM clause; such
1020  * RTEs are added by the planner, they're not
1021  * present during parsing or rewriting */
1023 
1024 typedef struct RangeTblEntry
1025 {
1026  pg_node_attr(custom_read_write, custom_query_jumble)
1027 
1028  NodeTag type;
1029 
1030  RTEKind rtekind; /* see above */
1031 
1032  /*
1033  * XXX the fields applicable to only some rte kinds should be merged into
1034  * a union. I didn't do this yet because the diffs would impact a lot of
1035  * code that is being actively worked on. FIXME someday.
1036  */
1037 
1038  /*
1039  * Fields valid for a plain relation RTE (else zero):
1040  *
1041  * inh is true for relation references that should be expanded to include
1042  * inheritance children, if the rel has any. In the parser, this will
1043  * only be true for RTE_RELATION entries. The planner also uses this
1044  * field to mark RTE_SUBQUERY entries that contain UNION ALL queries that
1045  * it has flattened into pulled-up subqueries (creating a structure much
1046  * like the effects of inheritance).
1047  *
1048  * rellockmode is really LOCKMODE, but it's declared int to avoid having
1049  * to include lock-related headers here. It must be RowExclusiveLock if
1050  * the RTE is an INSERT/UPDATE/DELETE/MERGE target, else RowShareLock if
1051  * the RTE is a SELECT FOR UPDATE/FOR SHARE target, else AccessShareLock.
1052  *
1053  * Note: in some cases, rule expansion may result in RTEs that are marked
1054  * with RowExclusiveLock even though they are not the target of the
1055  * current query; this happens if a DO ALSO rule simply scans the original
1056  * target table. We leave such RTEs with their original lockmode so as to
1057  * avoid getting an additional, lesser lock.
1058  *
1059  * perminfoindex is 1-based index of the RTEPermissionInfo belonging to
1060  * this RTE in the containing struct's list of same; 0 if permissions need
1061  * not be checked for this RTE.
1062  *
1063  * As a special case, relid, relkind, rellockmode, and perminfoindex can
1064  * also be set (nonzero) in an RTE_SUBQUERY RTE. This occurs when we
1065  * convert an RTE_RELATION RTE naming a view into an RTE_SUBQUERY
1066  * containing the view's query. We still need to perform run-time locking
1067  * and permission checks on the view, even though it's not directly used
1068  * in the query anymore, and the most expedient way to do that is to
1069  * retain these fields from the old state of the RTE.
1070  *
1071  * As a special case, RTE_NAMEDTUPLESTORE can also set relid to indicate
1072  * that the tuple format of the tuplestore is the same as the referenced
1073  * relation. This allows plans referencing AFTER trigger transition
1074  * tables to be invalidated if the underlying table is altered.
1075  */
1076  Oid relid; /* OID of the relation */
1077  bool inh; /* inheritance requested? */
1078  char relkind; /* relation kind (see pg_class.relkind) */
1079  int rellockmode; /* lock level that query requires on the rel */
1080  Index perminfoindex; /* index of RTEPermissionInfo entry, or 0 */
1081  struct TableSampleClause *tablesample; /* sampling info, or NULL */
1082 
1083  /*
1084  * Fields valid for a subquery RTE (else NULL):
1085  */
1086  Query *subquery; /* the sub-query */
1087  bool security_barrier; /* is from security_barrier view? */
1088 
1089  /*
1090  * Fields valid for a join RTE (else NULL/zero):
1091  *
1092  * joinaliasvars is a list of (usually) Vars corresponding to the columns
1093  * of the join result. An alias Var referencing column K of the join
1094  * result can be replaced by the K'th element of joinaliasvars --- but to
1095  * simplify the task of reverse-listing aliases correctly, we do not do
1096  * that until planning time. In detail: an element of joinaliasvars can
1097  * be a Var of one of the join's input relations, or such a Var with an
1098  * implicit coercion to the join's output column type, or a COALESCE
1099  * expression containing the two input column Vars (possibly coerced).
1100  * Elements beyond the first joinmergedcols entries are always just Vars,
1101  * and are never referenced from elsewhere in the query (that is, join
1102  * alias Vars are generated only for merged columns). We keep these
1103  * entries only because they're needed in expandRTE() and similar code.
1104  *
1105  * Vars appearing within joinaliasvars are marked with varnullingrels sets
1106  * that describe the nulling effects of this join and lower ones. This is
1107  * essential for FULL JOIN cases, because the COALESCE expression only
1108  * describes the semantics correctly if its inputs have been nulled by the
1109  * join. For other cases, it allows expandRTE() to generate a valid
1110  * representation of the join's output without consulting additional
1111  * parser state.
1112  *
1113  * Within a Query loaded from a stored rule, it is possible for non-merged
1114  * joinaliasvars items to be null pointers, which are placeholders for
1115  * (necessarily unreferenced) columns dropped since the rule was made.
1116  * Also, once planning begins, joinaliasvars items can be almost anything,
1117  * as a result of subquery-flattening substitutions.
1118  *
1119  * joinleftcols is an integer list of physical column numbers of the left
1120  * join input rel that are included in the join; likewise joinrighttcols
1121  * for the right join input rel. (Which rels those are can be determined
1122  * from the associated JoinExpr.) If the join is USING/NATURAL, then the
1123  * first joinmergedcols entries in each list identify the merged columns.
1124  * The merged columns come first in the join output, then remaining
1125  * columns of the left input, then remaining columns of the right.
1126  *
1127  * Note that input columns could have been dropped after creation of a
1128  * stored rule, if they are not referenced in the query (in particular,
1129  * merged columns could not be dropped); this is not accounted for in
1130  * joinleftcols/joinrighttcols.
1131  */
1132  JoinType jointype; /* type of join */
1133  int joinmergedcols; /* number of merged (JOIN USING) columns */
1134  List *joinaliasvars; /* list of alias-var expansions */
1135  List *joinleftcols; /* left-side input column numbers */
1136  List *joinrightcols; /* right-side input column numbers */
1137 
1138  /*
1139  * join_using_alias is an alias clause attached directly to JOIN/USING. It
1140  * is different from the alias field (below) in that it does not hide the
1141  * range variables of the tables being joined.
1142  */
1144 
1145  /*
1146  * Fields valid for a function RTE (else NIL/zero):
1147  *
1148  * When funcordinality is true, the eref->colnames list includes an alias
1149  * for the ordinality column. The ordinality column is otherwise
1150  * implicit, and must be accounted for "by hand" in places such as
1151  * expandRTE().
1152  */
1153  List *functions; /* list of RangeTblFunction nodes */
1154  bool funcordinality; /* is this called WITH ORDINALITY? */
1155 
1156  /*
1157  * Fields valid for a TableFunc RTE (else NULL):
1158  */
1160 
1161  /*
1162  * Fields valid for a values RTE (else NIL):
1163  */
1164  List *values_lists; /* list of expression lists */
1165 
1166  /*
1167  * Fields valid for a CTE RTE (else NULL/zero):
1168  */
1169  char *ctename; /* name of the WITH list item */
1170  Index ctelevelsup; /* number of query levels up */
1171  bool self_reference; /* is this a recursive self-reference? */
1172 
1173  /*
1174  * Fields valid for CTE, VALUES, ENR, and TableFunc RTEs (else NIL):
1175  *
1176  * We need these for CTE RTEs so that the types of self-referential
1177  * columns are well-defined. For VALUES RTEs, storing these explicitly
1178  * saves having to re-determine the info by scanning the values_lists. For
1179  * ENRs, we store the types explicitly here (we could get the information
1180  * from the catalogs if 'relid' was supplied, but we'd still need these
1181  * for TupleDesc-based ENRs, so we might as well always store the type
1182  * info here). For TableFuncs, these fields are redundant with data in
1183  * the TableFunc node, but keeping them here allows some code sharing with
1184  * the other cases.
1185  *
1186  * For ENRs only, we have to consider the possibility of dropped columns.
1187  * A dropped column is included in these lists, but it will have zeroes in
1188  * all three lists (as well as an empty-string entry in eref). Testing
1189  * for zero coltype is the standard way to detect a dropped column.
1190  */
1191  List *coltypes; /* OID list of column type OIDs */
1192  List *coltypmods; /* integer list of column typmods */
1193  List *colcollations; /* OID list of column collation OIDs */
1194 
1195  /*
1196  * Fields valid for ENR RTEs (else NULL/zero):
1197  */
1198  char *enrname; /* name of ephemeral named relation */
1199  Cardinality enrtuples; /* estimated or actual from caller */
1200 
1201  /*
1202  * Fields valid in all RTEs:
1203  */
1204  Alias *alias; /* user-written alias clause, if any */
1205  Alias *eref; /* expanded reference names */
1206  bool lateral; /* subquery, function, or values is LATERAL? */
1207  bool inFromCl; /* present in FROM clause? */
1208  List *securityQuals; /* security barrier quals to apply, if any */
1210 
1211 /*
1212  * RTEPermissionInfo
1213  * Per-relation information for permission checking. Added to the Query
1214  * node by the parser when adding the corresponding RTE to the query
1215  * range table and subsequently editorialized on by the rewriter if
1216  * needed after rule expansion.
1217  *
1218  * Only the relations directly mentioned in the query are checked for
1219  * access permissions by the core executor, so only their RTEPermissionInfos
1220  * are present in the Query. However, extensions may want to check inheritance
1221  * children too, depending on the value of rte->inh, so it's copied in 'inh'
1222  * for their perusal.
1223  *
1224  * requiredPerms and checkAsUser specify run-time access permissions checks
1225  * to be performed at query startup. The user must have *all* of the
1226  * permissions that are OR'd together in requiredPerms (never 0!). If
1227  * checkAsUser is not zero, then do the permissions checks using the access
1228  * rights of that user, not the current effective user ID. (This allows rules
1229  * to act as setuid gateways.)
1230  *
1231  * For SELECT/INSERT/UPDATE permissions, if the user doesn't have table-wide
1232  * permissions then it is sufficient to have the permissions on all columns
1233  * identified in selectedCols (for SELECT) and/or insertedCols and/or
1234  * updatedCols (INSERT with ON CONFLICT DO UPDATE may have all 3).
1235  * selectedCols, insertedCols and updatedCols are bitmapsets, which cannot have
1236  * negative integer members, so we subtract FirstLowInvalidHeapAttributeNumber
1237  * from column numbers before storing them in these fields. A whole-row Var
1238  * reference is represented by setting the bit for InvalidAttrNumber.
1239  *
1240  * updatedCols is also used in some other places, for example, to determine
1241  * which triggers to fire and in FDWs to know which changed columns they need
1242  * to ship off.
1243  */
1244 typedef struct RTEPermissionInfo
1245 {
1247 
1248  Oid relid; /* relation OID */
1249  bool inh; /* separately check inheritance children? */
1250  AclMode requiredPerms; /* bitmask of required access permissions */
1251  Oid checkAsUser; /* if valid, check access as this role */
1252  Bitmapset *selectedCols; /* columns needing SELECT permission */
1253  Bitmapset *insertedCols; /* columns needing INSERT permission */
1254  Bitmapset *updatedCols; /* columns needing UPDATE permission */
1256 
1257 /*
1258  * RangeTblFunction -
1259  * RangeTblEntry subsidiary data for one function in a FUNCTION RTE.
1260  *
1261  * If the function had a column definition list (required for an
1262  * otherwise-unspecified RECORD result), funccolnames lists the names given
1263  * in the definition list, funccoltypes lists their declared column types,
1264  * funccoltypmods lists their typmods, funccolcollations their collations.
1265  * Otherwise, those fields are NIL.
1266  *
1267  * Notice we don't attempt to store info about the results of functions
1268  * returning named composite types, because those can change from time to
1269  * time. We do however remember how many columns we thought the type had
1270  * (including dropped columns!), so that we can successfully ignore any
1271  * columns added after the query was parsed.
1272  *
1273  * The query jumbling only needs to track the function expression.
1274  */
1275 typedef struct RangeTblFunction
1276 {
1278 
1279  Node *funcexpr; /* expression tree for func call */
1280  /* number of columns it contributes to RTE */
1281  int funccolcount pg_node_attr(query_jumble_ignore);
1282  /* These fields record the contents of a column definition list, if any: */
1283  /* column names (list of String) */
1284  List *funccolnames pg_node_attr(query_jumble_ignore);
1285  /* OID list of column type OIDs */
1286  List *funccoltypes pg_node_attr(query_jumble_ignore);
1287  /* integer list of column typmods */
1288  List *funccoltypmods pg_node_attr(query_jumble_ignore);
1289  /* OID list of column collation OIDs */
1290  List *funccolcollations pg_node_attr(query_jumble_ignore);
1291 
1292  /* This is set during planning for use by the executor: */
1293  /* PARAM_EXEC Param IDs affecting this func */
1294  Bitmapset *funcparams pg_node_attr(query_jumble_ignore);
1296 
1297 /*
1298  * TableSampleClause - TABLESAMPLE appearing in a transformed FROM clause
1299  *
1300  * Unlike RangeTableSample, this is a subnode of the relevant RangeTblEntry.
1301  */
1302 typedef struct TableSampleClause
1303 {
1305  Oid tsmhandler; /* OID of the tablesample handler function */
1306  List *args; /* tablesample argument expression(s) */
1307  Expr *repeatable; /* REPEATABLE expression, or NULL if none */
1309 
1310 /*
1311  * WithCheckOption -
1312  * representation of WITH CHECK OPTION checks to be applied to new tuples
1313  * when inserting/updating an auto-updatable view, or RLS WITH CHECK
1314  * policies to be applied when inserting/updating a relation with RLS.
1315  */
1316 typedef enum WCOKind
1317 {
1318  WCO_VIEW_CHECK, /* WCO on an auto-updatable view */
1319  WCO_RLS_INSERT_CHECK, /* RLS INSERT WITH CHECK policy */
1320  WCO_RLS_UPDATE_CHECK, /* RLS UPDATE WITH CHECK policy */
1321  WCO_RLS_CONFLICT_CHECK, /* RLS ON CONFLICT DO UPDATE USING policy */
1322  WCO_RLS_MERGE_UPDATE_CHECK, /* RLS MERGE UPDATE USING policy */
1323  WCO_RLS_MERGE_DELETE_CHECK, /* RLS MERGE DELETE USING policy */
1325 
1326 typedef struct WithCheckOption
1327 {
1329  WCOKind kind; /* kind of WCO */
1330  char *relname; /* name of relation that specified the WCO */
1331  char *polname; /* name of RLS policy being checked */
1332  Node *qual; /* constraint qual to check */
1333  bool cascaded; /* true for a cascaded WCO on a view */
1335 
1336 /*
1337  * SortGroupClause -
1338  * representation of ORDER BY, GROUP BY, PARTITION BY,
1339  * DISTINCT, DISTINCT ON items
1340  *
1341  * You might think that ORDER BY is only interested in defining ordering,
1342  * and GROUP/DISTINCT are only interested in defining equality. However,
1343  * one way to implement grouping is to sort and then apply a "uniq"-like
1344  * filter. So it's also interesting to keep track of possible sort operators
1345  * for GROUP/DISTINCT, and in particular to try to sort for the grouping
1346  * in a way that will also yield a requested ORDER BY ordering. So we need
1347  * to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates
1348  * the decision to give them the same representation.
1349  *
1350  * tleSortGroupRef must match ressortgroupref of exactly one entry of the
1351  * query's targetlist; that is the expression to be sorted or grouped by.
1352  * eqop is the OID of the equality operator.
1353  * sortop is the OID of the ordering operator (a "<" or ">" operator),
1354  * or InvalidOid if not available.
1355  * nulls_first means about what you'd expect. If sortop is InvalidOid
1356  * then nulls_first is meaningless and should be set to false.
1357  * hashable is true if eqop is hashable (note this condition also depends
1358  * on the datatype of the input expression).
1359  *
1360  * In an ORDER BY item, all fields must be valid. (The eqop isn't essential
1361  * here, but it's cheap to get it along with the sortop, and requiring it
1362  * to be valid eases comparisons to grouping items.) Note that this isn't
1363  * actually enough information to determine an ordering: if the sortop is
1364  * collation-sensitive, a collation OID is needed too. We don't store the
1365  * collation in SortGroupClause because it's not available at the time the
1366  * parser builds the SortGroupClause; instead, consult the exposed collation
1367  * of the referenced targetlist expression to find out what it is.
1368  *
1369  * In a grouping item, eqop must be valid. If the eqop is a btree equality
1370  * operator, then sortop should be set to a compatible ordering operator.
1371  * We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that
1372  * the query presents for the same tlist item. If there is none, we just
1373  * use the default ordering op for the datatype.
1374  *
1375  * If the tlist item's type has a hash opclass but no btree opclass, then
1376  * we will set eqop to the hash equality operator, sortop to InvalidOid,
1377  * and nulls_first to false. A grouping item of this kind can only be
1378  * implemented by hashing, and of course it'll never match an ORDER BY item.
1379  *
1380  * The hashable flag is provided since we generally have the requisite
1381  * information readily available when the SortGroupClause is constructed,
1382  * and it's relatively expensive to get it again later. Note there is no
1383  * need for a "sortable" flag since OidIsValid(sortop) serves the purpose.
1384  *
1385  * A query might have both ORDER BY and DISTINCT (or DISTINCT ON) clauses.
1386  * In SELECT DISTINCT, the distinctClause list is as long or longer than the
1387  * sortClause list, while in SELECT DISTINCT ON it's typically shorter.
1388  * The two lists must match up to the end of the shorter one --- the parser
1389  * rearranges the distinctClause if necessary to make this true. (This
1390  * restriction ensures that only one sort step is needed to both satisfy the
1391  * ORDER BY and set up for the Unique step. This is semantically necessary
1392  * for DISTINCT ON, and presents no real drawback for DISTINCT.)
1393  */
1394 typedef struct SortGroupClause
1395 {
1397  Index tleSortGroupRef; /* reference into targetlist */
1398  Oid eqop; /* the equality operator ('=' op) */
1399  Oid sortop; /* the ordering operator ('<' op), or 0 */
1400  bool nulls_first; /* do NULLs come before normal values? */
1401  /* can eqop be implemented by hashing? */
1402  bool hashable pg_node_attr(query_jumble_ignore);
1404 
1405 /*
1406  * GroupingSet -
1407  * representation of CUBE, ROLLUP and GROUPING SETS clauses
1408  *
1409  * In a Query with grouping sets, the groupClause contains a flat list of
1410  * SortGroupClause nodes for each distinct expression used. The actual
1411  * structure of the GROUP BY clause is given by the groupingSets tree.
1412  *
1413  * In the raw parser output, GroupingSet nodes (of all types except SIMPLE
1414  * which is not used) are potentially mixed in with the expressions in the
1415  * groupClause of the SelectStmt. (An expression can't contain a GroupingSet,
1416  * but a list may mix GroupingSet and expression nodes.) At this stage, the
1417  * content of each node is a list of expressions, some of which may be RowExprs
1418  * which represent sublists rather than actual row constructors, and nested
1419  * GroupingSet nodes where legal in the grammar. The structure directly
1420  * reflects the query syntax.
1421  *
1422  * In parse analysis, the transformed expressions are used to build the tlist
1423  * and groupClause list (of SortGroupClause nodes), and the groupingSets tree
1424  * is eventually reduced to a fixed format:
1425  *
1426  * EMPTY nodes represent (), and obviously have no content
1427  *
1428  * SIMPLE nodes represent a list of one or more expressions to be treated as an
1429  * atom by the enclosing structure; the content is an integer list of
1430  * ressortgroupref values (see SortGroupClause)
1431  *
1432  * CUBE and ROLLUP nodes contain a list of one or more SIMPLE nodes.
1433  *
1434  * SETS nodes contain a list of EMPTY, SIMPLE, CUBE or ROLLUP nodes, but after
1435  * parse analysis they cannot contain more SETS nodes; enough of the syntactic
1436  * transforms of the spec have been applied that we no longer have arbitrarily
1437  * deep nesting (though we still preserve the use of cube/rollup).
1438  *
1439  * Note that if the groupingSets tree contains no SIMPLE nodes (only EMPTY
1440  * nodes at the leaves), then the groupClause will be empty, but this is still
1441  * an aggregation query (similar to using aggs or HAVING without GROUP BY).
1442  *
1443  * As an example, the following clause:
1444  *
1445  * GROUP BY GROUPING SETS ((a,b), CUBE(c,(d,e)))
1446  *
1447  * looks like this after raw parsing:
1448  *
1449  * SETS( RowExpr(a,b) , CUBE( c, RowExpr(d,e) ) )
1450  *
1451  * and parse analysis converts it to:
1452  *
1453  * SETS( SIMPLE(1,2), CUBE( SIMPLE(3), SIMPLE(4,5) ) )
1454  */
1455 typedef enum GroupingSetKind
1456 {
1463 
1464 typedef struct GroupingSet
1465 {
1467  GroupingSetKind kind pg_node_attr(query_jumble_ignore);
1471 
1472 /*
1473  * WindowClause -
1474  * transformed representation of WINDOW and OVER clauses
1475  *
1476  * A parsed Query's windowClause list contains these structs. "name" is set
1477  * if the clause originally came from WINDOW, and is NULL if it originally
1478  * was an OVER clause (but note that we collapse out duplicate OVERs).
1479  * partitionClause and orderClause are lists of SortGroupClause structs.
1480  * partitionClause is sanitized by the query planner to remove any columns or
1481  * expressions belonging to redundant PathKeys.
1482  * If we have RANGE with offset PRECEDING/FOLLOWING, the semantics of that are
1483  * specified by startInRangeFunc/inRangeColl/inRangeAsc/inRangeNullsFirst
1484  * for the start offset, or endInRangeFunc/inRange* for the end offset.
1485  * winref is an ID number referenced by WindowFunc nodes; it must be unique
1486  * among the members of a Query's windowClause list.
1487  * When refname isn't null, the partitionClause is always copied from there;
1488  * the orderClause might or might not be copied (see copiedOrder); the framing
1489  * options are never copied, per spec.
1490  *
1491  * The information relevant for the query jumbling is the partition clause
1492  * type and its bounds.
1493  */
1494 typedef struct WindowClause
1495 {
1497  /* window name (NULL in an OVER clause) */
1498  char *name pg_node_attr(query_jumble_ignore);
1499  /* referenced window name, if any */
1500  char *refname pg_node_attr(query_jumble_ignore);
1501  List *partitionClause; /* PARTITION BY list */
1502  /* ORDER BY list */
1504  int frameOptions; /* frame_clause options, see WindowDef */
1505  Node *startOffset; /* expression for starting bound, if any */
1506  Node *endOffset; /* expression for ending bound, if any */
1507  /* qual to help short-circuit execution */
1508  List *runCondition pg_node_attr(query_jumble_ignore);
1509  /* in_range function for startOffset */
1510  Oid startInRangeFunc pg_node_attr(query_jumble_ignore);
1511  /* in_range function for endOffset */
1512  Oid endInRangeFunc pg_node_attr(query_jumble_ignore);
1513  /* collation for in_range tests */
1514  Oid inRangeColl pg_node_attr(query_jumble_ignore);
1515  /* use ASC sort order for in_range tests? */
1516  bool inRangeAsc pg_node_attr(query_jumble_ignore);
1517  /* nulls sort first for in_range tests? */
1518  bool inRangeNullsFirst pg_node_attr(query_jumble_ignore);
1519  Index winref; /* ID referenced by window functions */
1520  /* did we copy orderClause from refname? */
1521  bool copiedOrder pg_node_attr(query_jumble_ignore);
1523 
1524 /*
1525  * RowMarkClause -
1526  * parser output representation of FOR [KEY] UPDATE/SHARE clauses
1527  *
1528  * Query.rowMarks contains a separate RowMarkClause node for each relation
1529  * identified as a FOR [KEY] UPDATE/SHARE target. If one of these clauses
1530  * is applied to a subquery, we generate RowMarkClauses for all normal and
1531  * subquery rels in the subquery, but they are marked pushedDown = true to
1532  * distinguish them from clauses that were explicitly written at this query
1533  * level. Also, Query.hasForUpdate tells whether there were explicit FOR
1534  * UPDATE/SHARE/KEY SHARE clauses in the current query level.
1535  */
1536 typedef struct RowMarkClause
1537 {
1539  Index rti; /* range table index of target relation */
1541  LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
1542  bool pushedDown; /* pushed down from higher query level? */
1544 
1545 /*
1546  * WithClause -
1547  * representation of WITH clause
1548  *
1549  * Note: WithClause does not propagate into the Query representation;
1550  * but CommonTableExpr does.
1551  */
1552 typedef struct WithClause
1553 {
1555  List *ctes; /* list of CommonTableExprs */
1556  bool recursive; /* true = WITH RECURSIVE */
1557  int location; /* token location, or -1 if unknown */
1559 
1560 /*
1561  * InferClause -
1562  * ON CONFLICT unique index inference clause
1563  *
1564  * Note: InferClause does not propagate into the Query representation.
1565  */
1566 typedef struct InferClause
1567 {
1569  List *indexElems; /* IndexElems to infer unique index */
1570  Node *whereClause; /* qualification (partial-index predicate) */
1571  char *conname; /* Constraint name, or NULL if unnamed */
1572  int location; /* token location, or -1 if unknown */
1574 
1575 /*
1576  * OnConflictClause -
1577  * representation of ON CONFLICT clause
1578  *
1579  * Note: OnConflictClause does not propagate into the Query representation.
1580  */
1581 typedef struct OnConflictClause
1582 {
1584  OnConflictAction action; /* DO NOTHING or UPDATE? */
1585  InferClause *infer; /* Optional index inference clause */
1586  List *targetList; /* the target list (of ResTarget) */
1587  Node *whereClause; /* qualifications */
1588  int location; /* token location, or -1 if unknown */
1590 
1591 /*
1592  * CommonTableExpr -
1593  * representation of WITH list element
1594  */
1595 
1596 typedef enum CTEMaterialize
1597 {
1598  CTEMaterializeDefault, /* no option specified */
1599  CTEMaterializeAlways, /* MATERIALIZED */
1600  CTEMaterializeNever, /* NOT MATERIALIZED */
1602 
1603 typedef struct CTESearchClause
1604 {
1611 
1612 typedef struct CTECycleClause
1613 {
1621  /* These fields are set during parse analysis: */
1622  Oid cycle_mark_type; /* common type of _value and _default */
1625  Oid cycle_mark_neop; /* <> operator for type */
1627 
1628 typedef struct CommonTableExpr
1629 {
1631 
1632  /*
1633  * Query name (never qualified). The string name is included in the query
1634  * jumbling because RTE_CTE RTEs need it.
1635  */
1636  char *ctename;
1637  /* optional list of column names */
1638  List *aliascolnames pg_node_attr(query_jumble_ignore);
1639  CTEMaterialize ctematerialized; /* is this an optimization fence? */
1640  /* SelectStmt/InsertStmt/etc before parse analysis, Query afterwards: */
1641  Node *ctequery; /* the CTE's subquery */
1642  CTESearchClause *search_clause pg_node_attr(query_jumble_ignore);
1643  CTECycleClause *cycle_clause pg_node_attr(query_jumble_ignore);
1644  int location; /* token location, or -1 if unknown */
1645  /* These fields are set during parse analysis: */
1646  /* is this CTE actually recursive? */
1647  bool cterecursive pg_node_attr(query_jumble_ignore);
1648 
1649  /*
1650  * Number of RTEs referencing this CTE (excluding internal
1651  * self-references), irrelevant for query jumbling.
1652  */
1653  int cterefcount pg_node_attr(query_jumble_ignore);
1654  /* list of output column names */
1655  List *ctecolnames pg_node_attr(query_jumble_ignore);
1656  /* OID list of output column type OIDs */
1657  List *ctecoltypes pg_node_attr(query_jumble_ignore);
1658  /* integer list of output column typmods */
1659  List *ctecoltypmods pg_node_attr(query_jumble_ignore);
1660  /* OID list of column collation OIDs */
1661  List *ctecolcollations pg_node_attr(query_jumble_ignore);
1663 
1664 /* Convenience macro to get the output tlist of a CTE's query */
1665 #define GetCTETargetList(cte) \
1666  (AssertMacro(IsA((cte)->ctequery, Query)), \
1667  ((Query *) (cte)->ctequery)->commandType == CMD_SELECT ? \
1668  ((Query *) (cte)->ctequery)->targetList : \
1669  ((Query *) (cte)->ctequery)->returningList)
1670 
1671 /*
1672  * MergeWhenClause -
1673  * raw parser representation of a WHEN clause in a MERGE statement
1674  *
1675  * This is transformed into MergeAction by parse analysis
1676  */
1677 typedef struct MergeWhenClause
1678 {
1680  bool matched; /* true=MATCHED, false=NOT MATCHED */
1681  CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
1682  OverridingKind override; /* OVERRIDING clause */
1683  Node *condition; /* WHEN conditions (raw parser) */
1684  List *targetList; /* INSERT/UPDATE targetlist */
1685  /* the following members are only used in INSERT actions */
1686  List *values; /* VALUES to INSERT, or NULL */
1688 
1689 /*
1690  * TriggerTransition -
1691  * representation of transition row or table naming clause
1692  *
1693  * Only transition tables are initially supported in the syntax, and only for
1694  * AFTER triggers, but other permutations are accepted by the parser so we can
1695  * give a meaningful message from C code.
1696  */
1697 typedef struct TriggerTransition
1698 {
1700  char *name;
1701  bool isNew;
1702  bool isTable;
1704 
1705 /* Nodes for SQL/JSON support */
1706 
1707 /*
1708  * JsonOutput -
1709  * representation of JSON output clause (RETURNING type [FORMAT format])
1710  */
1711 typedef struct JsonOutput
1712 {
1714  TypeName *typeName; /* RETURNING type name, if specified */
1715  JsonReturning *returning; /* RETURNING FORMAT clause and type Oids */
1717 
1718 /*
1719  * JsonKeyValue -
1720  * untransformed representation of JSON object key-value pair for
1721  * JSON_OBJECT() and JSON_OBJECTAGG()
1722  */
1723 typedef struct JsonKeyValue
1724 {
1726  Expr *key; /* key expression */
1727  JsonValueExpr *value; /* JSON value expression */
1729 
1730 /*
1731  * JsonParseExpr -
1732  * untransformed representation of JSON()
1733  */
1734 typedef struct JsonParseExpr
1735 {
1737  JsonValueExpr *expr; /* string expression */
1738  JsonOutput *output; /* RETURNING clause, if specified */
1739  bool unique_keys; /* WITH UNIQUE KEYS? */
1740  int location; /* token location, or -1 if unknown */
1742 
1743 /*
1744  * JsonScalarExpr -
1745  * untransformed representation of JSON_SCALAR()
1746  */
1747 typedef struct JsonScalarExpr
1748 {
1750  Expr *expr; /* scalar expression */
1751  JsonOutput *output; /* RETURNING clause, if specified */
1752  int location; /* token location, or -1 if unknown */
1754 
1755 /*
1756  * JsonSerializeExpr -
1757  * untransformed representation of JSON_SERIALIZE() function
1758  */
1759 typedef struct JsonSerializeExpr
1760 {
1762  JsonValueExpr *expr; /* json value expression */
1763  JsonOutput *output; /* RETURNING clause, if specified */
1764  int location; /* token location, or -1 if unknown */
1766 
1767 /*
1768  * JsonObjectConstructor -
1769  * untransformed representation of JSON_OBJECT() constructor
1770  */
1772 {
1774  List *exprs; /* list of JsonKeyValue pairs */
1775  JsonOutput *output; /* RETURNING clause, if specified */
1776  bool absent_on_null; /* skip NULL values? */
1777  bool unique; /* check key uniqueness? */
1778  int location; /* token location, or -1 if unknown */
1780 
1781 /*
1782  * JsonArrayConstructor -
1783  * untransformed representation of JSON_ARRAY(element,...) constructor
1784  */
1785 typedef struct JsonArrayConstructor
1786 {
1788  List *exprs; /* list of JsonValueExpr elements */
1789  JsonOutput *output; /* RETURNING clause, if specified */
1790  bool absent_on_null; /* skip NULL elements? */
1791  int location; /* token location, or -1 if unknown */
1793 
1794 /*
1795  * JsonArrayQueryConstructor -
1796  * untransformed representation of JSON_ARRAY(subquery) constructor
1797  */
1799 {
1801  Node *query; /* subquery */
1802  JsonOutput *output; /* RETURNING clause, if specified */
1803  JsonFormat *format; /* FORMAT clause for subquery, if specified */
1804  bool absent_on_null; /* skip NULL elements? */
1805  int location; /* token location, or -1 if unknown */
1807 
1808 /*
1809  * JsonAggConstructor -
1810  * common fields of untransformed representation of
1811  * JSON_ARRAYAGG() and JSON_OBJECTAGG()
1812  */
1813 typedef struct JsonAggConstructor
1814 {
1816  JsonOutput *output; /* RETURNING clause, if any */
1817  Node *agg_filter; /* FILTER clause, if any */
1818  List *agg_order; /* ORDER BY clause, if any */
1819  struct WindowDef *over; /* OVER clause, if any */
1820  int location; /* token location, or -1 if unknown */
1822 
1823 /*
1824  * JsonObjectAgg -
1825  * untransformed representation of JSON_OBJECTAGG()
1826  */
1827 typedef struct JsonObjectAgg
1828 {
1830  JsonAggConstructor *constructor; /* common fields */
1831  JsonKeyValue *arg; /* object key-value pair */
1832  bool absent_on_null; /* skip NULL values? */
1833  bool unique; /* check key uniqueness? */
1835 
1836 /*
1837  * JsonArrayAgg -
1838  * untransformed representation of JSON_ARRAYAGG()
1839  */
1840 typedef struct JsonArrayAgg
1841 {
1843  JsonAggConstructor *constructor; /* common fields */
1844  JsonValueExpr *arg; /* array element expression */
1845  bool absent_on_null; /* skip NULL elements? */
1847 
1848 
1849 /*****************************************************************************
1850  * Raw Grammar Output Statements
1851  *****************************************************************************/
1852 
1853 /*
1854  * RawStmt --- container for any one statement's raw parse tree
1855  *
1856  * Parse analysis converts a raw parse tree headed by a RawStmt node into
1857  * an analyzed statement headed by a Query node. For optimizable statements,
1858  * the conversion is complex. For utility statements, the parser usually just
1859  * transfers the raw parse tree (sans RawStmt) into the utilityStmt field of
1860  * the Query node, and all the useful work happens at execution time.
1861  *
1862  * stmt_location/stmt_len identify the portion of the source text string
1863  * containing this raw statement (useful for multi-statement strings).
1864  *
1865  * This is irrelevant for query jumbling, as this is not used in parsed
1866  * queries.
1867  */
1868 typedef struct RawStmt
1869 {
1870  pg_node_attr(no_query_jumble)
1871 
1872  NodeTag type;
1873  Node *stmt; /* raw parse tree */
1874  int stmt_location; /* start location, or -1 if unknown */
1875  int stmt_len; /* length in bytes; 0 means "rest of string" */
1877 
1878 /*****************************************************************************
1879  * Optimizable Statements
1880  *****************************************************************************/
1881 
1882 /* ----------------------
1883  * Insert Statement
1884  *
1885  * The source expression is represented by SelectStmt for both the
1886  * SELECT and VALUES cases. If selectStmt is NULL, then the query
1887  * is INSERT ... DEFAULT VALUES.
1888  * ----------------------
1889  */
1890 typedef struct InsertStmt
1891 {
1893  RangeVar *relation; /* relation to insert into */
1894  List *cols; /* optional: names of the target columns */
1895  Node *selectStmt; /* the source SELECT/VALUES, or NULL */
1896  OnConflictClause *onConflictClause; /* ON CONFLICT clause */
1897  List *returningList; /* list of expressions to return */
1898  WithClause *withClause; /* WITH clause */
1899  OverridingKind override; /* OVERRIDING clause */
1901 
1902 /* ----------------------
1903  * Delete Statement
1904  * ----------------------
1905  */
1906 typedef struct DeleteStmt
1907 {
1909  RangeVar *relation; /* relation to delete from */
1910  List *usingClause; /* optional using clause for more tables */
1911  Node *whereClause; /* qualifications */
1912  List *returningList; /* list of expressions to return */
1913  WithClause *withClause; /* WITH clause */
1915 
1916 /* ----------------------
1917  * Update Statement
1918  * ----------------------
1919  */
1920 typedef struct UpdateStmt
1921 {
1923  RangeVar *relation; /* relation to update */
1924  List *targetList; /* the target list (of ResTarget) */
1925  Node *whereClause; /* qualifications */
1926  List *fromClause; /* optional from clause for more tables */
1927  List *returningList; /* list of expressions to return */
1928  WithClause *withClause; /* WITH clause */
1930 
1931 /* ----------------------
1932  * Merge Statement
1933  * ----------------------
1934  */
1935 typedef struct MergeStmt
1936 {
1938  RangeVar *relation; /* target relation to merge into */
1939  Node *sourceRelation; /* source relation */
1940  Node *joinCondition; /* join condition between source and target */
1941  List *mergeWhenClauses; /* list of MergeWhenClause(es) */
1942  List *returningList; /* list of expressions to return */
1943  WithClause *withClause; /* WITH clause */
1945 
1946 /* ----------------------
1947  * Select Statement
1948  *
1949  * A "simple" SELECT is represented in the output of gram.y by a single
1950  * SelectStmt node; so is a VALUES construct. A query containing set
1951  * operators (UNION, INTERSECT, EXCEPT) is represented by a tree of SelectStmt
1952  * nodes, in which the leaf nodes are component SELECTs and the internal nodes
1953  * represent UNION, INTERSECT, or EXCEPT operators. Using the same node
1954  * type for both leaf and internal nodes allows gram.y to stick ORDER BY,
1955  * LIMIT, etc, clause values into a SELECT statement without worrying
1956  * whether it is a simple or compound SELECT.
1957  * ----------------------
1958  */
1959 typedef enum SetOperation
1960 {
1966 
1967 typedef struct SelectStmt
1968 {
1970 
1971  /*
1972  * These fields are used only in "leaf" SelectStmts.
1973  */
1974  List *distinctClause; /* NULL, list of DISTINCT ON exprs, or
1975  * lcons(NIL,NIL) for all (SELECT DISTINCT) */
1976  IntoClause *intoClause; /* target for SELECT INTO */
1977  List *targetList; /* the target list (of ResTarget) */
1978  List *fromClause; /* the FROM clause */
1979  Node *whereClause; /* WHERE qualification */
1980  List *groupClause; /* GROUP BY clauses */
1981  bool groupDistinct; /* Is this GROUP BY DISTINCT? */
1982  Node *havingClause; /* HAVING conditional-expression */
1983  List *windowClause; /* WINDOW window_name AS (...), ... */
1984 
1985  /*
1986  * In a "leaf" node representing a VALUES list, the above fields are all
1987  * null, and instead this field is set. Note that the elements of the
1988  * sublists are just expressions, without ResTarget decoration. Also note
1989  * that a list element can be DEFAULT (represented as a SetToDefault
1990  * node), regardless of the context of the VALUES list. It's up to parse
1991  * analysis to reject that where not valid.
1992  */
1993  List *valuesLists; /* untransformed list of expression lists */
1994 
1995  /*
1996  * These fields are used in both "leaf" SelectStmts and upper-level
1997  * SelectStmts.
1998  */
1999  List *sortClause; /* sort clause (a list of SortBy's) */
2000  Node *limitOffset; /* # of result tuples to skip */
2001  Node *limitCount; /* # of result tuples to return */
2002  LimitOption limitOption; /* limit type */
2003  List *lockingClause; /* FOR UPDATE (list of LockingClause's) */
2004  WithClause *withClause; /* WITH clause */
2005 
2006  /*
2007  * These fields are used only in upper-level SelectStmts.
2008  */
2009  SetOperation op; /* type of set op */
2010  bool all; /* ALL specified? */
2011  struct SelectStmt *larg; /* left child */
2012  struct SelectStmt *rarg; /* right child */
2013  /* Eventually add fields for CORRESPONDING spec here */
2015 
2016 
2017 /* ----------------------
2018  * Set Operation node for post-analysis query trees
2019  *
2020  * After parse analysis, a SELECT with set operations is represented by a
2021  * top-level Query node containing the leaf SELECTs as subqueries in its
2022  * range table. Its setOperations field shows the tree of set operations,
2023  * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal
2024  * nodes replaced by SetOperationStmt nodes. Information about the output
2025  * column types is added, too. (Note that the child nodes do not necessarily
2026  * produce these types directly, but we've checked that their output types
2027  * can be coerced to the output column type.) Also, if it's not UNION ALL,
2028  * information about the types' sort/group semantics is provided in the form
2029  * of a SortGroupClause list (same representation as, eg, DISTINCT).
2030  * The resolved common column collations are provided too; but note that if
2031  * it's not UNION ALL, it's okay for a column to not have a common collation,
2032  * so a member of the colCollations list could be InvalidOid even though the
2033  * column has a collatable type.
2034  * ----------------------
2035  */
2036 typedef struct SetOperationStmt
2037 {
2039  SetOperation op; /* type of set op */
2040  bool all; /* ALL specified? */
2041  Node *larg; /* left child */
2042  Node *rarg; /* right child */
2043  /* Eventually add fields for CORRESPONDING spec here */
2044 
2045  /* Fields derived during parse analysis (irrelevant for query jumbling): */
2046  /* OID list of output column type OIDs */
2047  List *colTypes pg_node_attr(query_jumble_ignore);
2048  /* integer list of output column typmods */
2049  List *colTypmods pg_node_attr(query_jumble_ignore);
2050  /* OID list of output column collation OIDs */
2051  List *colCollations pg_node_attr(query_jumble_ignore);
2052  /* a list of SortGroupClause's */
2053  List *groupClauses pg_node_attr(query_jumble_ignore);
2054  /* groupClauses is NIL if UNION ALL, but must be set otherwise */
2056 
2057 
2058 /*
2059  * RETURN statement (inside SQL function body)
2060  */
2061 typedef struct ReturnStmt
2062 {
2066 
2067 
2068 /* ----------------------
2069  * PL/pgSQL Assignment Statement
2070  *
2071  * Like SelectStmt, this is transformed into a SELECT Query.
2072  * However, the targetlist of the result looks more like an UPDATE.
2073  * ----------------------
2074  */
2075 typedef struct PLAssignStmt
2076 {
2078 
2079  char *name; /* initial column name */
2080  List *indirection; /* subscripts and field names, if any */
2081  int nnames; /* number of names to use in ColumnRef */
2082  SelectStmt *val; /* the PL/pgSQL expression to assign */
2083  int location; /* name's token location, or -1 if unknown */
2085 
2086 
2087 /*****************************************************************************
2088  * Other Statements (no optimizations required)
2089  *
2090  * These are not touched by parser/analyze.c except to put them into
2091  * the utilityStmt field of a Query. This is eventually passed to
2092  * ProcessUtility (by-passing rewriting and planning). Some of the
2093  * statements do need attention from parse analysis, and this is
2094  * done by routines in parser/parse_utilcmd.c after ProcessUtility
2095  * receives the command for execution.
2096  * DECLARE CURSOR, EXPLAIN, and CREATE TABLE AS are special cases:
2097  * they contain optimizable statements, which get processed normally
2098  * by parser/analyze.c.
2099  *****************************************************************************/
2100 
2101 /*
2102  * When a command can act on several kinds of objects with only one
2103  * parse structure required, use these constants to designate the
2104  * object type. Note that commands typically don't support all the types.
2105  */
2106 
2107 typedef enum ObjectType
2108 {
2113  OBJECT_ATTRIBUTE, /* type's attribute, when distinct from column */
2162 
2163 /* ----------------------
2164  * Create Schema Statement
2165  *
2166  * NOTE: the schemaElts list contains raw parsetrees for component statements
2167  * of the schema, such as CREATE TABLE, GRANT, etc. These are analyzed and
2168  * executed after the schema itself is created.
2169  * ----------------------
2170  */
2171 typedef struct CreateSchemaStmt
2172 {
2174  char *schemaname; /* the name of the schema to create */
2175  RoleSpec *authrole; /* the owner of the created schema */
2176  List *schemaElts; /* schema components (list of parsenodes) */
2177  bool if_not_exists; /* just do nothing if schema already exists? */
2179 
2180 typedef enum DropBehavior
2181 {
2182  DROP_RESTRICT, /* drop fails if any dependent objects */
2183  DROP_CASCADE, /* remove dependent objects too */
2185 
2186 /* ----------------------
2187  * Alter Table
2188  * ----------------------
2189  */
2190 typedef struct AlterTableStmt
2191 {
2193  RangeVar *relation; /* table to work on */
2194  List *cmds; /* list of subcommands */
2195  ObjectType objtype; /* type of object */
2196  bool missing_ok; /* skip error if table missing */
2198 
2199 typedef enum AlterTableType
2200 {
2201  AT_AddColumn, /* add column */
2202  AT_AddColumnToView, /* implicitly via CREATE OR REPLACE VIEW */
2203  AT_ColumnDefault, /* alter column default */
2204  AT_CookedColumnDefault, /* add a pre-cooked column default */
2205  AT_DropNotNull, /* alter column drop not null */
2206  AT_SetNotNull, /* alter column set not null */
2207  AT_SetAttNotNull, /* set attnotnull w/o a constraint */
2208  AT_SetExpression, /* alter column set expression */
2209  AT_DropExpression, /* alter column drop expression */
2210  AT_SetStatistics, /* alter column set statistics */
2211  AT_SetOptions, /* alter column set ( options ) */
2212  AT_ResetOptions, /* alter column reset ( options ) */
2213  AT_SetStorage, /* alter column set storage */
2214  AT_SetCompression, /* alter column set compression */
2215  AT_DropColumn, /* drop column */
2216  AT_AddIndex, /* add index */
2217  AT_ReAddIndex, /* internal to commands/tablecmds.c */
2218  AT_AddConstraint, /* add constraint */
2219  AT_ReAddConstraint, /* internal to commands/tablecmds.c */
2220  AT_ReAddDomainConstraint, /* internal to commands/tablecmds.c */
2221  AT_AlterConstraint, /* alter constraint */
2222  AT_ValidateConstraint, /* validate constraint */
2223  AT_AddIndexConstraint, /* add constraint using existing index */
2224  AT_DropConstraint, /* drop constraint */
2225  AT_ReAddComment, /* internal to commands/tablecmds.c */
2226  AT_AlterColumnType, /* alter column type */
2227  AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */
2228  AT_ChangeOwner, /* change owner */
2229  AT_ClusterOn, /* CLUSTER ON */
2230  AT_DropCluster, /* SET WITHOUT CLUSTER */
2231  AT_SetLogged, /* SET LOGGED */
2232  AT_SetUnLogged, /* SET UNLOGGED */
2233  AT_DropOids, /* SET WITHOUT OIDS */
2234  AT_SetAccessMethod, /* SET ACCESS METHOD */
2235  AT_SetTableSpace, /* SET TABLESPACE */
2236  AT_SetRelOptions, /* SET (...) -- AM specific parameters */
2237  AT_ResetRelOptions, /* RESET (...) -- AM specific parameters */
2238  AT_ReplaceRelOptions, /* replace reloption list in its entirety */
2239  AT_EnableTrig, /* ENABLE TRIGGER name */
2240  AT_EnableAlwaysTrig, /* ENABLE ALWAYS TRIGGER name */
2241  AT_EnableReplicaTrig, /* ENABLE REPLICA TRIGGER name */
2242  AT_DisableTrig, /* DISABLE TRIGGER name */
2243  AT_EnableTrigAll, /* ENABLE TRIGGER ALL */
2244  AT_DisableTrigAll, /* DISABLE TRIGGER ALL */
2245  AT_EnableTrigUser, /* ENABLE TRIGGER USER */
2246  AT_DisableTrigUser, /* DISABLE TRIGGER USER */
2247  AT_EnableRule, /* ENABLE RULE name */
2248  AT_EnableAlwaysRule, /* ENABLE ALWAYS RULE name */
2249  AT_EnableReplicaRule, /* ENABLE REPLICA RULE name */
2250  AT_DisableRule, /* DISABLE RULE name */
2251  AT_AddInherit, /* INHERIT parent */
2252  AT_DropInherit, /* NO INHERIT parent */
2253  AT_AddOf, /* OF <type_name> */
2254  AT_DropOf, /* NOT OF */
2255  AT_ReplicaIdentity, /* REPLICA IDENTITY */
2256  AT_EnableRowSecurity, /* ENABLE ROW SECURITY */
2257  AT_DisableRowSecurity, /* DISABLE ROW SECURITY */
2258  AT_ForceRowSecurity, /* FORCE ROW SECURITY */
2259  AT_NoForceRowSecurity, /* NO FORCE ROW SECURITY */
2260  AT_GenericOptions, /* OPTIONS (...) */
2261  AT_AttachPartition, /* ATTACH PARTITION */
2262  AT_DetachPartition, /* DETACH PARTITION */
2263  AT_DetachPartitionFinalize, /* DETACH PARTITION FINALIZE */
2264  AT_AddIdentity, /* ADD IDENTITY */
2265  AT_SetIdentity, /* SET identity column options */
2266  AT_DropIdentity, /* DROP IDENTITY */
2267  AT_ReAddStatistics, /* internal to commands/tablecmds.c */
2269 
2270 typedef struct ReplicaIdentityStmt
2271 {
2274  char *name;
2276 
2277 typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
2278 {
2280  AlterTableType subtype; /* Type of table alteration to apply */
2281  char *name; /* column, constraint, or trigger to act on,
2282  * or tablespace, access method */
2283  int16 num; /* attribute number for columns referenced by
2284  * number */
2286  Node *def; /* definition of new column, index,
2287  * constraint, or parent table */
2288  DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
2289  bool missing_ok; /* skip error if missing? */
2290  bool recurse; /* exec-time recursion */
2292 
2293 
2294 /* ----------------------
2295  * Alter Collation
2296  * ----------------------
2297  */
2298 typedef struct AlterCollationStmt
2299 {
2303 
2304 
2305 /* ----------------------
2306  * Alter Domain
2307  *
2308  * The fields are used in different ways by the different variants of
2309  * this command.
2310  * ----------------------
2311  */
2312 typedef struct AlterDomainStmt
2313 {
2315  char subtype; /*------------
2316  * T = alter column default
2317  * N = alter column drop not null
2318  * O = alter column set not null
2319  * C = add constraint
2320  * X = drop constraint
2321  *------------
2322  */
2323  List *typeName; /* domain to work on */
2324  char *name; /* column or constraint name to act on */
2325  Node *def; /* definition of default or constraint */
2326  DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
2327  bool missing_ok; /* skip error if missing? */
2329 
2330 
2331 /* ----------------------
2332  * Grant|Revoke Statement
2333  * ----------------------
2334  */
2335 typedef enum GrantTargetType
2336 {
2337  ACL_TARGET_OBJECT, /* grant on specific named object(s) */
2338  ACL_TARGET_ALL_IN_SCHEMA, /* grant on all objects in given schema(s) */
2339  ACL_TARGET_DEFAULTS, /* ALTER DEFAULT PRIVILEGES */
2341 
2342 typedef struct GrantStmt
2343 {
2345  bool is_grant; /* true = GRANT, false = REVOKE */
2346  GrantTargetType targtype; /* type of the grant target */
2347  ObjectType objtype; /* kind of object being operated on */
2348  List *objects; /* list of RangeVar nodes, ObjectWithArgs
2349  * nodes, or plain names (as String values) */
2350  List *privileges; /* list of AccessPriv nodes */
2351  /* privileges == NIL denotes ALL PRIVILEGES */
2352  List *grantees; /* list of RoleSpec nodes */
2353  bool grant_option; /* grant or revoke grant option */
2355  DropBehavior behavior; /* drop behavior (for REVOKE) */
2357 
2358 /*
2359  * ObjectWithArgs represents a function/procedure/operator name plus parameter
2360  * identification.
2361  *
2362  * objargs includes only the types of the input parameters of the object.
2363  * In some contexts, that will be all we have, and it's enough to look up
2364  * objects according to the traditional Postgres rules (i.e., when only input
2365  * arguments matter).
2366  *
2367  * objfuncargs, if not NIL, carries the full specification of the parameter
2368  * list, including parameter mode annotations.
2369  *
2370  * Some grammar productions can set args_unspecified = true instead of
2371  * providing parameter info. In this case, lookup will succeed only if
2372  * the object name is unique. Note that otherwise, NIL parameter lists
2373  * mean zero arguments.
2374  */
2375 typedef struct ObjectWithArgs
2376 {
2378  List *objname; /* qualified name of function/operator */
2379  List *objargs; /* list of Typename nodes (input args only) */
2380  List *objfuncargs; /* list of FunctionParameter nodes */
2381  bool args_unspecified; /* argument list was omitted? */
2383 
2384 /*
2385  * An access privilege, with optional list of column names
2386  * priv_name == NULL denotes ALL PRIVILEGES (only used with a column list)
2387  * cols == NIL denotes "all columns"
2388  * Note that simple "ALL PRIVILEGES" is represented as a NIL list, not
2389  * an AccessPriv with both fields null.
2390  */
2391 typedef struct AccessPriv
2392 {
2394  char *priv_name; /* string name of privilege */
2395  List *cols; /* list of String */
2397 
2398 /* ----------------------
2399  * Grant/Revoke Role Statement
2400  *
2401  * Note: because of the parsing ambiguity with the GRANT <privileges>
2402  * statement, granted_roles is a list of AccessPriv; the execution code
2403  * should complain if any column lists appear. grantee_roles is a list
2404  * of role names, as String values.
2405  * ----------------------
2406  */
2407 typedef struct GrantRoleStmt
2408 {
2410  List *granted_roles; /* list of roles to be granted/revoked */
2411  List *grantee_roles; /* list of member roles to add/delete */
2412  bool is_grant; /* true = GRANT, false = REVOKE */
2413  List *opt; /* options e.g. WITH GRANT OPTION */
2414  RoleSpec *grantor; /* set grantor to other than current role */
2415  DropBehavior behavior; /* drop behavior (for REVOKE) */
2417 
2418 /* ----------------------
2419  * Alter Default Privileges Statement
2420  * ----------------------
2421  */
2423 {
2425  List *options; /* list of DefElem */
2426  GrantStmt *action; /* GRANT/REVOKE action (with objects=NIL) */
2428 
2429 /* ----------------------
2430  * Copy Statement
2431  *
2432  * We support "COPY relation FROM file", "COPY relation TO file", and
2433  * "COPY (query) TO file". In any given CopyStmt, exactly one of "relation"
2434  * and "query" must be non-NULL.
2435  * ----------------------
2436  */
2437 typedef struct CopyStmt
2438 {
2440  RangeVar *relation; /* the relation to copy */
2441  Node *query; /* the query (SELECT or DML statement with
2442  * RETURNING) to copy, as a raw parse tree */
2443  List *attlist; /* List of column names (as Strings), or NIL
2444  * for all columns */
2445  bool is_from; /* TO or FROM */
2446  bool is_program; /* is 'filename' a program to popen? */
2447  char *filename; /* filename, or NULL for STDIN/STDOUT */
2448  List *options; /* List of DefElem nodes */
2449  Node *whereClause; /* WHERE condition (or NULL) */
2451 
2452 /* ----------------------
2453  * SET Statement (includes RESET)
2454  *
2455  * "SET var TO DEFAULT" and "RESET var" are semantically equivalent, but we
2456  * preserve the distinction in VariableSetKind for CreateCommandTag().
2457  * ----------------------
2458  */
2459 typedef enum VariableSetKind
2460 {
2461  VAR_SET_VALUE, /* SET var = value */
2462  VAR_SET_DEFAULT, /* SET var TO DEFAULT */
2463  VAR_SET_CURRENT, /* SET var FROM CURRENT */
2464  VAR_SET_MULTI, /* special case for SET TRANSACTION ... */
2465  VAR_RESET, /* RESET var */
2466  VAR_RESET_ALL, /* RESET ALL */
2468 
2469 typedef struct VariableSetStmt
2470 {
2473  char *name; /* variable to be set */
2474  List *args; /* List of A_Const nodes */
2475  bool is_local; /* SET LOCAL? */
2477 
2478 /* ----------------------
2479  * Show Statement
2480  * ----------------------
2481  */
2482 typedef struct VariableShowStmt
2483 {
2485  char *name;
2487 
2488 /* ----------------------
2489  * Create Table Statement
2490  *
2491  * NOTE: in the raw gram.y output, ColumnDef and Constraint nodes are
2492  * intermixed in tableElts, and constraints and nnconstraints are NIL. After
2493  * parse analysis, tableElts contains just ColumnDefs, nnconstraints contains
2494  * Constraint nodes of CONSTR_NOTNULL type from various sources, and
2495  * constraints contains just CONSTR_CHECK Constraint nodes.
2496  * ----------------------
2497  */
2498 
2499 typedef struct CreateStmt
2500 {
2502  RangeVar *relation; /* relation to create */
2503  List *tableElts; /* column definitions (list of ColumnDef) */
2504  List *inhRelations; /* relations to inherit from (list of
2505  * RangeVar) */
2506  PartitionBoundSpec *partbound; /* FOR VALUES clause */
2507  PartitionSpec *partspec; /* PARTITION BY clause */
2508  TypeName *ofTypename; /* OF typename */
2509  List *constraints; /* constraints (list of Constraint nodes) */
2510  List *nnconstraints; /* NOT NULL constraints (ditto) */
2511  List *options; /* options from WITH clause */
2512  OnCommitAction oncommit; /* what do we do at COMMIT? */
2513  char *tablespacename; /* table space to use, or NULL */
2514  char *accessMethod; /* table access method */
2515  bool if_not_exists; /* just do nothing if it already exists? */
2517 
2518 /* ----------
2519  * Definitions for constraints in CreateStmt
2520  *
2521  * Note that column defaults are treated as a type of constraint,
2522  * even though that's a bit odd semantically.
2523  *
2524  * For constraints that use expressions (CONSTR_CHECK, CONSTR_DEFAULT)
2525  * we may have the expression in either "raw" form (an untransformed
2526  * parse tree) or "cooked" form (the nodeToString representation of
2527  * an executable expression tree), depending on how this Constraint
2528  * node was created (by parsing, or by inheritance from an existing
2529  * relation). We should never have both in the same node!
2530  *
2531  * FKCONSTR_ACTION_xxx values are stored into pg_constraint.confupdtype
2532  * and pg_constraint.confdeltype columns; FKCONSTR_MATCH_xxx values are
2533  * stored into pg_constraint.confmatchtype. Changing the code values may
2534  * require an initdb!
2535  *
2536  * If skip_validation is true then we skip checking that the existing rows
2537  * in the table satisfy the constraint, and just install the catalog entries
2538  * for the constraint. A new FK constraint is marked as valid iff
2539  * initially_valid is true. (Usually skip_validation and initially_valid
2540  * are inverses, but we can set both true if the table is known empty.)
2541  *
2542  * Constraint attributes (DEFERRABLE etc) are initially represented as
2543  * separate Constraint nodes for simplicity of parsing. parse_utilcmd.c makes
2544  * a pass through the constraints list to insert the info into the appropriate
2545  * Constraint node.
2546  * ----------
2547  */
2548 
2549 typedef enum ConstrType /* types of constraints */
2550 {
2551  CONSTR_NULL, /* not standard SQL, but a lot of people
2552  * expect it */
2562  CONSTR_ATTR_DEFERRABLE, /* attributes for previous constraint node */
2567 
2568 /* Foreign key action codes */
2569 #define FKCONSTR_ACTION_NOACTION 'a'
2570 #define FKCONSTR_ACTION_RESTRICT 'r'
2571 #define FKCONSTR_ACTION_CASCADE 'c'
2572 #define FKCONSTR_ACTION_SETNULL 'n'
2573 #define FKCONSTR_ACTION_SETDEFAULT 'd'
2574 
2575 /* Foreign key matchtype codes */
2576 #define FKCONSTR_MATCH_FULL 'f'
2577 #define FKCONSTR_MATCH_PARTIAL 'p'
2578 #define FKCONSTR_MATCH_SIMPLE 's'
2579 
2580 typedef struct Constraint
2581 {
2583  ConstrType contype; /* see above */
2584  char *conname; /* Constraint name, or NULL if unnamed */
2585  bool deferrable; /* DEFERRABLE? */
2586  bool initdeferred; /* INITIALLY DEFERRED? */
2587  bool skip_validation; /* skip validation of existing rows? */
2588  bool initially_valid; /* mark the new constraint as valid? */
2589  bool is_no_inherit; /* is constraint non-inheritable? */
2590  Node *raw_expr; /* CHECK or DEFAULT expression, as
2591  * untransformed parse tree */
2592  char *cooked_expr; /* CHECK or DEFAULT expression, as
2593  * nodeToString representation */
2594  char generated_when; /* ALWAYS or BY DEFAULT */
2595  int inhcount; /* initial inheritance count to apply, for
2596  * "raw" NOT NULL constraints */
2597  bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
2598  List *keys; /* String nodes naming referenced key
2599  * column(s); for UNIQUE/PK/NOT NULL */
2600  bool without_overlaps; /* WITHOUT OVERLAPS specified */
2601  List *including; /* String nodes naming referenced nonkey
2602  * column(s); for UNIQUE/PK */
2603  List *exclusions; /* list of (IndexElem, operator name) pairs;
2604  * for exclusion constraints */
2605  List *options; /* options from WITH clause */
2606  char *indexname; /* existing index to use; otherwise NULL */
2607  char *indexspace; /* index tablespace; NULL for default */
2608  bool reset_default_tblspc; /* reset default_tablespace prior to
2609  * creating the index */
2610  char *access_method; /* index access method; NULL for default */
2611  Node *where_clause; /* partial index predicate */
2612 
2613  /* Fields used for FOREIGN KEY constraints: */
2614  RangeVar *pktable; /* Primary key table */
2615  List *fk_attrs; /* Attributes of foreign key */
2616  List *pk_attrs; /* Corresponding attrs in PK table */
2617  char fk_matchtype; /* FULL, PARTIAL, SIMPLE */
2618  char fk_upd_action; /* ON UPDATE action */
2619  char fk_del_action; /* ON DELETE action */
2620  List *fk_del_set_cols; /* ON DELETE SET NULL/DEFAULT (col1, col2) */
2621  List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */
2622  Oid old_pktable_oid; /* pg_constraint.confrelid of my former
2623  * self */
2624 
2625  int location; /* token location, or -1 if unknown */
2627 
2628 /* ----------------------
2629  * Create/Drop Table Space Statements
2630  * ----------------------
2631  */
2632 
2633 typedef struct CreateTableSpaceStmt
2634 {
2638  char *location;
2641 
2642 typedef struct DropTableSpaceStmt
2643 {
2646  bool missing_ok; /* skip error if missing? */
2648 
2650 {
2654  bool isReset;
2656 
2658 {
2661  ObjectType objtype; /* Object type to move */
2662  List *roles; /* List of roles to move objects of */
2664  bool nowait;
2666 
2667 /* ----------------------
2668  * Create/Alter Extension Statements
2669  * ----------------------
2670  */
2671 
2672 typedef struct CreateExtensionStmt
2673 {
2675  char *extname;
2676  bool if_not_exists; /* just do nothing if it already exists? */
2677  List *options; /* List of DefElem nodes */
2679 
2680 /* Only used for ALTER EXTENSION UPDATE; later might need an action field */
2681 typedef struct AlterExtensionStmt
2682 {
2684  char *extname;
2685  List *options; /* List of DefElem nodes */
2687 
2689 {
2691  char *extname; /* Extension's name */
2692  int action; /* +1 = add object, -1 = drop object */
2693  ObjectType objtype; /* Object's type */
2694  Node *object; /* Qualified name of the object */
2696 
2697 /* ----------------------
2698  * Create/Alter FOREIGN DATA WRAPPER Statements
2699  * ----------------------
2700  */
2701 
2702 typedef struct CreateFdwStmt
2703 {
2705  char *fdwname; /* foreign-data wrapper name */
2706  List *func_options; /* HANDLER/VALIDATOR options */
2707  List *options; /* generic options to FDW */
2709 
2710 typedef struct AlterFdwStmt
2711 {
2713  char *fdwname; /* foreign-data wrapper name */
2714  List *func_options; /* HANDLER/VALIDATOR options */
2715  List *options; /* generic options to FDW */
2717 
2718 /* ----------------------
2719  * Create/Alter FOREIGN SERVER Statements
2720  * ----------------------
2721  */
2722 
2724 {
2726  char *servername; /* server name */
2727  char *servertype; /* optional server type */
2728  char *version; /* optional server version */
2729  char *fdwname; /* FDW name */
2730  bool if_not_exists; /* just do nothing if it already exists? */
2731  List *options; /* generic options to server */
2733 
2735 {
2737  char *servername; /* server name */
2738  char *version; /* optional server version */
2739  List *options; /* generic options to server */
2740  bool has_version; /* version specified */
2742 
2743 /* ----------------------
2744  * Create FOREIGN TABLE Statement
2745  * ----------------------
2746  */
2747 
2749 {
2751  char *servername;
2754 
2755 /* ----------------------
2756  * Create/Drop USER MAPPING Statements
2757  * ----------------------
2758  */
2759 
2761 {
2763  RoleSpec *user; /* user role */
2764  char *servername; /* server name */
2765  bool if_not_exists; /* just do nothing if it already exists? */
2766  List *options; /* generic options to server */
2768 
2769 typedef struct AlterUserMappingStmt
2770 {
2772  RoleSpec *user; /* user role */
2773  char *servername; /* server name */
2774  List *options; /* generic options to server */
2776 
2777 typedef struct DropUserMappingStmt
2778 {
2780  RoleSpec *user; /* user role */
2781  char *servername; /* server name */
2782  bool missing_ok; /* ignore missing mappings */
2784 
2785 /* ----------------------
2786  * Import Foreign Schema Statement
2787  * ----------------------
2788  */
2789 
2791 {
2792  FDW_IMPORT_SCHEMA_ALL, /* all relations wanted */
2793  FDW_IMPORT_SCHEMA_LIMIT_TO, /* include only listed tables in import */
2794  FDW_IMPORT_SCHEMA_EXCEPT, /* exclude listed tables from import */
2796 
2798 {
2800  char *server_name; /* FDW server name */
2801  char *remote_schema; /* remote schema name to query */
2802  char *local_schema; /* local schema to create objects in */
2803  ImportForeignSchemaType list_type; /* type of table list */
2804  List *table_list; /* List of RangeVar */
2805  List *options; /* list of options to pass to FDW */
2807 
2808 /*----------------------
2809  * Create POLICY Statement
2810  *----------------------
2811  */
2812 typedef struct CreatePolicyStmt
2813 {
2815  char *policy_name; /* Policy's name */
2816  RangeVar *table; /* the table name the policy applies to */
2817  char *cmd_name; /* the command name the policy applies to */
2818  bool permissive; /* restrictive or permissive policy */
2819  List *roles; /* the roles associated with the policy */
2820  Node *qual; /* the policy's condition */
2821  Node *with_check; /* the policy's WITH CHECK condition. */
2823 
2824 /*----------------------
2825  * Alter POLICY Statement
2826  *----------------------
2827  */
2828 typedef struct AlterPolicyStmt
2829 {
2831  char *policy_name; /* Policy's name */
2832  RangeVar *table; /* the table name the policy applies to */
2833  List *roles; /* the roles associated with the policy */
2834  Node *qual; /* the policy's condition */
2835  Node *with_check; /* the policy's WITH CHECK condition. */
2837 
2838 /*----------------------
2839  * Create ACCESS METHOD Statement
2840  *----------------------
2841  */
2842 typedef struct CreateAmStmt
2843 {
2845  char *amname; /* access method name */
2846  List *handler_name; /* handler function name */
2847  char amtype; /* type of access method */
2849 
2850 /* ----------------------
2851  * Create TRIGGER Statement
2852  * ----------------------
2853  */
2854 typedef struct CreateTrigStmt
2855 {
2857  bool replace; /* replace trigger if already exists */
2858  bool isconstraint; /* This is a constraint trigger */
2859  char *trigname; /* TRIGGER's name */
2860  RangeVar *relation; /* relation trigger is on */
2861  List *funcname; /* qual. name of function to call */
2862  List *args; /* list of String or NIL */
2863  bool row; /* ROW/STATEMENT */
2864  /* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
2865  int16 timing; /* BEFORE, AFTER, or INSTEAD */
2866  /* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
2867  int16 events; /* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */
2868  List *columns; /* column names, or NIL for all columns */
2869  Node *whenClause; /* qual expression, or NULL if none */
2870  /* explicitly named transition data */
2871  List *transitionRels; /* TriggerTransition nodes, or NIL if none */
2872  /* The remaining fields are only used for constraint triggers */
2873  bool deferrable; /* [NOT] DEFERRABLE */
2874  bool initdeferred; /* INITIALLY {DEFERRED|IMMEDIATE} */
2875  RangeVar *constrrel; /* opposite relation, if RI trigger */
2877 
2878 /* ----------------------
2879  * Create EVENT TRIGGER Statement
2880  * ----------------------
2881  */
2882 typedef struct CreateEventTrigStmt
2883 {
2885  char *trigname; /* TRIGGER's name */
2886  char *eventname; /* event's identifier */
2887  List *whenclause; /* list of DefElems indicating filtering */
2888  List *funcname; /* qual. name of function to call */
2890 
2891 /* ----------------------
2892  * Alter EVENT TRIGGER Statement
2893  * ----------------------
2894  */
2895 typedef struct AlterEventTrigStmt
2896 {
2898  char *trigname; /* TRIGGER's name */
2899  char tgenabled; /* trigger's firing configuration WRT
2900  * session_replication_role */
2902 
2903 /* ----------------------
2904  * Create LANGUAGE Statements
2905  * ----------------------
2906  */
2907 typedef struct CreatePLangStmt
2908 {
2910  bool replace; /* T => replace if already exists */
2911  char *plname; /* PL name */
2912  List *plhandler; /* PL call handler function (qual. name) */
2913  List *plinline; /* optional inline function (qual. name) */
2914  List *plvalidator; /* optional validator function (qual. name) */
2915  bool pltrusted; /* PL is trusted */
2917 
2918 /* ----------------------
2919  * Create/Alter/Drop Role Statements
2920  *
2921  * Note: these node types are also used for the backwards-compatible
2922  * Create/Alter/Drop User/Group statements. In the ALTER and DROP cases
2923  * there's really no need to distinguish what the original spelling was,
2924  * but for CREATE we mark the type because the defaults vary.
2925  * ----------------------
2926  */
2927 typedef enum RoleStmtType
2928 {
2933 
2934 typedef struct CreateRoleStmt
2935 {
2937  RoleStmtType stmt_type; /* ROLE/USER/GROUP */
2938  char *role; /* role name */
2939  List *options; /* List of DefElem nodes */
2941 
2942 typedef struct AlterRoleStmt
2943 {
2945  RoleSpec *role; /* role */
2946  List *options; /* List of DefElem nodes */
2947  int action; /* +1 = add members, -1 = drop members */
2949 
2950 typedef struct AlterRoleSetStmt
2951 {
2953  RoleSpec *role; /* role */
2954  char *database; /* database name, or NULL */
2955  VariableSetStmt *setstmt; /* SET or RESET subcommand */
2957 
2958 typedef struct DropRoleStmt
2959 {
2961  List *roles; /* List of roles to remove */
2962  bool missing_ok; /* skip error if a role is missing? */
2964 
2965 /* ----------------------
2966  * {Create|Alter} SEQUENCE Statement
2967  * ----------------------
2968  */
2969 
2970 typedef struct CreateSeqStmt
2971 {
2973  RangeVar *sequence; /* the sequence to create */
2975  Oid ownerId; /* ID of owner, or InvalidOid for default */
2977  bool if_not_exists; /* just do nothing if it already exists? */
2979 
2980 typedef struct AlterSeqStmt
2981 {
2983  RangeVar *sequence; /* the sequence to alter */
2986  bool missing_ok; /* skip error if a role is missing? */
2988 
2989 /* ----------------------
2990  * Create {Aggregate|Operator|Type} Statement
2991  * ----------------------
2992  */
2993 typedef struct DefineStmt
2994 {
2996  ObjectType kind; /* aggregate, operator, type */
2997  bool oldstyle; /* hack to signal old CREATE AGG syntax */
2998  List *defnames; /* qualified name (list of String) */
2999  List *args; /* a list of TypeName (if needed) */
3000  List *definition; /* a list of DefElem */
3001  bool if_not_exists; /* just do nothing if it already exists? */
3002  bool replace; /* replace if already exists? */
3004 
3005 /* ----------------------
3006  * Create Domain Statement
3007  * ----------------------
3008  */
3009 typedef struct CreateDomainStmt
3010 {
3012  List *domainname; /* qualified name (list of String) */
3013  TypeName *typeName; /* the base type */
3014  CollateClause *collClause; /* untransformed COLLATE spec, if any */
3015  List *constraints; /* constraints (list of Constraint nodes) */
3017 
3018 /* ----------------------
3019  * Create Operator Class Statement
3020  * ----------------------
3021  */
3022 typedef struct CreateOpClassStmt
3023 {
3025  List *opclassname; /* qualified name (list of String) */
3026  List *opfamilyname; /* qualified name (ditto); NIL if omitted */
3027  char *amname; /* name of index AM opclass is for */
3028  TypeName *datatype; /* datatype of indexed column */
3029  List *items; /* List of CreateOpClassItem nodes */
3030  bool isDefault; /* Should be marked as default for type? */
3032 
3033 #define OPCLASS_ITEM_OPERATOR 1
3034 #define OPCLASS_ITEM_FUNCTION 2
3035 #define OPCLASS_ITEM_STORAGETYPE 3
3036 
3037 typedef struct CreateOpClassItem
3038 {
3040  int itemtype; /* see codes above */
3041  ObjectWithArgs *name; /* operator or function name and args */
3042  int number; /* strategy num or support proc num */
3043  List *order_family; /* only used for ordering operators */
3044  List *class_args; /* amproclefttype/amprocrighttype or
3045  * amoplefttype/amoprighttype */
3046  /* fields used for a storagetype item: */
3047  TypeName *storedtype; /* datatype stored in index */
3049 
3050 /* ----------------------
3051  * Create Operator Family Statement
3052  * ----------------------
3053  */
3054 typedef struct CreateOpFamilyStmt
3055 {
3057  List *opfamilyname; /* qualified name (list of String) */
3058  char *amname; /* name of index AM opfamily is for */
3060 
3061 /* ----------------------
3062  * Alter Operator Family Statement
3063  * ----------------------
3064  */
3065 typedef struct AlterOpFamilyStmt
3066 {
3068  List *opfamilyname; /* qualified name (list of String) */
3069  char *amname; /* name of index AM opfamily is for */
3070  bool isDrop; /* ADD or DROP the items? */
3071  List *items; /* List of CreateOpClassItem nodes */
3073 
3074 /* ----------------------
3075  * Drop Table|Sequence|View|Index|Type|Domain|Conversion|Schema Statement
3076  * ----------------------
3077  */
3078 
3079 typedef struct DropStmt
3080 {
3082  List *objects; /* list of names */
3083  ObjectType removeType; /* object type */
3084  DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3085  bool missing_ok; /* skip error if object is missing? */
3086  bool concurrent; /* drop index concurrently? */
3088 
3089 /* ----------------------
3090  * Truncate Table Statement
3091  * ----------------------
3092  */
3093 typedef struct TruncateStmt
3094 {
3096  List *relations; /* relations (RangeVars) to be truncated */
3097  bool restart_seqs; /* restart owned sequences? */
3098  DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3100 
3101 /* ----------------------
3102  * Comment On Statement
3103  * ----------------------
3104  */
3105 typedef struct CommentStmt
3106 {
3108  ObjectType objtype; /* Object's type */
3109  Node *object; /* Qualified name of the object */
3110  char *comment; /* Comment to insert, or NULL to remove */
3112 
3113 /* ----------------------
3114  * SECURITY LABEL Statement
3115  * ----------------------
3116  */
3117 typedef struct SecLabelStmt
3118 {
3120  ObjectType objtype; /* Object's type */
3121  Node *object; /* Qualified name of the object */
3122  char *provider; /* Label provider (or NULL) */
3123  char *label; /* New security label to be assigned */
3125 
3126 /* ----------------------
3127  * Declare Cursor Statement
3128  *
3129  * The "query" field is initially a raw parse tree, and is converted to a
3130  * Query node during parse analysis. Note that rewriting and planning
3131  * of the query are always postponed until execution.
3132  * ----------------------
3133  */
3134 #define CURSOR_OPT_BINARY 0x0001 /* BINARY */
3135 #define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */
3136 #define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */
3137 #define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */
3138 #define CURSOR_OPT_ASENSITIVE 0x0010 /* ASENSITIVE */
3139 #define CURSOR_OPT_HOLD 0x0020 /* WITH HOLD */
3140 /* these planner-control flags do not correspond to any SQL grammar: */
3141 #define CURSOR_OPT_FAST_PLAN 0x0100 /* prefer fast-start plan */
3142 #define CURSOR_OPT_GENERIC_PLAN 0x0200 /* force use of generic plan */
3143 #define CURSOR_OPT_CUSTOM_PLAN 0x0400 /* force use of custom plan */
3144 #define CURSOR_OPT_PARALLEL_OK 0x0800 /* parallel mode OK */
3145 
3146 typedef struct DeclareCursorStmt
3147 {
3149  char *portalname; /* name of the portal (cursor) */
3150  int options; /* bitmask of options (see above) */
3151  Node *query; /* the query (see comments above) */
3153 
3154 /* ----------------------
3155  * Close Portal Statement
3156  * ----------------------
3157  */
3158 typedef struct ClosePortalStmt
3159 {
3161  char *portalname; /* name of the portal (cursor) */
3162  /* NULL means CLOSE ALL */
3164 
3165 /* ----------------------
3166  * Fetch Statement (also Move)
3167  * ----------------------
3168  */
3169 typedef enum FetchDirection
3170 {
3171  /* for these, howMany is how many rows to fetch; FETCH_ALL means ALL */
3174  /* for these, howMany indicates a position; only one row is fetched */
3178 
3179 #define FETCH_ALL LONG_MAX
3180 
3181 typedef struct FetchStmt
3182 {
3184  FetchDirection direction; /* see above */
3185  long howMany; /* number of rows, or position argument */
3186  char *portalname; /* name of portal (cursor) */
3187  bool ismove; /* true if MOVE */
3189 
3190 /* ----------------------
3191  * Create Index Statement
3192  *
3193  * This represents creation of an index and/or an associated constraint.
3194  * If isconstraint is true, we should create a pg_constraint entry along
3195  * with the index. But if indexOid isn't InvalidOid, we are not creating an
3196  * index, just a UNIQUE/PKEY constraint using an existing index. isconstraint
3197  * must always be true in this case, and the fields describing the index
3198  * properties are empty.
3199  * ----------------------
3200  */
3201 typedef struct IndexStmt
3202 {
3204  char *idxname; /* name of new index, or NULL for default */
3205  RangeVar *relation; /* relation to build index on */
3206  char *accessMethod; /* name of access method (eg. btree) */
3207  char *tableSpace; /* tablespace, or NULL for default */
3208  List *indexParams; /* columns to index: a list of IndexElem */
3209  List *indexIncludingParams; /* additional columns to index: a list
3210  * of IndexElem */
3211  List *options; /* WITH clause options: a list of DefElem */
3212  Node *whereClause; /* qualification (partial-index predicate) */
3213  List *excludeOpNames; /* exclusion operator names, or NIL if none */
3214  char *idxcomment; /* comment to apply to index, or NULL */
3215  Oid indexOid; /* OID of an existing index, if any */
3216  RelFileNumber oldNumber; /* relfilenumber of existing storage, if any */
3217  SubTransactionId oldCreateSubid; /* rd_createSubid of oldNumber */
3218  SubTransactionId oldFirstRelfilelocatorSubid; /* rd_firstRelfilelocatorSubid
3219  * of oldNumber */
3220  bool unique; /* is index unique? */
3221  bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
3222  bool primary; /* is index a primary key? */
3223  bool isconstraint; /* is it for a pkey/unique constraint? */
3224  bool iswithoutoverlaps; /* is the constraint WITHOUT OVERLAPS? */
3225  bool deferrable; /* is the constraint DEFERRABLE? */
3226  bool initdeferred; /* is the constraint INITIALLY DEFERRED? */
3227  bool transformed; /* true when transformIndexStmt is finished */
3228  bool concurrent; /* should this be a concurrent index build? */
3229  bool if_not_exists; /* just do nothing if index already exists? */
3230  bool reset_default_tblspc; /* reset default_tablespace prior to
3231  * executing */
3233 
3234 /* ----------------------
3235  * Create Statistics Statement
3236  * ----------------------
3237  */
3238 typedef struct CreateStatsStmt
3239 {
3241  List *defnames; /* qualified name (list of String) */
3242  List *stat_types; /* stat types (list of String) */
3243  List *exprs; /* expressions to build statistics on */
3244  List *relations; /* rels to build stats on (list of RangeVar) */
3245  char *stxcomment; /* comment to apply to stats, or NULL */
3246  bool transformed; /* true when transformStatsStmt is finished */
3247  bool if_not_exists; /* do nothing if stats name already exists */
3249 
3250 /*
3251  * StatsElem - statistics parameters (used in CREATE STATISTICS)
3252  *
3253  * For a plain attribute, 'name' is the name of the referenced table column
3254  * and 'expr' is NULL. For an expression, 'name' is NULL and 'expr' is the
3255  * expression tree.
3256  */
3257 typedef struct StatsElem
3258 {
3260  char *name; /* name of attribute to index, or NULL */
3261  Node *expr; /* expression to index, or NULL */
3263 
3264 
3265 /* ----------------------
3266  * Alter Statistics Statement
3267  * ----------------------
3268  */
3269 typedef struct AlterStatsStmt
3270 {
3272  List *defnames; /* qualified name (list of String) */
3273  Node *stxstattarget; /* statistics target */
3274  bool missing_ok; /* skip error if statistics object is missing */
3276 
3277 /* ----------------------
3278  * Create Function Statement
3279  * ----------------------
3280  */
3281 typedef struct CreateFunctionStmt
3282 {
3284  bool is_procedure; /* it's really CREATE PROCEDURE */
3285  bool replace; /* T => replace if already exists */
3286  List *funcname; /* qualified name of function to create */
3287  List *parameters; /* a list of FunctionParameter */
3288  TypeName *returnType; /* the return type */
3289  List *options; /* a list of DefElem */
3292 
3294 {
3295  /* the assigned enum values appear in pg_proc, don't change 'em! */
3296  FUNC_PARAM_IN = 'i', /* input only */
3297  FUNC_PARAM_OUT = 'o', /* output only */
3298  FUNC_PARAM_INOUT = 'b', /* both */
3299  FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */
3300  FUNC_PARAM_TABLE = 't', /* table function output column */
3301  /* this is not used in pg_proc: */
3302  FUNC_PARAM_DEFAULT = 'd', /* default; effectively same as IN */
3304 
3305 typedef struct FunctionParameter
3306 {
3308  char *name; /* parameter name, or NULL if not given */
3309  TypeName *argType; /* TypeName for parameter type */
3310  FunctionParameterMode mode; /* IN/OUT/etc */
3311  Node *defexpr; /* raw default expr, or NULL if not given */
3313 
3314 typedef struct AlterFunctionStmt
3315 {
3318  ObjectWithArgs *func; /* name and args of function */
3319  List *actions; /* list of DefElem */
3321 
3322 /* ----------------------
3323  * DO Statement
3324  *
3325  * DoStmt is the raw parser output, InlineCodeBlock is the execution-time API
3326  * ----------------------
3327  */
3328 typedef struct DoStmt
3329 {
3331  List *args; /* List of DefElem nodes */
3333 
3334 typedef struct InlineCodeBlock
3335 {
3336  pg_node_attr(nodetag_only) /* this is not a member of parse trees */
3337 
3338  NodeTag type;
3339  char *source_text; /* source text of anonymous code block */
3340  Oid langOid; /* OID of selected language */
3341  bool langIsTrusted; /* trusted property of the language */
3342  bool atomic; /* atomic execution context */
3344 
3345 /* ----------------------
3346  * CALL statement
3347  *
3348  * OUT-mode arguments are removed from the transformed funcexpr. The outargs
3349  * list contains copies of the expressions for all output arguments, in the
3350  * order of the procedure's declared arguments. (outargs is never evaluated,
3351  * but is useful to the caller as a reference for what to assign to.)
3352  * The transformed call state is not relevant in the query jumbling, only the
3353  * function call is.
3354  * ----------------------
3355  */
3356 typedef struct CallStmt
3357 {
3359  /* from the parser */
3360  FuncCall *funccall pg_node_attr(query_jumble_ignore);
3361  /* transformed call, with only input args */
3363  /* transformed output-argument expressions */
3366 
3367 typedef struct CallContext
3368 {
3369  pg_node_attr(nodetag_only) /* this is not a member of parse trees */
3370 
3371  NodeTag type;
3372  bool atomic;
3374 
3375 /* ----------------------
3376  * Alter Object Rename Statement
3377  * ----------------------
3378  */
3379 typedef struct RenameStmt
3380 {
3382  ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */
3383  ObjectType relationType; /* if column name, associated relation type */
3384  RangeVar *relation; /* in case it's a table */
3385  Node *object; /* in case it's some other object */
3386  char *subname; /* name of contained object (column, rule,
3387  * trigger, etc) */
3388  char *newname; /* the new name */
3389  DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3390  bool missing_ok; /* skip error if missing? */
3392 
3393 /* ----------------------
3394  * ALTER object DEPENDS ON EXTENSION extname
3395  * ----------------------
3396  */
3398 {
3400  ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */
3401  RangeVar *relation; /* in case a table is involved */
3402  Node *object; /* name of the object */
3403  String *extname; /* extension name */
3404  bool remove; /* set true to remove dep rather than add */
3406 
3407 /* ----------------------
3408  * ALTER object SET SCHEMA Statement
3409  * ----------------------
3410  */
3412 {
3414  ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
3415  RangeVar *relation; /* in case it's a table */
3416  Node *object; /* in case it's some other object */
3417  char *newschema; /* the new schema */
3418  bool missing_ok; /* skip error if missing? */
3420 
3421 /* ----------------------
3422  * Alter Object Owner Statement
3423  * ----------------------
3424  */
3425 typedef struct AlterOwnerStmt
3426 {
3428  ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
3429  RangeVar *relation; /* in case it's a table */
3430  Node *object; /* in case it's some other object */
3431  RoleSpec *newowner; /* the new owner */
3433 
3434 /* ----------------------
3435  * Alter Operator Set ( this-n-that )
3436  * ----------------------
3437  */
3438 typedef struct AlterOperatorStmt
3439 {
3441  ObjectWithArgs *opername; /* operator name and argument types */
3442  List *options; /* List of DefElem nodes */
3444 
3445 /* ------------------------
3446  * Alter Type Set ( this-n-that )
3447  * ------------------------
3448  */
3449 typedef struct AlterTypeStmt
3450 {
3452  List *typeName; /* type name (possibly qualified) */
3453  List *options; /* List of DefElem nodes */
3455 
3456 /* ----------------------
3457  * Create Rule Statement
3458  * ----------------------
3459  */
3460 typedef struct RuleStmt
3461 {
3463  RangeVar *relation; /* relation the rule is for */
3464  char *rulename; /* name of the rule */
3465  Node *whereClause; /* qualifications */
3466  CmdType event; /* SELECT, INSERT, etc */
3467  bool instead; /* is a 'do instead'? */
3468  List *actions; /* the action statements */
3469  bool replace; /* OR REPLACE */
3471 
3472 /* ----------------------
3473  * Notify Statement
3474  * ----------------------
3475  */
3476 typedef struct NotifyStmt
3477 {
3479  char *conditionname; /* condition name to notify */
3480  char *payload; /* the payload string, or NULL if none */
3482 
3483 /* ----------------------
3484  * Listen Statement
3485  * ----------------------
3486  */
3487 typedef struct ListenStmt
3488 {
3490  char *conditionname; /* condition name to listen on */
3492 
3493 /* ----------------------
3494  * Unlisten Statement
3495  * ----------------------
3496  */
3497 typedef struct UnlistenStmt
3498 {
3500  char *conditionname; /* name to unlisten on, or NULL for all */
3502 
3503 /* ----------------------
3504  * {Begin|Commit|Rollback} Transaction Statement
3505  * ----------------------
3506  */
3508 {
3510  TRANS_STMT_START, /* semantically identical to BEGIN */
3520 
3521 typedef struct TransactionStmt
3522 {
3524  TransactionStmtKind kind; /* see above */
3525  List *options; /* for BEGIN/START commands */
3526  /* for savepoint commands */
3527  char *savepoint_name pg_node_attr(query_jumble_ignore);
3528  /* for two-phase-commit related commands */
3529  char *gid pg_node_attr(query_jumble_ignore);
3530  bool chain; /* AND CHAIN option */
3531  /* token location, or -1 if unknown */
3532  int location pg_node_attr(query_jumble_location);
3534 
3535 /* ----------------------
3536  * Create Type Statement, composite types
3537  * ----------------------
3538  */
3539 typedef struct CompositeTypeStmt
3540 {
3542  RangeVar *typevar; /* the composite type to be created */
3543  List *coldeflist; /* list of ColumnDef nodes */
3545 
3546 /* ----------------------
3547  * Create Type Statement, enum types
3548  * ----------------------
3549  */
3550 typedef struct CreateEnumStmt
3551 {
3553  List *typeName; /* qualified name (list of String) */
3554  List *vals; /* enum values (list of String) */
3556 
3557 /* ----------------------
3558  * Create Type Statement, range types
3559  * ----------------------
3560  */
3561 typedef struct CreateRangeStmt
3562 {
3564  List *typeName; /* qualified name (list of String) */
3565  List *params; /* range parameters (list of DefElem) */
3567 
3568 /* ----------------------
3569  * Alter Type Statement, enum types
3570  * ----------------------
3571  */
3572 typedef struct AlterEnumStmt
3573 {
3575  List *typeName; /* qualified name (list of String) */
3576  char *oldVal; /* old enum value's name, if renaming */
3577  char *newVal; /* new enum value's name */
3578  char *newValNeighbor; /* neighboring enum value, if specified */
3579  bool newValIsAfter; /* place new enum value after neighbor? */
3580  bool skipIfNewValExists; /* no error if new already exists? */
3582 
3583 /* ----------------------
3584  * Create View Statement
3585  * ----------------------
3586  */
3587 typedef enum ViewCheckOption
3588 {
3593 
3594 typedef struct ViewStmt
3595 {
3597  RangeVar *view; /* the view to be created */
3598  List *aliases; /* target column names */
3599  Node *query; /* the SELECT query (as a raw parse tree) */
3600  bool replace; /* replace an existing view? */
3601  List *options; /* options from WITH clause */
3602  ViewCheckOption withCheckOption; /* WITH CHECK OPTION */
3604 
3605 /* ----------------------
3606  * Load Statement
3607  * ----------------------
3608  */
3609 typedef struct LoadStmt
3610 {
3612  char *filename; /* file to load */
3614 
3615 /* ----------------------
3616  * Createdb Statement
3617  * ----------------------
3618  */
3619 typedef struct CreatedbStmt
3620 {
3622  char *dbname; /* name of database to create */
3623  List *options; /* List of DefElem nodes */
3625 
3626 /* ----------------------
3627  * Alter Database
3628  * ----------------------
3629  */
3630 typedef struct AlterDatabaseStmt
3631 {
3633  char *dbname; /* name of database to alter */
3634  List *options; /* List of DefElem nodes */
3636 
3638 {
3640  char *dbname;
3642 
3643 typedef struct AlterDatabaseSetStmt
3644 {
3646  char *dbname; /* database name */
3647  VariableSetStmt *setstmt; /* SET or RESET subcommand */
3649 
3650 /* ----------------------
3651  * Dropdb Statement
3652  * ----------------------
3653  */
3654 typedef struct DropdbStmt
3655 {
3657  char *dbname; /* database to drop */
3658  bool missing_ok; /* skip error if db is missing? */
3659  List *options; /* currently only FORCE is supported */
3661 
3662 /* ----------------------
3663  * Alter System Statement
3664  * ----------------------
3665  */
3666 typedef struct AlterSystemStmt
3667 {
3669  VariableSetStmt *setstmt; /* SET subcommand */
3671 
3672 /* ----------------------
3673  * Cluster Statement (support pbrown's cluster index implementation)
3674  * ----------------------
3675  */
3676 typedef struct ClusterStmt
3677 {
3679  RangeVar *relation; /* relation being indexed, or NULL if all */
3680  char *indexname; /* original index defined */
3681  List *params; /* list of DefElem nodes */
3683 
3684 /* ----------------------
3685  * Vacuum and Analyze Statements
3686  *
3687  * Even though these are nominally two statements, it's convenient to use
3688  * just one node type for both.
3689  * ----------------------
3690  */
3691 typedef struct VacuumStmt
3692 {
3694  List *options; /* list of DefElem nodes */
3695  List *rels; /* list of VacuumRelation, or NIL for all */
3696  bool is_vacuumcmd; /* true for VACUUM, false for ANALYZE */
3698 
3699 /*
3700  * Info about a single target table of VACUUM/ANALYZE.
3701  *
3702  * If the OID field is set, it always identifies the table to process.
3703  * Then the relation field can be NULL; if it isn't, it's used only to report
3704  * failure to open/lock the relation.
3705  */
3706 typedef struct VacuumRelation
3707 {
3709  RangeVar *relation; /* table name to process, or NULL */
3710  Oid oid; /* table's OID; InvalidOid if not looked up */
3711  List *va_cols; /* list of column names, or NIL for all */
3713 
3714 /* ----------------------
3715  * Explain Statement
3716  *
3717  * The "query" field is initially a raw parse tree, and is converted to a
3718  * Query node during parse analysis. Note that rewriting and planning
3719  * of the query are always postponed until execution.
3720  * ----------------------
3721  */
3722 typedef struct ExplainStmt
3723 {
3725  Node *query; /* the query (see comments above) */
3726  List *options; /* list of DefElem nodes */
3728 
3729 /* ----------------------
3730  * CREATE TABLE AS Statement (a/k/a SELECT INTO)
3731  *
3732  * A query written as CREATE TABLE AS will produce this node type natively.
3733  * A query written as SELECT ... INTO will be transformed to this form during
3734  * parse analysis.
3735  * A query written as CREATE MATERIALIZED view will produce this node type,
3736  * during parse analysis, since it needs all the same data.
3737  *
3738  * The "query" field is handled similarly to EXPLAIN, though note that it
3739  * can be a SELECT or an EXECUTE, but not other DML statements.
3740  * ----------------------
3741  */
3742 typedef struct CreateTableAsStmt
3743 {
3745  Node *query; /* the query (see comments above) */
3746  IntoClause *into; /* destination table */
3747  ObjectType objtype; /* OBJECT_TABLE or OBJECT_MATVIEW */
3748  bool is_select_into; /* it was written as SELECT INTO */
3749  bool if_not_exists; /* just do nothing if it already exists? */
3751 
3752 /* ----------------------
3753  * REFRESH MATERIALIZED VIEW Statement
3754  * ----------------------
3755  */
3756 typedef struct RefreshMatViewStmt
3757 {
3759  bool concurrent; /* allow concurrent access? */
3760  bool skipData; /* true for WITH NO DATA */
3761  RangeVar *relation; /* relation to insert into */
3763 
3764 /* ----------------------
3765  * Checkpoint Statement
3766  * ----------------------
3767  */
3768 typedef struct CheckPointStmt
3769 {
3772 
3773 /* ----------------------
3774  * Discard Statement
3775  * ----------------------
3776  */
3777 
3778 typedef enum DiscardMode
3779 {
3785 
3786 typedef struct DiscardStmt
3787 {
3791 
3792 /* ----------------------
3793  * LOCK Statement
3794  * ----------------------
3795  */
3796 typedef struct LockStmt
3797 {
3799  List *relations; /* relations to lock */
3800  int mode; /* lock mode */
3801  bool nowait; /* no wait mode */
3803 
3804 /* ----------------------
3805  * SET CONSTRAINTS Statement
3806  * ----------------------
3807  */
3808 typedef struct ConstraintsSetStmt
3809 {
3811  List *constraints; /* List of names as RangeVars */
3812  bool deferred;
3814 
3815 /* ----------------------
3816  * REINDEX Statement
3817  * ----------------------
3818  */
3819 typedef enum ReindexObjectType
3820 {
3822  REINDEX_OBJECT_TABLE, /* table or materialized view */
3824  REINDEX_OBJECT_SYSTEM, /* system catalogs */
3825  REINDEX_OBJECT_DATABASE, /* database */
3827 
3828 typedef struct ReindexStmt
3829 {
3831  ReindexObjectType kind; /* REINDEX_OBJECT_INDEX, REINDEX_OBJECT_TABLE,
3832  * etc. */
3833  RangeVar *relation; /* Table or index to reindex */
3834  const char *name; /* name of database to reindex */
3835  List *params; /* list of DefElem nodes */
3837 
3838 /* ----------------------
3839  * CREATE CONVERSION Statement
3840  * ----------------------
3841  */
3842 typedef struct CreateConversionStmt
3843 {
3845  List *conversion_name; /* Name of the conversion */
3846  char *for_encoding_name; /* source encoding name */
3847  char *to_encoding_name; /* destination encoding name */
3848  List *func_name; /* qualified conversion function name */
3849  bool def; /* is this a default conversion? */
3851 
3852 /* ----------------------
3853  * CREATE CAST Statement
3854  * ----------------------
3855  */
3856 typedef struct CreateCastStmt
3857 {
3863  bool inout;
3865 
3866 /* ----------------------
3867  * CREATE TRANSFORM Statement
3868  * ----------------------
3869  */
3870 typedef struct CreateTransformStmt
3871 {
3873  bool replace;
3875  char *lang;
3879 
3880 /* ----------------------
3881  * PREPARE Statement
3882  * ----------------------
3883  */
3884 typedef struct PrepareStmt
3885 {
3887  char *name; /* Name of plan, arbitrary */
3888  List *argtypes; /* Types of parameters (List of TypeName) */
3889  Node *query; /* The query itself (as a raw parsetree) */
3891 
3892 
3893 /* ----------------------
3894  * EXECUTE Statement
3895  * ----------------------
3896  */
3897 
3898 typedef struct ExecuteStmt
3899 {
3901  char *name; /* The name of the plan to execute */
3902  List *params; /* Values to assign to parameters */
3904 
3905 
3906 /* ----------------------
3907  * DEALLOCATE Statement
3908  * ----------------------
3909  */
3910 typedef struct DeallocateStmt
3911 {
3913  /* The name of the plan to remove, NULL if DEALLOCATE ALL */
3914  char *name pg_node_attr(query_jumble_ignore);
3915  /* true if DEALLOCATE ALL */
3916  bool isall;
3917  /* token location, or -1 if unknown */
3918  int location pg_node_attr(query_jumble_location);
3920 
3921 /*
3922  * DROP OWNED statement
3923  */
3924 typedef struct DropOwnedStmt
3925 {
3930 
3931 /*
3932  * REASSIGN OWNED statement
3933  */
3934 typedef struct ReassignOwnedStmt
3935 {
3940 
3941 /*
3942  * TS Dictionary stmts: DefineStmt, RenameStmt and DropStmt are default
3943  */
3945 {
3947  List *dictname; /* qualified name (list of String) */
3948  List *options; /* List of DefElem nodes */
3950 
3951 /*
3952  * TS Configuration stmts: DefineStmt, RenameStmt and DropStmt are default
3953  */
3954 typedef enum AlterTSConfigType
3955 {
3962 
3964 {
3966  AlterTSConfigType kind; /* ALTER_TSCONFIG_ADD_MAPPING, etc */
3967  List *cfgname; /* qualified name (list of String) */
3968 
3969  /*
3970  * dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is
3971  * NIL, but tokentype isn't, DROP MAPPING was specified.
3972  */
3973  List *tokentype; /* list of String */
3974  List *dicts; /* list of list of String */
3975  bool override; /* if true - remove old variant */
3976  bool replace; /* if true - replace dictionary by another */
3977  bool missing_ok; /* for DROP - skip error if missing? */
3979 
3980 typedef struct PublicationTable
3981 {
3983  RangeVar *relation; /* relation to be published */
3984  Node *whereClause; /* qualifications */
3985  List *columns; /* List of columns in a publication table */
3987 
3988 /*
3989  * Publication object type
3990  */
3992 {
3993  PUBLICATIONOBJ_TABLE, /* A table */
3994  PUBLICATIONOBJ_TABLES_IN_SCHEMA, /* All tables in schema */
3995  PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA, /* All tables in first element of
3996  * search_path */
3997  PUBLICATIONOBJ_CONTINUATION, /* Continuation of previous type */
3999 
4000 typedef struct PublicationObjSpec
4001 {
4003  PublicationObjSpecType pubobjtype; /* type of this publication object */
4004  char *name;
4006  int location; /* token location, or -1 if unknown */
4008 
4010 {
4012  char *pubname; /* Name of the publication */
4013  List *options; /* List of DefElem nodes */
4014  List *pubobjects; /* Optional list of publication objects */
4015  bool for_all_tables; /* Special publication for all tables in db */
4017 
4019 {
4020  AP_AddObjects, /* add objects to publication */
4021  AP_DropObjects, /* remove objects from publication */
4022  AP_SetObjects, /* set list of objects */
4024 
4025 typedef struct AlterPublicationStmt
4026 {
4028  char *pubname; /* Name of the publication */
4029 
4030  /* parameters used for ALTER PUBLICATION ... WITH */
4031  List *options; /* List of DefElem nodes */
4032 
4033  /*
4034  * Parameters used for ALTER PUBLICATION ... ADD/DROP/SET publication
4035  * objects.
4036  */
4037  List *pubobjects; /* Optional list of publication objects */
4038  bool for_all_tables; /* Special publication for all tables in db */
4039  AlterPublicationAction action; /* What action to perform with the given
4040  * objects */
4042 
4044 {
4046  char *subname; /* Name of the subscription */
4047  char *conninfo; /* Connection string to publisher */
4048  List *publication; /* One or more publication to subscribe to */
4049  List *options; /* List of DefElem nodes */
4051 
4053 {
4063 
4065 {
4067  AlterSubscriptionType kind; /* ALTER_SUBSCRIPTION_OPTIONS, etc */
4068  char *subname; /* Name of the subscription */
4069  char *conninfo; /* Connection string to publisher */
4070  List *publication; /* One or more publication to subscribe to */
4071  List *options; /* List of DefElem nodes */
4073 
4074 typedef struct DropSubscriptionStmt
4075 {
4077  char *subname; /* Name of the subscription */
4078  bool missing_ok; /* Skip error if missing? */
4079  DropBehavior behavior; /* RESTRICT or CASCADE behavior */
4081 
4082 #endif /* PARSENODES_H */
#define PG_INT32_MAX
Definition: c.h:576
signed short int16
Definition: c.h:480
uint32 SubTransactionId
Definition: c.h:643
signed int int32
Definition: c.h:481
uint32 bits32
Definition: c.h:502
unsigned int Index
Definition: c.h:601
LockWaitPolicy
Definition: lockoptions.h:37
LockClauseStrength
Definition: lockoptions.h:22
OnConflictAction
Definition: nodes.h:406
double Cardinality
Definition: nodes.h:242
CmdType
Definition: nodes.h:253
NodeTag
Definition: nodes.h:27
LimitOption
Definition: nodes.h:419
JoinType
Definition: nodes.h:278
struct AlterDatabaseRefreshCollStmt AlterDatabaseRefreshCollStmt
struct LoadStmt LoadStmt
RoleSpecType
Definition: parsenodes.h:392
@ ROLESPEC_CURRENT_USER
Definition: parsenodes.h:395
@ ROLESPEC_CSTRING
Definition: parsenodes.h:393
@ ROLESPEC_SESSION_USER
Definition: parsenodes.h:396
@ ROLESPEC_CURRENT_ROLE
Definition: parsenodes.h:394
@ ROLESPEC_PUBLIC
Definition: parsenodes.h:397
struct DropSubscriptionStmt DropSubscriptionStmt
struct CreateEnumStmt CreateEnumStmt
struct RoleSpec RoleSpec
struct CreateFunctionStmt CreateFunctionStmt
struct AlterOwnerStmt AlterOwnerStmt
struct ReturnStmt ReturnStmt
struct CreateAmStmt CreateAmStmt
AlterSubscriptionType
Definition: parsenodes.h:4053
@ ALTER_SUBSCRIPTION_ENABLED
Definition: parsenodes.h:4060
@ ALTER_SUBSCRIPTION_DROP_PUBLICATION
Definition: parsenodes.h:4058
@ ALTER_SUBSCRIPTION_SET_PUBLICATION
Definition: parsenodes.h:4056
@ ALTER_SUBSCRIPTION_REFRESH
Definition: parsenodes.h:4059
@ ALTER_SUBSCRIPTION_SKIP
Definition: parsenodes.h:4061
@ ALTER_SUBSCRIPTION_OPTIONS
Definition: parsenodes.h:4054
@ ALTER_SUBSCRIPTION_CONNECTION
Definition: parsenodes.h:4055
@ ALTER_SUBSCRIPTION_ADD_PUBLICATION
Definition: parsenodes.h:4057
struct TableLikeClause TableLikeClause
struct AlterSystemStmt AlterSystemStmt
struct CopyStmt CopyStmt
TransactionStmtKind
Definition: parsenodes.h:3508
@ TRANS_STMT_ROLLBACK_TO
Definition: parsenodes.h:3515
@ TRANS_STMT_START
Definition: parsenodes.h:3510
@ TRANS_STMT_SAVEPOINT
Definition: parsenodes.h:3513
@ TRANS_STMT_BEGIN
Definition: parsenodes.h:3509
@ TRANS_STMT_ROLLBACK
Definition: parsenodes.h:3512
@ TRANS_STMT_COMMIT_PREPARED
Definition: parsenodes.h:3517
@ TRANS_STMT_COMMIT
Definition: parsenodes.h:3511
@ TRANS_STMT_ROLLBACK_PREPARED
Definition: parsenodes.h:3518
@ TRANS_STMT_PREPARE
Definition: parsenodes.h:3516
@ TRANS_STMT_RELEASE
Definition: parsenodes.h:3514
struct GrantRoleStmt GrantRoleStmt
struct AlterTSDictionaryStmt AlterTSDictionaryStmt
struct OnConflictClause OnConflictClause
struct AlterOperatorStmt AlterOperatorStmt
WCOKind
Definition: parsenodes.h:1317
@ WCO_RLS_MERGE_UPDATE_CHECK
Definition: parsenodes.h:1322
@ WCO_RLS_CONFLICT_CHECK
Definition: parsenodes.h:1321
@ WCO_RLS_INSERT_CHECK
Definition: parsenodes.h:1319
@ WCO_VIEW_CHECK
Definition: parsenodes.h:1318
@ WCO_RLS_UPDATE_CHECK
Definition: parsenodes.h:1320
@ WCO_RLS_MERGE_DELETE_CHECK
Definition: parsenodes.h:1323
struct RangeTblFunction RangeTblFunction
struct JsonScalarExpr JsonScalarExpr
struct JsonArrayAgg JsonArrayAgg
struct A_Indirection A_Indirection
struct XmlSerialize XmlSerialize
SortByNulls
Definition: parsenodes.h:53
@ SORTBY_NULLS_DEFAULT
Definition: parsenodes.h:54
@ SORTBY_NULLS_LAST
Definition: parsenodes.h:56
@ SORTBY_NULLS_FIRST
Definition: parsenodes.h:55
struct DeallocateStmt DeallocateStmt
struct CreateSeqStmt CreateSeqStmt
struct DropTableSpaceStmt DropTableSpaceStmt
struct CreateExtensionStmt CreateExtensionStmt
struct A_Indices A_Indices
struct CreateTableSpaceStmt CreateTableSpaceStmt
GroupingSetKind
Definition: parsenodes.h:1456
@ GROUPING_SET_CUBE
Definition: parsenodes.h:1460
@ GROUPING_SET_SIMPLE
Definition: parsenodes.h:1458
@ GROUPING_SET_ROLLUP
Definition: parsenodes.h:1459
@ GROUPING_SET_SETS
Definition: parsenodes.h:1461
@ GROUPING_SET_EMPTY
Definition: parsenodes.h:1457
struct ReassignOwnedStmt ReassignOwnedStmt
struct ParamRef ParamRef
struct VacuumStmt VacuumStmt
struct NotifyStmt NotifyStmt
SetOperation
Definition: parsenodes.h:1960
@ SETOP_INTERSECT
Definition: parsenodes.h:1963
@ SETOP_UNION
Definition: parsenodes.h:1962
@ SETOP_EXCEPT
Definition: parsenodes.h:1964
@ SETOP_NONE
Definition: parsenodes.h:1961
struct TriggerTransition TriggerTransition
struct ClusterStmt ClusterStmt
struct MergeStmt MergeStmt
struct SelectStmt SelectStmt
struct DropdbStmt DropdbStmt
uint64 AclMode
Definition: parsenodes.h:74
struct FunctionParameter FunctionParameter
struct UnlistenStmt UnlistenStmt
struct InsertStmt InsertStmt
struct AlterFunctionStmt AlterFunctionStmt
struct StatsElem StatsElem
struct AlterRoleSetStmt AlterRoleSetStmt
struct CreateOpFamilyStmt CreateOpFamilyStmt
struct CreatePublicationStmt CreatePublicationStmt
struct InlineCodeBlock InlineCodeBlock
struct CreateDomainStmt CreateDomainStmt
struct AlterDomainStmt AlterDomainStmt
struct AlterDefaultPrivilegesStmt AlterDefaultPrivilegesStmt
struct CreateStatsStmt CreateStatsStmt
struct JsonOutput JsonOutput
struct UpdateStmt UpdateStmt
struct AlterObjectDependsStmt AlterObjectDependsStmt
struct IndexElem IndexElem
struct AlterCollationStmt AlterCollationStmt
A_Expr_Kind
Definition: parsenodes.h:311
@ AEXPR_BETWEEN
Definition: parsenodes.h:322
@ AEXPR_NULLIF
Definition: parsenodes.h:317
@ AEXPR_NOT_DISTINCT
Definition: parsenodes.h:316
@ AEXPR_BETWEEN_SYM
Definition: parsenodes.h:324
@ AEXPR_NOT_BETWEEN_SYM
Definition: parsenodes.h:325
@ AEXPR_ILIKE
Definition: parsenodes.h:320
@ AEXPR_IN
Definition: parsenodes.h:318
@ AEXPR_NOT_BETWEEN
Definition: parsenodes.h:323
@ AEXPR_DISTINCT
Definition: parsenodes.h:315
@ AEXPR_SIMILAR
Definition: parsenodes.h:321
@ AEXPR_LIKE
Definition: parsenodes.h:319
@ AEXPR_OP
Definition: parsenodes.h:312
@ AEXPR_OP_ANY
Definition: parsenodes.h:313
@ AEXPR_OP_ALL
Definition: parsenodes.h:314
FunctionParameterMode
Definition: parsenodes.h:3294
@ FUNC_PARAM_IN
Definition: parsenodes.h:3296
@ FUNC_PARAM_DEFAULT
Definition: parsenodes.h:3302
@ FUNC_PARAM_OUT
Definition: parsenodes.h:3297
@ FUNC_PARAM_INOUT
Definition: parsenodes.h:3298
@ FUNC_PARAM_TABLE
Definition: parsenodes.h:3300
@ FUNC_PARAM_VARIADIC
Definition: parsenodes.h:3299
struct CreateForeignTableStmt CreateForeignTableStmt
struct CreateOpClassStmt CreateOpClassStmt
struct JsonObjectConstructor JsonObjectConstructor
AlterTSConfigType
Definition: parsenodes.h:3955
@ ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN
Definition: parsenodes.h:3957
@ ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN
Definition: parsenodes.h:3959
@ ALTER_TSCONFIG_REPLACE_DICT
Definition: parsenodes.h:3958
@ ALTER_TSCONFIG_ADD_MAPPING
Definition: parsenodes.h:3956
@ ALTER_TSCONFIG_DROP_MAPPING
Definition: parsenodes.h:3960
struct AlterForeignServerStmt AlterForeignServerStmt
struct ColumnDef ColumnDef
struct CreatedbStmt CreatedbStmt
struct RTEPermissionInfo RTEPermissionInfo
struct AlterEventTrigStmt AlterEventTrigStmt
struct IndexStmt IndexStmt
struct PartitionCmd PartitionCmd
PublicationObjSpecType
Definition: parsenodes.h:3992
@ PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA
Definition: parsenodes.h:3995
@ PUBLICATIONOBJ_TABLES_IN_SCHEMA
Definition: parsenodes.h:3994
@ PUBLICATIONOBJ_TABLE
Definition: parsenodes.h:3993
@ PUBLICATIONOBJ_CONTINUATION
Definition: parsenodes.h:3997
struct JsonArrayConstructor JsonArrayConstructor
PartitionStrategy
Definition: parsenodes.h:867
@ PARTITION_STRATEGY_HASH
Definition: parsenodes.h:870
@ PARTITION_STRATEGY_LIST
Definition: parsenodes.h:868
@ PARTITION_STRATEGY_RANGE
Definition: parsenodes.h:869
ImportForeignSchemaType
Definition: parsenodes.h:2791
@ FDW_IMPORT_SCHEMA_LIMIT_TO
Definition: parsenodes.h:2793
@ FDW_IMPORT_SCHEMA_ALL
Definition: parsenodes.h:2792
@ FDW_IMPORT_SCHEMA_EXCEPT
Definition: parsenodes.h:2794
struct AlterRoleStmt AlterRoleStmt
struct MergeWhenClause MergeWhenClause
struct WindowDef WindowDef
struct CommentStmt CommentStmt
AlterPublicationAction
Definition: parsenodes.h:4019
@ AP_DropObjects
Definition: parsenodes.h:4021
@ AP_SetObjects
Definition: parsenodes.h:4022
@ AP_AddObjects
Definition: parsenodes.h:4020
struct Query Query
struct JsonArrayQueryConstructor JsonArrayQueryConstructor
QuerySource
Definition: parsenodes.h:35
@ QSRC_NON_INSTEAD_RULE
Definition: parsenodes.h:40
@ QSRC_PARSER
Definition: parsenodes.h:37
@ QSRC_QUAL_INSTEAD_RULE
Definition: parsenodes.h:39
@ QSRC_ORIGINAL
Definition: parsenodes.h:36
@ QSRC_INSTEAD_RULE
Definition: parsenodes.h:38
struct WithClause WithClause
struct AlterObjectSchemaStmt AlterObjectSchemaStmt
struct MultiAssignRef MultiAssignRef
struct ImportForeignSchemaStmt ImportForeignSchemaStmt
struct ReindexStmt ReindexStmt
struct CreateSubscriptionStmt CreateSubscriptionStmt
struct A_Const A_Const
struct DeleteStmt DeleteStmt
RTEKind
Definition: parsenodes.h:1010
@ RTE_JOIN
Definition: parsenodes.h:1013
@ RTE_CTE
Definition: parsenodes.h:1017
@ RTE_NAMEDTUPLESTORE
Definition: parsenodes.h:1018
@ RTE_VALUES
Definition: parsenodes.h:1016
@ RTE_SUBQUERY
Definition: parsenodes.h:1012
@ RTE_RESULT
Definition: parsenodes.h:1019
@ RTE_FUNCTION
Definition: parsenodes.h:1014
@ RTE_TABLEFUNC
Definition: parsenodes.h:1015
@ RTE_RELATION
Definition: parsenodes.h:1011
struct AlterSubscriptionStmt AlterSubscriptionStmt
struct AlterStatsStmt AlterStatsStmt
struct AlterPublicationStmt AlterPublicationStmt
struct RangeFunction RangeFunction
struct PLAssignStmt PLAssignStmt
DefElemAction
Definition: parsenodes.h:800
@ DEFELEM_UNSPEC
Definition: parsenodes.h:801
@ DEFELEM_DROP
Definition: parsenodes.h:804
@ DEFELEM_SET
Definition: parsenodes.h:802
@ DEFELEM_ADD
Definition: parsenodes.h:803
struct ColumnRef ColumnRef
ConstrType
Definition: parsenodes.h:2550
@ CONSTR_FOREIGN
Definition: parsenodes.h:2561
@ CONSTR_ATTR_DEFERRED
Definition: parsenodes.h:2564
@ CONSTR_IDENTITY
Definition: parsenodes.h:2555
@ CONSTR_UNIQUE
Definition: parsenodes.h:2559
@ CONSTR_ATTR_NOT_DEFERRABLE
Definition: parsenodes.h:2563
@ CONSTR_DEFAULT
Definition: parsenodes.h:2554
@ CONSTR_NOTNULL
Definition: parsenodes.h:2553
@ CONSTR_ATTR_IMMEDIATE
Definition: parsenodes.h:2565
@ CONSTR_CHECK
Definition: parsenodes.h:2557
@ CONSTR_NULL
Definition: parsenodes.h:2551
@ CONSTR_GENERATED
Definition: parsenodes.h:2556
@ CONSTR_EXCLUSION
Definition: parsenodes.h:2560
@ CONSTR_ATTR_DEFERRABLE
Definition: parsenodes.h:2562
@ CONSTR_PRIMARY
Definition: parsenodes.h:2558
PartitionRangeDatumKind
Definition: parsenodes.h:919
@ PARTITION_RANGE_DATUM_MAXVALUE
Definition: parsenodes.h:922
@ PARTITION_RANGE_DATUM_VALUE
Definition: parsenodes.h:921
@ PARTITION_RANGE_DATUM_MINVALUE
Definition: parsenodes.h:920
struct GroupingSet GroupingSet
struct CreatePolicyStmt CreatePolicyStmt
FetchDirection
Definition: parsenodes.h:3170
@ FETCH_RELATIVE
Definition: parsenodes.h:3176
@ FETCH_ABSOLUTE
Definition: parsenodes.h:3175
@ FETCH_FORWARD
Definition: parsenodes.h:3172
@ FETCH_BACKWARD
Definition: parsenodes.h:3173
VariableSetKind
Definition: parsenodes.h:2460
@ VAR_SET_DEFAULT
Definition: parsenodes.h:2462
@ VAR_RESET
Definition: parsenodes.h:2465
@ VAR_SET_MULTI
Definition: parsenodes.h:2464
@ VAR_SET_VALUE
Definition: parsenodes.h:2461
@ VAR_SET_CURRENT
Definition: parsenodes.h:2463
@ VAR_RESET_ALL
Definition: parsenodes.h:2466
DropBehavior
Definition: parsenodes.h:2181
@ DROP_CASCADE
Definition: parsenodes.h:2183
@ DROP_RESTRICT
Definition: parsenodes.h:2182
ObjectType
Definition: parsenodes.h:2108
@ OBJECT_EVENT_TRIGGER
Definition: parsenodes.h:2123
@ OBJECT_FDW
Definition: parsenodes.h:2125
@ OBJECT_TSPARSER
Definition: parsenodes.h:2156
@ OBJECT_COLLATION
Definition: parsenodes.h:2116
@ OBJECT_USER_MAPPING
Definition: parsenodes.h:2159
@ OBJECT_ACCESS_METHOD
Definition: parsenodes.h:2109
@ OBJECT_OPCLASS
Definition: parsenodes.h:2133
@ OBJECT_DEFACL
Definition: parsenodes.h:2120
@ OBJECT_AGGREGATE
Definition: parsenodes.h:2110
@ OBJECT_MATVIEW
Definition: parsenodes.h:2132
@ OBJECT_SCHEMA
Definition: parsenodes.h:2145
@ OBJECT_POLICY
Definition: parsenodes.h:2137
@ OBJECT_OPERATOR
Definition: parsenodes.h:2134
@ OBJECT_FOREIGN_TABLE
Definition: parsenodes.h:2127
@ OBJECT_TSCONFIGURATION
Definition: parsenodes.h:2154
@ OBJECT_OPFAMILY
Definition: parsenodes.h:2135
@ OBJECT_DOMAIN
Definition: parsenodes.h:2121
@ OBJECT_COLUMN
Definition: parsenodes.h:2115
@ OBJECT_TABLESPACE
Definition: parsenodes.h:2151
@ OBJECT_ROLE
Definition: parsenodes.h:2142
@ OBJECT_ROUTINE
Definition: parsenodes.h:2143
@ OBJECT_LARGEOBJECT
Definition: parsenodes.h:2131
@ OBJECT_PUBLICATION_NAMESPACE
Definition: parsenodes.h:2140
@ OBJECT_PROCEDURE
Definition: parsenodes.h:2138
@ OBJECT_EXTENSION
Definition: parsenodes.h:2124
@ OBJECT_INDEX
Definition: parsenodes.h:2129
@ OBJECT_DEFAULT
Definition: parsenodes.h:2119
@ OBJECT_DATABASE
Definition: parsenodes.h:2118
@ OBJECT_SEQUENCE
Definition: parsenodes.h:2146
@ OBJECT_TSTEMPLATE
Definition: parsenodes.h:2157
@ OBJECT_LANGUAGE
Definition: parsenodes.h:2130
@ OBJECT_AMOP
Definition: parsenodes.h:2111
@ OBJECT_PUBLICATION_REL
Definition: parsenodes.h:2141
@ OBJECT_FOREIGN_SERVER
Definition: parsenodes.h:2126
@ OBJECT_TSDICTIONARY
Definition: parsenodes.h:2155
@ OBJECT_ATTRIBUTE
Definition: parsenodes.h:2113
@ OBJECT_PUBLICATION
Definition: parsenodes.h:2139
@ OBJECT_RULE
Definition: parsenodes.h:2144
@ OBJECT_CONVERSION
Definition: parsenodes.h:2117
@ OBJECT_AMPROC
Definition: parsenodes.h:2112
@ OBJECT_TABLE
Definition: parsenodes.h:2150
@ OBJECT_VIEW
Definition: parsenodes.h:2160
@ OBJECT_PARAMETER_ACL
Definition: parsenodes.h:2136
@ OBJECT_TYPE
Definition: parsenodes.h:2158
@ OBJECT_FUNCTION
Definition: parsenodes.h:2128
@ OBJECT_TABCONSTRAINT
Definition: parsenodes.h:2149
@ OBJECT_DOMCONSTRAINT
Definition: parsenodes.h:2122
@ OBJECT_SUBSCRIPTION
Definition: parsenodes.h:2147
@ OBJECT_STATISTIC_EXT
Definition: parsenodes.h:2148
@ OBJECT_CAST
Definition: parsenodes.h:2114
@ OBJECT_TRIGGER
Definition: parsenodes.h:2153
@ OBJECT_TRANSFORM
Definition: parsenodes.h:2152
struct ListenStmt ListenStmt
struct A_Star A_Star
struct PublicationObjSpec PublicationObjSpec
struct AlterTableSpaceOptionsStmt AlterTableSpaceOptionsStmt
struct CreateRoleStmt CreateRoleStmt
struct AlterTableCmd AlterTableCmd
struct RangeTableSample RangeTableSample
struct DropUserMappingStmt DropUserMappingStmt
ReindexObjectType
Definition: parsenodes.h:3820
@ REINDEX_OBJECT_DATABASE
Definition: parsenodes.h:3825
@ REINDEX_OBJECT_INDEX
Definition: parsenodes.h:3821
@ REINDEX_OBJECT_SCHEMA
Definition: parsenodes.h:3823
@ REINDEX_OBJECT_SYSTEM
Definition: parsenodes.h:3824
@ REINDEX_OBJECT_TABLE
Definition: parsenodes.h:3822
struct CreateForeignServerStmt CreateForeignServerStmt
struct LockingClause LockingClause
AlterTableType
Definition: parsenodes.h:2200
@ AT_AddIndexConstraint
Definition: parsenodes.h:2223
@ AT_DropOf
Definition: parsenodes.h:2254
@ AT_SetOptions
Definition: parsenodes.h:2211
@ AT_DropIdentity
Definition: parsenodes.h:2266
@ AT_SetAttNotNull
Definition: parsenodes.h:2207
@ AT_DisableTrigUser
Definition: parsenodes.h:2246
@ AT_DropNotNull
Definition: parsenodes.h:2205
@ AT_AddOf
Definition: parsenodes.h:2253
@ AT_ResetOptions
Definition: parsenodes.h:2212
@ AT_ReplicaIdentity
Definition: parsenodes.h:2255
@ AT_ReplaceRelOptions
Definition: parsenodes.h:2238
@ AT_EnableRowSecurity
Definition: parsenodes.h:2256
@ AT_AddColumnToView
Definition: parsenodes.h:2202
@ AT_ResetRelOptions
Definition: parsenodes.h:2237
@ AT_EnableReplicaTrig
Definition: parsenodes.h:2241
@ AT_DropOids
Definition: parsenodes.h:2233
@ AT_SetIdentity
Definition: parsenodes.h:2265
@ AT_ReAddStatistics
Definition: parsenodes.h:2267
@ AT_SetUnLogged
Definition: parsenodes.h:2232
@ AT_DisableTrig
Definition: parsenodes.h:2242
@ AT_SetCompression
Definition: parsenodes.h:2214
@ AT_DropExpression
Definition: parsenodes.h:2209
@ AT_AddIndex
Definition: parsenodes.h:2216
@ AT_EnableReplicaRule
Definition: parsenodes.h:2249
@ AT_ReAddIndex
Definition: parsenodes.h:2217
@ AT_DropConstraint
Definition: parsenodes.h:2224
@ AT_SetNotNull
Definition: parsenodes.h:2206
@ AT_ClusterOn
Definition: parsenodes.h:2229
@ AT_AddIdentity
Definition: parsenodes.h:2264
@ AT_ForceRowSecurity
Definition: parsenodes.h:2258
@ AT_EnableAlwaysRule
Definition: parsenodes.h:2248
@ AT_SetAccessMethod
Definition: parsenodes.h:2234
@ AT_AlterColumnType
Definition: parsenodes.h:2226
@ AT_DetachPartitionFinalize
Definition: parsenodes.h:2263
@ AT_AddInherit
Definition: parsenodes.h:2251
@ AT_ReAddDomainConstraint
Definition: parsenodes.h:2220
@ AT_EnableTrig
Definition: parsenodes.h:2239
@ AT_DropColumn
Definition: parsenodes.h:2215
@ AT_ReAddComment
Definition: parsenodes.h:2225
@ AT_AlterColumnGenericOptions
Definition: parsenodes.h:2227
@ AT_DisableTrigAll
Definition: parsenodes.h:2244
@ AT_EnableRule
Definition: parsenodes.h:2247
@ AT_NoForceRowSecurity
Definition: parsenodes.h:2259
@ AT_DetachPartition
Definition: parsenodes.h:2262
@ AT_SetStatistics
Definition: parsenodes.h:2210
@ AT_AttachPartition
Definition: parsenodes.h:2261
@ AT_AddConstraint
Definition: parsenodes.h:2218
@ AT_DropInherit
Definition: parsenodes.h:2252
@ AT_EnableAlwaysTrig
Definition: parsenodes.h:2240
@ AT_SetLogged
Definition: parsenodes.h:2231
@ AT_SetStorage
Definition: parsenodes.h:2213
@ AT_DisableRule
Definition: parsenodes.h:2250
@ AT_DisableRowSecurity
Definition: parsenodes.h:2257
@ AT_SetRelOptions
Definition: parsenodes.h:2236
@ AT_ChangeOwner
Definition: parsenodes.h:2228
@ AT_EnableTrigUser
Definition: parsenodes.h:2245
@ AT_SetExpression
Definition: parsenodes.h:2208
@ AT_ReAddConstraint
Definition: parsenodes.h:2219
@ AT_SetTableSpace
Definition: parsenodes.h:2235
@ AT_GenericOptions
Definition: parsenodes.h:2260
@ AT_ColumnDefault
Definition: parsenodes.h:2203
@ AT_CookedColumnDefault
Definition: parsenodes.h:2204
@ AT_AlterConstraint
Definition: parsenodes.h:2221
@ AT_EnableTrigAll
Definition: parsenodes.h:2243
@ AT_DropCluster
Definition: parsenodes.h:2230
@ AT_ValidateConstraint
Definition: parsenodes.h:2222
@ AT_AddColumn
Definition: parsenodes.h:2201
struct WithCheckOption WithCheckOption
struct LockStmt LockStmt
GrantTargetType
Definition: parsenodes.h:2336
@ ACL_TARGET_DEFAULTS
Definition: parsenodes.h:2339
@ ACL_TARGET_OBJECT
Definition: parsenodes.h:2337
@ ACL_TARGET_ALL_IN_SCHEMA
Definition: parsenodes.h:2338
struct CreateEventTrigStmt CreateEventTrigStmt
struct JsonObjectAgg JsonObjectAgg
struct DropOwnedStmt DropOwnedStmt
struct VariableShowStmt VariableShowStmt
struct CreateTransformStmt CreateTransformStmt
struct AlterUserMappingStmt AlterUserMappingStmt
struct PartitionRangeDatum PartitionRangeDatum
struct A_ArrayExpr A_ArrayExpr
struct RangeTableFunc RangeTableFunc
struct InferClause InferClause
struct RangeSubselect RangeSubselect
struct DropStmt DropStmt
struct CreateOpClassItem CreateOpClassItem
struct PrepareStmt PrepareStmt
struct AlterOpFamilyStmt AlterOpFamilyStmt
struct ConstraintsSetStmt ConstraintsSetStmt
struct JsonParseExpr JsonParseExpr
struct GrantStmt GrantStmt
struct A_Expr A_Expr
struct SetOperationStmt SetOperationStmt
struct SortBy SortBy
struct ViewStmt ViewStmt
struct CreateTrigStmt CreateTrigStmt
struct CTECycleClause CTECycleClause
struct VacuumRelation VacuumRelation
struct RenameStmt RenameStmt
struct DefineStmt DefineStmt
struct CreateStmt CreateStmt
struct CreateSchemaStmt CreateSchemaStmt
DiscardMode
Definition: parsenodes.h:3779
@ DISCARD_ALL
Definition: parsenodes.h:3780
@ DISCARD_PLANS
Definition: parsenodes.h:3781
@ DISCARD_SEQUENCES
Definition: parsenodes.h:3782
@ DISCARD_TEMP
Definition: parsenodes.h:3783
struct VariableSetStmt VariableSetStmt
struct JsonAggConstructor JsonAggConstructor
struct RawStmt RawStmt
struct CommonTableExpr CommonTableExpr
struct TableSampleClause TableSampleClause
struct AlterPolicyStmt AlterPolicyStmt
struct CreateConversionStmt CreateConversionStmt
struct ResTarget ResTarget
struct DropRoleStmt DropRoleStmt
struct DiscardStmt DiscardStmt
struct JsonKeyValue JsonKeyValue
struct AlterExtensionStmt AlterExtensionStmt
struct AlterTableStmt AlterTableStmt
struct TypeCast TypeCast
struct PartitionElem PartitionElem
struct ClosePortalStmt ClosePortalStmt
struct AccessPriv AccessPriv
struct Constraint Constraint
struct CreatePLangStmt CreatePLangStmt
struct CreateRangeStmt CreateRangeStmt
struct CreateUserMappingStmt CreateUserMappingStmt
SortByDir
Definition: parsenodes.h:45
@ SORTBY_USING
Definition: parsenodes.h:49
@ SORTBY_DESC
Definition: parsenodes.h:48
@ SORTBY_ASC
Definition: parsenodes.h:47
@ SORTBY_DEFAULT
Definition: parsenodes.h:46
struct AlterDatabaseSetStmt AlterDatabaseSetStmt
struct AlterTableMoveAllStmt AlterTableMoveAllStmt
struct AlterSeqStmt AlterSeqStmt
struct PublicationTable PublicationTable
struct RowMarkClause RowMarkClause
struct CreateTableAsStmt CreateTableAsStmt
struct TransactionStmt TransactionStmt
struct CreateFdwStmt CreateFdwStmt
struct DeclareCursorStmt DeclareCursorStmt
struct ExecuteStmt ExecuteStmt
struct WindowClause WindowClause
RoleStmtType
Definition: parsenodes.h:2928
@ ROLESTMT_ROLE
Definition: parsenodes.h:2929
@ ROLESTMT_USER
Definition: parsenodes.h:2930
@ ROLESTMT_GROUP
Definition: parsenodes.h:2931
struct RuleStmt RuleStmt
struct SecLabelStmt SecLabelStmt
struct AlterTSConfigurationStmt AlterTSConfigurationStmt
struct AlterDatabaseStmt AlterDatabaseStmt
struct AlterExtensionContentsStmt AlterExtensionContentsStmt
TableLikeOption
Definition: parsenodes.h:756
@ CREATE_TABLE_LIKE_COMMENTS
Definition: parsenodes.h:757
@ CREATE_TABLE_LIKE_GENERATED
Definition: parsenodes.h:761
@ CREATE_TABLE_LIKE_IDENTITY
Definition: parsenodes.h:762
@ CREATE_TABLE_LIKE_COMPRESSION
Definition: parsenodes.h:758
@ CREATE_TABLE_LIKE_STORAGE
Definition: parsenodes.h:765
@ CREATE_TABLE_LIKE_ALL
Definition: parsenodes.h:766
@ CREATE_TABLE_LIKE_INDEXES
Definition: parsenodes.h:763
@ CREATE_TABLE_LIKE_DEFAULTS
Definition: parsenodes.h:760
@ CREATE_TABLE_LIKE_STATISTICS
Definition: parsenodes.h:764
@ CREATE_TABLE_LIKE_CONSTRAINTS
Definition: parsenodes.h:759
struct TypeName TypeName
struct AlterEnumStmt AlterEnumStmt
struct CreateCastStmt CreateCastStmt
struct CheckPointStmt CheckPointStmt
struct RefreshMatViewStmt RefreshMatViewStmt
struct CallStmt CallStmt
struct TruncateStmt TruncateStmt
struct DefElem DefElem
struct AlterFdwStmt AlterFdwStmt
struct RangeTblEntry RangeTblEntry
SetQuantifier
Definition: parsenodes.h:61
@ SET_QUANTIFIER_ALL
Definition: parsenodes.h:63
@ SET_QUANTIFIER_DISTINCT
Definition: parsenodes.h:64
@ SET_QUANTIFIER_DEFAULT
Definition: parsenodes.h:62
ViewCheckOption
Definition: parsenodes.h:3588
@ NO_CHECK_OPTION
Definition: parsenodes.h:3589
@ CASCADED_CHECK_OPTION
Definition: parsenodes.h:3591
@ LOCAL_CHECK_OPTION
Definition: parsenodes.h:3590
struct FuncCall FuncCall
struct RangeTableFuncCol RangeTableFuncCol
struct SortGroupClause SortGroupClause
struct CollateClause CollateClause
struct ExplainStmt ExplainStmt
struct AlterTypeStmt AlterTypeStmt
CTEMaterialize
Definition: parsenodes.h:1597
@ CTEMaterializeNever
Definition: parsenodes.h:1600
@ CTEMaterializeAlways
Definition: parsenodes.h:1599
@ CTEMaterializeDefault
Definition: parsenodes.h:1598
struct CallContext CallContext
struct ObjectWithArgs ObjectWithArgs
struct ReplicaIdentityStmt ReplicaIdentityStmt
struct DoStmt DoStmt
struct CompositeTypeStmt CompositeTypeStmt
struct FetchStmt FetchStmt
struct JsonSerializeExpr JsonSerializeExpr
struct PartitionSpec PartitionSpec
struct CTESearchClause CTESearchClause
unsigned int Oid
Definition: postgres_ext.h:31
XmlOptionType
Definition: primnodes.h:1547
OnCommitAction
Definition: primnodes.h:56
CoercionForm
Definition: primnodes.h:689
OverridingKind
Definition: primnodes.h:26
CoercionContext
Definition: primnodes.h:669
Oid RelFileNumber
Definition: relpath.h:25
NodeTag type
Definition: parsenodes.h:490
List * elements
Definition: parsenodes.h:491
bool isnull
Definition: parsenodes.h:362
int location
Definition: parsenodes.h:363
union ValUnion val
Definition: parsenodes.h:361
pg_node_attr(custom_copy_equal, custom_read_write, custom_query_jumble) NodeTag type
int location
Definition: parsenodes.h:337
Node * lexpr
Definition: parsenodes.h:335
pg_node_attr(custom_read_write) NodeTag type
List * name
Definition: parsenodes.h:334
A_Expr_Kind kind
Definition: parsenodes.h:333
Node * rexpr
Definition: parsenodes.h:336
bool is_slice
Definition: parsenodes.h:458
Node * uidx
Definition: parsenodes.h:460
NodeTag type
Definition: parsenodes.h:457
Node * lidx
Definition: parsenodes.h:459
NodeTag type
Definition: parsenodes.h:480
List * indirection
Definition: parsenodes.h:482
NodeTag type
Definition: parsenodes.h:446
char * priv_name
Definition: parsenodes.h:2394
NodeTag type
Definition: parsenodes.h:2393
List * cols
Definition: parsenodes.h:2395
VariableSetStmt * setstmt
Definition: parsenodes.h:3647
DropBehavior behavior
Definition: parsenodes.h:2326
char * newValNeighbor
Definition: parsenodes.h:3578
List * typeName
Definition: parsenodes.h:3575
bool skipIfNewValExists
Definition: parsenodes.h:3580
bool newValIsAfter
Definition: parsenodes.h:3579
NodeTag type
Definition: parsenodes.h:3574
List * func_options
Definition: parsenodes.h:2714
List * options
Definition: parsenodes.h:2715
char * fdwname
Definition: parsenodes.h:2713
NodeTag type
Definition: parsenodes.h:2712
ObjectWithArgs * func
Definition: parsenodes.h:3318
ObjectType objtype
Definition: parsenodes.h:3317
ObjectWithArgs * opername
Definition: parsenodes.h:3441
RangeVar * relation
Definition: parsenodes.h:3429
RoleSpec * newowner
Definition: parsenodes.h:3431
ObjectType objectType
Definition: parsenodes.h:3428
char * policy_name
Definition: parsenodes.h:2831
RangeVar * table
Definition: parsenodes.h:2832
AlterPublicationAction action
Definition: parsenodes.h:4039
RoleSpec * role
Definition: parsenodes.h:2953
VariableSetStmt * setstmt
Definition: parsenodes.h:2955
List * options
Definition: parsenodes.h:2946
NodeTag type
Definition: parsenodes.h:2944
RoleSpec * role
Definition: parsenodes.h:2945
List * options
Definition: parsenodes.h:2984
RangeVar * sequence
Definition: parsenodes.h:2983
bool for_identity
Definition: parsenodes.h:2985
NodeTag type
Definition: parsenodes.h:2982
Node * stxstattarget
Definition: parsenodes.h:3273
AlterSubscriptionType kind
Definition: parsenodes.h:4067
VariableSetStmt * setstmt
Definition: parsenodes.h:3669
AlterTSConfigType kind
Definition: parsenodes.h:3966
NodeTag type
Definition: parsenodes.h:2279
RoleSpec * newowner
Definition: parsenodes.h:2285
DropBehavior behavior
Definition: parsenodes.h:2288
AlterTableType subtype
Definition: parsenodes.h:2280
RangeVar * relation
Definition: parsenodes.h:2193
ObjectType objtype
Definition: parsenodes.h:2195
List * options
Definition: parsenodes.h:3453
List * typeName
Definition: parsenodes.h:3452
NodeTag type
Definition: parsenodes.h:3451
Definition: value.h:56
char * cycle_path_column
Definition: parsenodes.h:1619
Node * cycle_mark_default
Definition: parsenodes.h:1618
Oid cycle_mark_collation
Definition: parsenodes.h:1624
List * cycle_col_list
Definition: parsenodes.h:1615
char * cycle_mark_column
Definition: parsenodes.h:1616
Node * cycle_mark_value
Definition: parsenodes.h:1617
char * search_seq_column
Definition: parsenodes.h:1608
bool search_breadth_first
Definition: parsenodes.h:1607
List * search_col_list
Definition: parsenodes.h:1606
pg_node_attr(nodetag_only) NodeTag type
FuncExpr * funcexpr
Definition: parsenodes.h:3362
NodeTag type
Definition: parsenodes.h:3358
List * outargs
Definition: parsenodes.h:3364
FuncCall *funccall pg_node_attr(query_jumble_ignore)
char * indexname
Definition: parsenodes.h:3680
RangeVar * relation
Definition: parsenodes.h:3679
NodeTag type
Definition: parsenodes.h:3678
List * params
Definition: parsenodes.h:3681
List * collname
Definition: parsenodes.h:384
NodeTag type
Definition: parsenodes.h:382
bool is_not_null
Definition: parsenodes.h:727
CollateClause * collClause
Definition: parsenodes.h:737
char identity
Definition: parsenodes.h:733
RangeVar * identitySequence
Definition: parsenodes.h:734
int location
Definition: parsenodes.h:741
List * constraints
Definition: parsenodes.h:739
Node * cooked_default
Definition: parsenodes.h:732
char * storage_name
Definition: parsenodes.h:730
int inhcount
Definition: parsenodes.h:725
char * colname
Definition: parsenodes.h:722
TypeName * typeName
Definition: parsenodes.h:723
char generated
Definition: parsenodes.h:736
NodeTag type
Definition: parsenodes.h:721
bool is_from_type
Definition: parsenodes.h:728
List * fdwoptions
Definition: parsenodes.h:740
Node * raw_default
Definition: parsenodes.h:731
char storage
Definition: parsenodes.h:729
Oid collOid
Definition: parsenodes.h:738
bool is_local
Definition: parsenodes.h:726
char * compression
Definition: parsenodes.h:724
int location
Definition: parsenodes.h:294
List * fields
Definition: parsenodes.h:293
NodeTag type
Definition: parsenodes.h:292
char * comment
Definition: parsenodes.h:3110
ObjectType objtype
Definition: parsenodes.h:3108
NodeTag type
Definition: parsenodes.h:3107
Node * object
Definition: parsenodes.h:3109
int cterefcount pg_node_attr(query_jumble_ignore)
CTEMaterialize ctematerialized
Definition: parsenodes.h:1639
List *aliascolnames pg_node_attr(query_jumble_ignore)
List *ctecolcollations pg_node_attr(query_jumble_ignore)
CTECycleClause *cycle_clause pg_node_attr(query_jumble_ignore)
List *ctecoltypes pg_node_attr(query_jumble_ignore)
List *ctecolnames pg_node_attr(query_jumble_ignore)
List *ctecoltypmods pg_node_attr(query_jumble_ignore)
bool cterecursive pg_node_attr(query_jumble_ignore)
CTESearchClause *search_clause pg_node_attr(query_jumble_ignore)
RangeVar * typevar
Definition: parsenodes.h:3542
bool initdeferred
Definition: parsenodes.h:2586
List * exclusions
Definition: parsenodes.h:2603
bool reset_default_tblspc
Definition: parsenodes.h:2608
List * keys
Definition: parsenodes.h:2598
List * pk_attrs
Definition: parsenodes.h:2616
List * fk_del_set_cols
Definition: parsenodes.h:2620
Node * where_clause
Definition: parsenodes.h:2611
char * indexname
Definition: parsenodes.h:2606
char * indexspace
Definition: parsenodes.h:2607
ConstrType contype
Definition: parsenodes.h:2583
char * access_method
Definition: parsenodes.h:2610
Oid old_pktable_oid
Definition: parsenodes.h:2622
bool is_no_inherit
Definition: parsenodes.h:2589
List * options
Definition: parsenodes.h:2605
char fk_upd_action
Definition: parsenodes.h:2618
List * old_conpfeqop
Definition: parsenodes.h:2621
char fk_matchtype
Definition: parsenodes.h:2617
bool nulls_not_distinct
Definition: parsenodes.h:2597
char * cooked_expr
Definition: parsenodes.h:2592
bool initially_valid
Definition: parsenodes.h:2588
bool skip_validation
Definition: parsenodes.h:2587
bool without_overlaps
Definition: parsenodes.h:2600
bool deferrable
Definition: parsenodes.h:2585
NodeTag type
Definition: parsenodes.h:2582
Node * raw_expr
Definition: parsenodes.h:2590
char * conname
Definition: parsenodes.h:2584
char generated_when
Definition: parsenodes.h:2594
RangeVar * pktable
Definition: parsenodes.h:2614
List * including
Definition: parsenodes.h:2601
char fk_del_action
Definition: parsenodes.h:2619
List * fk_attrs
Definition: parsenodes.h:2615
bool is_program
Definition: parsenodes.h:2446
RangeVar * relation
Definition: parsenodes.h:2440
List * options
Definition: parsenodes.h:2448
bool is_from
Definition: parsenodes.h:2445
char * filename
Definition: parsenodes.h:2447
NodeTag type
Definition: parsenodes.h:2439
List * attlist
Definition: parsenodes.h:2443
Node * whereClause
Definition: parsenodes.h:2449
Node * query
Definition: parsenodes.h:2441
NodeTag type
Definition: parsenodes.h:2844
List * handler_name
Definition: parsenodes.h:2846
char * amname
Definition: parsenodes.h:2845
TypeName * sourcetype
Definition: parsenodes.h:3859
TypeName * targettype
Definition: parsenodes.h:3860
CoercionContext context
Definition: parsenodes.h:3862
ObjectWithArgs * func
Definition: parsenodes.h:3861
TypeName * typeName
Definition: parsenodes.h:3013
CollateClause * collClause
Definition: parsenodes.h:3014
NodeTag type
Definition: parsenodes.h:2704
List * func_options
Definition: parsenodes.h:2706
char * fdwname
Definition: parsenodes.h:2705
List * options
Definition: parsenodes.h:2707
TypeName * returnType
Definition: parsenodes.h:3288
ObjectWithArgs * name
Definition: parsenodes.h:3041
TypeName * storedtype
Definition: parsenodes.h:3047
TypeName * datatype
Definition: parsenodes.h:3028
List * plvalidator
Definition: parsenodes.h:2914
RangeVar * table
Definition: parsenodes.h:2816
RoleStmtType stmt_type
Definition: parsenodes.h:2937
RoleSpec * authrole
Definition: parsenodes.h:2175
bool if_not_exists
Definition: parsenodes.h:2977
List * options
Definition: parsenodes.h:2974
NodeTag type
Definition: parsenodes.h:2972
RangeVar * sequence
Definition: parsenodes.h:2973
List * tableElts
Definition: parsenodes.h:2503
List * nnconstraints
Definition: parsenodes.h:2510
TypeName * ofTypename
Definition: parsenodes.h:2508
OnCommitAction oncommit
Definition: parsenodes.h:2512
List * options
Definition: parsenodes.h:2511
bool if_not_exists
Definition: parsenodes.h:2515
List * inhRelations
Definition: parsenodes.h:2504
RangeVar * relation
Definition: parsenodes.h:2502
char * tablespacename
Definition: parsenodes.h:2513
PartitionSpec * partspec
Definition: parsenodes.h:2507
NodeTag type
Definition: parsenodes.h:2501
PartitionBoundSpec * partbound
Definition: parsenodes.h:2506
char * accessMethod
Definition: parsenodes.h:2514
List * constraints
Definition: parsenodes.h:2509
IntoClause * into
Definition: parsenodes.h:3746
ObjectType objtype
Definition: parsenodes.h:3747
ObjectWithArgs * tosql
Definition: parsenodes.h:3877
TypeName * type_name
Definition: parsenodes.h:3874
ObjectWithArgs * fromsql
Definition: parsenodes.h:3876
Node * whenClause
Definition: parsenodes.h:2869
List * transitionRels
Definition: parsenodes.h:2871
RangeVar * constrrel
Definition: parsenodes.h:2875
RangeVar * relation
Definition: parsenodes.h:2860
NodeTag type
Definition: parsenodes.h:3621
List * options
Definition: parsenodes.h:3623
char * dbname
Definition: parsenodes.h:3622
char *name pg_node_attr(query_jumble_ignore)
int location pg_node_attr(query_jumble_location)
char * defnamespace
Definition: parsenodes.h:810
NodeTag type
Definition: parsenodes.h:809
DefElemAction defaction
Definition: parsenodes.h:814
char * defname
Definition: parsenodes.h:811
int location
Definition: parsenodes.h:815
Node * arg
Definition: parsenodes.h:812
bool oldstyle
Definition: parsenodes.h:2997
List * definition
Definition: parsenodes.h:3000
List * defnames
Definition: parsenodes.h:2998
List * args
Definition: parsenodes.h:2999
NodeTag type
Definition: parsenodes.h:2995
ObjectType kind
Definition: parsenodes.h:2996
bool replace
Definition: parsenodes.h:3002
bool if_not_exists
Definition: parsenodes.h:3001
WithClause * withClause
Definition: parsenodes.h:1913
Node * whereClause
Definition: parsenodes.h:1911
RangeVar * relation
Definition: parsenodes.h:1909
List * usingClause
Definition: parsenodes.h:1910
List * returningList
Definition: parsenodes.h:1912
NodeTag type
Definition: parsenodes.h:1908
NodeTag type
Definition: parsenodes.h:3788
DiscardMode target
Definition: parsenodes.h:3789
NodeTag type
Definition: parsenodes.h:3330
List * args
Definition: parsenodes.h:3331
DropBehavior behavior
Definition: parsenodes.h:3928
NodeTag type
Definition: parsenodes.h:3926
NodeTag type
Definition: parsenodes.h:2960
List * roles
Definition: parsenodes.h:2961
bool missing_ok
Definition: parsenodes.h:3085
List * objects
Definition: parsenodes.h:3082
ObjectType removeType
Definition: parsenodes.h:3083
bool concurrent
Definition: parsenodes.h:3086
DropBehavior behavior
Definition: parsenodes.h:3084
NodeTag type
Definition: parsenodes.h:3081
DropBehavior behavior
Definition: parsenodes.h:4079
List * options
Definition: parsenodes.h:3659
char * dbname
Definition: parsenodes.h:3657
bool missing_ok
Definition: parsenodes.h:3658
NodeTag type
Definition: parsenodes.h:3656
List * params
Definition: parsenodes.h:3902
NodeTag type
Definition: parsenodes.h:3900
char * name
Definition: parsenodes.h:3901
NodeTag type
Definition: parsenodes.h:3724
Node * query
Definition: parsenodes.h:3725
List * options
Definition: parsenodes.h:3726
long howMany
Definition: parsenodes.h:3185
bool ismove
Definition: parsenodes.h:3187
FetchDirection direction
Definition: parsenodes.h:3184
char * portalname
Definition: parsenodes.h:3186
NodeTag type
Definition: parsenodes.h:3183
Definition: value.h:48
bool agg_within_group
Definition: parsenodes.h:430
int location
Definition: parsenodes.h:435
CoercionForm funcformat
Definition: parsenodes.h:434
Node * agg_filter
Definition: parsenodes.h:428
List * agg_order
Definition: parsenodes.h:427
List * funcname
Definition: parsenodes.h:425
List * args
Definition: parsenodes.h:426
bool agg_star
Definition: parsenodes.h:431
bool agg_distinct
Definition: parsenodes.h:432
NodeTag type
Definition: parsenodes.h:424
bool func_variadic
Definition: parsenodes.h:433
struct WindowDef * over
Definition: parsenodes.h:429
TypeName * argType
Definition: parsenodes.h:3309
FunctionParameterMode mode
Definition: parsenodes.h:3310
DropBehavior behavior
Definition: parsenodes.h:2415
NodeTag type
Definition: parsenodes.h:2409
RoleSpec * grantor
Definition: parsenodes.h:2414
List * grantee_roles
Definition: parsenodes.h:2411
List * granted_roles
Definition: parsenodes.h:2410
ObjectType objtype
Definition: parsenodes.h:2347
bool is_grant
Definition: parsenodes.h:2345
List * objects
Definition: parsenodes.h:2348
bool grant_option
Definition: parsenodes.h:2353
List * grantees
Definition: parsenodes.h:2352
List * privileges
Definition: parsenodes.h:2350
GrantTargetType targtype
Definition: parsenodes.h:2346
NodeTag type
Definition: parsenodes.h:2344
DropBehavior behavior
Definition: parsenodes.h:2355
RoleSpec * grantor
Definition: parsenodes.h:2354
NodeTag type
Definition: parsenodes.h:1466
List * content
Definition: parsenodes.h:1468
GroupingSetKind kind pg_node_attr(query_jumble_ignore)
ImportForeignSchemaType list_type
Definition: parsenodes.h:2803
Node * expr
Definition: parsenodes.h:780
SortByDir ordering
Definition: parsenodes.h:785
List * opclassopts
Definition: parsenodes.h:784
NodeTag type
Definition: parsenodes.h:778
char * indexcolname
Definition: parsenodes.h:781
SortByNulls nulls_ordering
Definition: parsenodes.h:786
List * opclass
Definition: parsenodes.h:783
char * name
Definition: parsenodes.h:779
List * collation
Definition: parsenodes.h:782
bool unique
Definition: parsenodes.h:3220
bool reset_default_tblspc
Definition: parsenodes.h:3230
NodeTag type
Definition: parsenodes.h:3203
bool deferrable
Definition: parsenodes.h:3225
List * indexParams
Definition: parsenodes.h:3208
Oid indexOid
Definition: parsenodes.h:3215
bool initdeferred
Definition: parsenodes.h:3226
RangeVar * relation
Definition: parsenodes.h:3205
SubTransactionId oldFirstRelfilelocatorSubid
Definition: parsenodes.h:3218
bool iswithoutoverlaps
Definition: parsenodes.h:3224
bool transformed
Definition: parsenodes.h:3227
List * options
Definition: parsenodes.h:3211
char * tableSpace
Definition: parsenodes.h:3207
SubTransactionId oldCreateSubid
Definition: parsenodes.h:3217
bool isconstraint
Definition: parsenodes.h:3223
List * excludeOpNames
Definition: parsenodes.h:3213
bool nulls_not_distinct
Definition: parsenodes.h:3221
bool concurrent
Definition: parsenodes.h:3228
char * idxname
Definition: parsenodes.h:3204
Node * whereClause
Definition: parsenodes.h:3212
bool if_not_exists
Definition: parsenodes.h:3229
char * accessMethod
Definition: parsenodes.h:3206
char * idxcomment
Definition: parsenodes.h:3214
RelFileNumber oldNumber
Definition: parsenodes.h:3216
bool primary
Definition: parsenodes.h:3222
List * indexIncludingParams
Definition: parsenodes.h:3209
NodeTag type
Definition: parsenodes.h:1568
char * conname
Definition: parsenodes.h:1571
List * indexElems
Definition: parsenodes.h:1569
Node * whereClause
Definition: parsenodes.h:1570
pg_node_attr(nodetag_only) NodeTag type
char * source_text
Definition: parsenodes.h:3339
OnConflictClause * onConflictClause
Definition: parsenodes.h:1896
Node * selectStmt
Definition: parsenodes.h:1895
WithClause * withClause
Definition: parsenodes.h:1898
NodeTag type
Definition: parsenodes.h:1892
RangeVar * relation
Definition: parsenodes.h:1893
List * cols
Definition: parsenodes.h:1894
List * returningList
Definition: parsenodes.h:1897
Definition: value.h:29
struct WindowDef * over
Definition: parsenodes.h:1819
JsonOutput * output
Definition: parsenodes.h:1816
bool absent_on_null
Definition: parsenodes.h:1845
NodeTag type
Definition: parsenodes.h:1842
JsonValueExpr * arg
Definition: parsenodes.h:1844
JsonAggConstructor * constructor
Definition: parsenodes.h:1843
JsonOutput * output
Definition: parsenodes.h:1789
JsonValueExpr * value
Definition: parsenodes.h:1727
NodeTag type
Definition: parsenodes.h:1725
NodeTag type
Definition: parsenodes.h:1829
JsonAggConstructor * constructor
Definition: parsenodes.h:1830
JsonKeyValue * arg
Definition: parsenodes.h:1831
bool absent_on_null
Definition: parsenodes.h:1832
JsonOutput * output
Definition: parsenodes.h:1775
JsonReturning * returning
Definition: parsenodes.h:1715
TypeName * typeName
Definition: parsenodes.h:1714
NodeTag type
Definition: parsenodes.h:1713
JsonValueExpr * expr
Definition: parsenodes.h:1737
JsonOutput * output
Definition: parsenodes.h:1738
NodeTag type
Definition: parsenodes.h:1736
JsonOutput * output
Definition: parsenodes.h:1751
JsonOutput * output
Definition: parsenodes.h:1763
JsonValueExpr * expr
Definition: parsenodes.h:1762
Definition: pg_list.h:54
NodeTag type
Definition: parsenodes.h:3489
char * conditionname
Definition: parsenodes.h:3490
NodeTag type
Definition: parsenodes.h:3611
char * filename
Definition: parsenodes.h:3612
NodeTag type
Definition: parsenodes.h:3798
bool nowait
Definition: parsenodes.h:3801
List * relations
Definition: parsenodes.h:3799
List * lockedRels
Definition: parsenodes.h:830
LockClauseStrength strength
Definition: parsenodes.h:831
LockWaitPolicy waitPolicy
Definition: parsenodes.h:832
NodeTag type
Definition: parsenodes.h:829
Node * sourceRelation
Definition: parsenodes.h:1939
List * mergeWhenClauses
Definition: parsenodes.h:1941
RangeVar * relation
Definition: parsenodes.h:1938
Node * joinCondition
Definition: parsenodes.h:1940
List * returningList
Definition: parsenodes.h:1942
WithClause * withClause
Definition: parsenodes.h:1943
NodeTag type
Definition: parsenodes.h:1937
CmdType commandType
Definition: parsenodes.h:1681
NodeTag type
Definition: parsenodes.h:533
Definition: nodes.h:129
char * payload
Definition: parsenodes.h:3480
char * conditionname
Definition: parsenodes.h:3479
NodeTag type
Definition: parsenodes.h:3478
List * objfuncargs
Definition: parsenodes.h:2380
bool args_unspecified
Definition: parsenodes.h:2381
InferClause * infer
Definition: parsenodes.h:1585
OnConflictAction action
Definition: parsenodes.h:1584
NodeTag type
Definition: parsenodes.h:2077
SelectStmt * val
Definition: parsenodes.h:2082
List * indirection
Definition: parsenodes.h:2080
int location
Definition: parsenodes.h:304
int number
Definition: parsenodes.h:303
NodeTag type
Definition: parsenodes.h:302
PartitionBoundSpec * bound
Definition: parsenodes.h:943
bool concurrent
Definition: parsenodes.h:944
RangeVar * name
Definition: parsenodes.h:942
NodeTag type
Definition: parsenodes.h:941
List * collation
Definition: parsenodes.h:861
NodeTag type
Definition: parsenodes.h:858
List * opclass
Definition: parsenodes.h:862
PartitionRangeDatumKind kind
Definition: parsenodes.h:929
List * partParams
Definition: parsenodes.h:882
NodeTag type
Definition: parsenodes.h:880
PartitionStrategy strategy
Definition: parsenodes.h:881
List * argtypes
Definition: parsenodes.h:3888
NodeTag type
Definition: parsenodes.h:3886
char * name
Definition: parsenodes.h:3887
Node * query
Definition: parsenodes.h:3889
PublicationObjSpecType pubobjtype
Definition: parsenodes.h:4003
PublicationTable * pubtable
Definition: parsenodes.h:4005
RangeVar * relation
Definition: parsenodes.h:3983
List * rowMarks
Definition: parsenodes.h:216
int mergeTargetRelation pg_node_attr(query_jumble_ignore)
bool hasAggs pg_node_attr(query_jumble_ignore)
bool groupDistinct
Definition: parsenodes.h:200
bool hasRecursive pg_node_attr(query_jumble_ignore)
Node * limitCount
Definition: parsenodes.h:213
List *constraintDeps pg_node_attr(query_jumble_ignore)
int stmt_location
Definition: parsenodes.h:237
FromExpr * jointree
Definition: parsenodes.h:175
List * returningList
Definition: parsenodes.h:197
bool canSetTag pg_node_attr(query_jumble_ignore)
Node * setOperations
Definition: parsenodes.h:218
bool hasSubLinks pg_node_attr(query_jumble_ignore)
List * cteList
Definition: parsenodes.h:166
List *rteperminfos pg_node_attr(query_jumble_ignore)
OnConflictExpr * onConflict
Definition: parsenodes.h:195
OverridingKind override pg_node_attr(query_jumble_ignore)
List * groupClause
Definition: parsenodes.h:199
bool hasTargetSRFs pg_node_attr(query_jumble_ignore)
int resultRelation pg_node_attr(query_jumble_ignore)
Node * havingQual
Definition: parsenodes.h:204
List * rtable
Definition: parsenodes.h:168
bool hasDistinctOn pg_node_attr(query_jumble_ignore)
Node * limitOffset
Definition: parsenodes.h:212
bool isReturn pg_node_attr(query_jumble_ignore)
int stmt_len pg_node_attr(query_jumble_ignore)
uint64 queryId pg_node_attr(equal_ignore, query_jumble_ignore, read_write_ignore, read_as(0))
bool hasWindowFuncs pg_node_attr(query_jumble_ignore)
CmdType commandType
Definition: parsenodes.h:121
LimitOption limitOption
Definition: parsenodes.h:214
bool mergeUseOuterJoin pg_node_attr(query_jumble_ignore)
Node * utilityStmt
Definition: parsenodes.h:136
List * mergeActionList
Definition: parsenodes.h:178
bool hasModifyingCTE pg_node_attr(query_jumble_ignore)
NodeTag type
Definition: parsenodes.h:119
List * windowClause
Definition: parsenodes.h:206
List * targetList
Definition: parsenodes.h:190
List * groupingSets
Definition: parsenodes.h:202
List * distinctClause
Definition: parsenodes.h:208
List *withCheckOptions pg_node_attr(query_jumble_ignore)
bool hasForUpdate pg_node_attr(query_jumble_ignore)
List * sortClause
Definition: parsenodes.h:210
bool hasRowSecurity pg_node_attr(query_jumble_ignore)
QuerySource querySource pg_node_attr(query_jumble_ignore)
Bitmapset * selectedCols
Definition: parsenodes.h:1252
AclMode requiredPerms
Definition: parsenodes.h:1250
Bitmapset * insertedCols
Definition: parsenodes.h:1253
Bitmapset * updatedCols
Definition: parsenodes.h:1254
Alias * alias
Definition: parsenodes.h:643
bool is_rowsfrom
Definition: parsenodes.h:641
List * coldeflist
Definition: parsenodes.h:644
List * functions
Definition: parsenodes.h:642
NodeTag type
Definition: parsenodes.h:638
Node * subquery
Definition: parsenodes.h:618
NodeTag type
Definition: parsenodes.h:616
Alias * alias
Definition: parsenodes.h:619
TypeName * typeName
Definition: parsenodes.h:673
List * namespaces
Definition: parsenodes.h:657
Node * docexpr
Definition: parsenodes.h:655
Node * rowexpr
Definition: parsenodes.h:656
List * columns
Definition: parsenodes.h:658
NodeTag type
Definition: parsenodes.h:653
Alias * alias
Definition: parsenodes.h:659
pg_node_attr(custom_read_write, custom_query_jumble) NodeTag type
List * colcollations
Definition: parsenodes.h:1193
char * ctename
Definition: parsenodes.h:1169
TableFunc * tablefunc
Definition: parsenodes.h:1159
bool self_reference
Definition: parsenodes.h:1171
bool security_barrier
Definition: parsenodes.h:1087
Index ctelevelsup
Definition: parsenodes.h:1170
bool funcordinality
Definition: parsenodes.h:1154
Alias * join_using_alias
Definition: parsenodes.h:1143
struct TableSampleClause * tablesample
Definition: parsenodes.h:1081
List * securityQuals
Definition: parsenodes.h:1208
Query * subquery
Definition: parsenodes.h:1086
Alias * eref
Definition: parsenodes.h:1205
List * coltypes
Definition: parsenodes.h:1191
List * joinrightcols
Definition: parsenodes.h:1136
List * values_lists
Definition: parsenodes.h:1164
char * enrname
Definition: parsenodes.h:1198
List * joinaliasvars
Definition: parsenodes.h:1134
JoinType jointype
Definition: parsenodes.h:1132
List * coltypmods
Definition: parsenodes.h:1192
Alias * alias
Definition: parsenodes.h:1204
List * functions
Definition: parsenodes.h:1153
Index perminfoindex
Definition: parsenodes.h:1080
List * joinleftcols
Definition: parsenodes.h:1135
Cardinality enrtuples
Definition: parsenodes.h:1199
RTEKind rtekind
Definition: parsenodes.h:1030
Bitmapset *funcparams pg_node_attr(query_jumble_ignore)
List *funccoltypes pg_node_attr(query_jumble_ignore)
int funccolcount pg_node_attr(query_jumble_ignore)
List *funccolcollations pg_node_attr(query_jumble_ignore)
List *funccoltypmods pg_node_attr(query_jumble_ignore)
List *funccolnames pg_node_attr(query_jumble_ignore)
int stmt_len
Definition: parsenodes.h:1875
pg_node_attr(no_query_jumble) NodeTag type
Node * stmt
Definition: parsenodes.h:1873
int stmt_location
Definition: parsenodes.h:1874
RoleSpec * newrole
Definition: parsenodes.h:3938
RangeVar * relation
Definition: parsenodes.h:3761
const char * name
Definition: parsenodes.h:3834
ReindexObjectType kind
Definition: parsenodes.h:3831
RangeVar * relation
Definition: parsenodes.h:3833
List * params
Definition: parsenodes.h:3835
NodeTag type
Definition: parsenodes.h:3830
RangeVar * relation
Definition: parsenodes.h:3384
bool missing_ok
Definition: parsenodes.h:3390
ObjectType relationType
Definition: parsenodes.h:3383
DropBehavior behavior
Definition: parsenodes.h:3389
ObjectType renameType
Definition: parsenodes.h:3382
NodeTag type
Definition: parsenodes.h:3381
char * newname
Definition: parsenodes.h:3388
char * subname
Definition: parsenodes.h:3386
Node * object
Definition: parsenodes.h:3385
int location
Definition: parsenodes.h:519
Node * val
Definition: parsenodes.h:518
List * indirection
Definition: parsenodes.h:517
char * name
Definition: parsenodes.h:516
NodeTag type
Definition: parsenodes.h:515
NodeTag type
Definition: parsenodes.h:2063
Node * returnval
Definition: parsenodes.h:2064
RoleSpecType roletype
Definition: parsenodes.h:403
int location
Definition: parsenodes.h:405
NodeTag type
Definition: parsenodes.h:402
char * rolename
Definition: parsenodes.h:404
NodeTag type
Definition: parsenodes.h:1538
LockClauseStrength strength
Definition: parsenodes.h:1540
LockWaitPolicy waitPolicy
Definition: parsenodes.h:1541
char * rulename
Definition: parsenodes.h:3464
Node * whereClause
Definition: parsenodes.h:3465
bool instead
Definition: parsenodes.h:3467
RangeVar * relation
Definition: parsenodes.h:3463
bool replace
Definition: parsenodes.h:3469
CmdType event
Definition: parsenodes.h:3466
List * actions
Definition: parsenodes.h:3468
NodeTag type
Definition: parsenodes.h:3462
ObjectType objtype
Definition: parsenodes.h:3120
NodeTag type
Definition: parsenodes.h:3119
Node * object
Definition: parsenodes.h:3121
char * provider
Definition: parsenodes.h:3122
char * label
Definition: parsenodes.h:3123
LimitOption limitOption
Definition: parsenodes.h:2002
List * sortClause
Definition: parsenodes.h:1999
List * targetList
Definition: parsenodes.h:1977
IntoClause * intoClause
Definition: parsenodes.h:1976
Node * limitOffset
Definition: parsenodes.h:2000
bool groupDistinct
Definition: parsenodes.h:1981
List * fromClause
Definition: parsenodes.h:1978
NodeTag type
Definition: parsenodes.h:1969
List * groupClause
Definition: parsenodes.h:1980
Node * havingClause
Definition: parsenodes.h:1982
List * lockingClause
Definition: parsenodes.h:2003
Node * limitCount
Definition: parsenodes.h:2001
List * windowClause
Definition: parsenodes.h:1983
List * distinctClause
Definition: parsenodes.h:1974
List * valuesLists
Definition: parsenodes.h:1993
struct SelectStmt * larg
Definition: parsenodes.h:2011
struct SelectStmt * rarg
Definition: parsenodes.h:2012
Node * whereClause
Definition: parsenodes.h:1979
SetOperation op
Definition: parsenodes.h:2009
WithClause * withClause
Definition: parsenodes.h:2004
List *groupClauses pg_node_attr(query_jumble_ignore)
List *colTypes pg_node_attr(query_jumble_ignore)
List *colCollations pg_node_attr(query_jumble_ignore)
SetOperation op
Definition: parsenodes.h:2039
List *colTypmods pg_node_attr(query_jumble_ignore)
SortByNulls sortby_nulls
Definition: parsenodes.h:547
Node * node
Definition: parsenodes.h:545
NodeTag type
Definition: parsenodes.h:544
List * useOp
Definition: parsenodes.h:548
SortByDir sortby_dir
Definition: parsenodes.h:546
int location
Definition: parsenodes.h:549
bool hashable pg_node_attr(query_jumble_ignore)
Index tleSortGroupRef
Definition: parsenodes.h:1397
NodeTag type
Definition: parsenodes.h:3259
char * name
Definition: parsenodes.h:3260
Node * expr
Definition: parsenodes.h:3261
Definition: value.h:64
RangeVar * relation
Definition: parsenodes.h:750
char *savepoint_name pg_node_attr(query_jumble_ignore)
TransactionStmtKind kind
Definition: parsenodes.h:3524
char *gid pg_node_attr(query_jumble_ignore)
int location pg_node_attr(query_jumble_location)
List * relations
Definition: parsenodes.h:3096
DropBehavior behavior
Definition: parsenodes.h:3098
bool restart_seqs
Definition: parsenodes.h:3097
NodeTag type
Definition: parsenodes.h:3095
TypeName * typeName
Definition: parsenodes.h:373
int location
Definition: parsenodes.h:374
Node * arg
Definition: parsenodes.h:372
NodeTag type
Definition: parsenodes.h:371
bool setof
Definition: parsenodes.h:269
Oid typeOid
Definition: parsenodes.h:268
bool pct_type
Definition: parsenodes.h:270
List * names
Definition: parsenodes.h:267
NodeTag type
Definition: parsenodes.h:266
List * arrayBounds
Definition: parsenodes.h:273
int32 typemod
Definition: parsenodes.h:272
int location
Definition: parsenodes.h:274
List * typmods
Definition: parsenodes.h:271
NodeTag type
Definition: parsenodes.h:3499
char * conditionname
Definition: parsenodes.h:3500
List * targetList
Definition: parsenodes.h:1924
List * returningList
Definition: parsenodes.h:1927
List * fromClause
Definition: parsenodes.h:1926
NodeTag type
Definition: parsenodes.h:1922
Node * whereClause
Definition: parsenodes.h:1925
RangeVar * relation
Definition: parsenodes.h:1923
WithClause * withClause
Definition: parsenodes.h:1928
RangeVar * relation
Definition: parsenodes.h:3709
NodeTag type
Definition: parsenodes.h:3693
List * options
Definition: parsenodes.h:3694
bool is_vacuumcmd
Definition: parsenodes.h:3696
List * rels
Definition: parsenodes.h:3695
VariableSetKind kind
Definition: parsenodes.h:2472
bool replace
Definition: parsenodes.h:3600
List * options
Definition: parsenodes.h:3601
Node * query
Definition: parsenodes.h:3599
List * aliases
Definition: parsenodes.h:3598
RangeVar * view
Definition: parsenodes.h:3597
NodeTag type
Definition: parsenodes.h:3596
ViewCheckOption withCheckOption
Definition: parsenodes.h:3602
bool inRangeNullsFirst pg_node_attr(query_jumble_ignore)
bool inRangeAsc pg_node_attr(query_jumble_ignore)
Node * startOffset
Definition: parsenodes.h:1505
char *refname pg_node_attr(query_jumble_ignore)
Oid inRangeColl pg_node_attr(query_jumble_ignore)
List * partitionClause
Definition: parsenodes.h:1501
NodeTag type
Definition: parsenodes.h:1496
bool copiedOrder pg_node_attr(query_jumble_ignore)
char *name pg_node_attr(query_jumble_ignore)
Oid startInRangeFunc pg_node_attr(query_jumble_ignore)
Oid endInRangeFunc pg_node_attr(query_jumble_ignore)
Node * endOffset
Definition: parsenodes.h:1506
List *runCondition pg_node_attr(query_jumble_ignore)
List * orderClause
Definition: parsenodes.h:1503
List * orderClause
Definition: parsenodes.h:566
NodeTag type
Definition: parsenodes.h:562
List * partitionClause
Definition: parsenodes.h:565
Node * startOffset
Definition: parsenodes.h:568
char * refname
Definition: parsenodes.h:564
Node * endOffset
Definition: parsenodes.h:569
int frameOptions
Definition: parsenodes.h:567
int location
Definition: parsenodes.h:570
char * name
Definition: parsenodes.h:563
List * ctes
Definition: parsenodes.h:1555
NodeTag type
Definition: parsenodes.h:1554
bool recursive
Definition: parsenodes.h:1556
TypeName * typeName
Definition: parsenodes.h:843
Node * expr
Definition: parsenodes.h:842
NodeTag type
Definition: parsenodes.h:840
XmlOptionType xmloption
Definition: parsenodes.h:841
BitString bsval
Definition: parsenodes.h:353
Node node
Definition: parsenodes.h:348
Float fval
Definition: parsenodes.h:350
String sval
Definition: parsenodes.h:352
Boolean boolval
Definition: parsenodes.h:351
Integer ival
Definition: parsenodes.h:349
const char * type
const char * name