PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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-2026, 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"
31
32
33/* Possible sources of a Query */
34typedef 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 */
44typedef enum SortByDir
45{
49 SORTBY_USING, /* not allowed in CREATE INDEX ... */
51
58
59/* Options for [ ALL | DISTINCT ] */
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 */
74typedef 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 */
117typedef struct Query
118{
120
121 CmdType commandType; /* select|insert|update|delete|merge|utility */
122
123 /* where did I come from? */
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 * We store this as a signed value as this is the form it's displayed to
132 * users in places such as EXPLAIN and pg_stat_statements. Primarily this
133 * is done due to lack of an SQL type to represent the full range of
134 * uint64.
135 */
137
138 /* do I set the command result tag? */
140
141 Node *utilityStmt; /* non-null if commandType == CMD_UTILITY */
142
143 /*
144 * rtable index of target relation for INSERT/UPDATE/DELETE/MERGE; 0 for
145 * SELECT. This is ignored in the query jumble as unrelated to the
146 * compilation of the query ID.
147 */
149
150 /* FOR PORTION OF clause for UPDATE/DELETE */
152
153 /* has aggregates in tlist or havingQual */
155 /* has window functions in tlist */
157 /* has set-returning functions in tlist */
159 /* has subquery SubLink */
161 /* distinctClause is from DISTINCT ON */
163 /* WITH RECURSIVE was specified */
165 /* has INSERT/UPDATE/DELETE/MERGE in WITH */
166 bool hasModifyingCTE pg_node_attr(query_jumble_ignore);
167 /* FOR [KEY] UPDATE/SHARE was specified */
169 /* rewriter has applied some RLS policy */
170 bool hasRowSecurity pg_node_attr(query_jumble_ignore);
171 /* parser has added an RTE_GROUP RTE */
173 /* is a RETURN statement */
175
176 List *cteList; /* WITH list (of CommonTableExpr's) */
177
178 List *rtable; /* list of range table entries */
179
180 /*
181 * list of RTEPermissionInfo nodes for the rtable entries having
182 * perminfoindex > 0
183 */
185 FromExpr *jointree; /* table join tree (FROM and WHERE clauses);
186 * also USING clause for MERGE */
187
188 List *mergeActionList; /* list of actions for MERGE (only) */
189
190 /*
191 * rtable index of target relation for MERGE to pull data. Initially, this
192 * is the same as resultRelation, but after query rewriting, if the target
193 * relation is a trigger-updatable view, this is the index of the expanded
194 * view subquery, whereas resultRelation is the index of the target view.
195 */
197
198 /* join condition between source and target for MERGE */
200
201 List *targetList; /* target list (of TargetEntry) */
202
203 /* OVERRIDING clause */
205
206 OnConflictExpr *onConflict; /* ON CONFLICT DO NOTHING/SELECT/UPDATE */
207
208 /*
209 * The following three fields describe the contents of the RETURNING list
210 * for INSERT/UPDATE/DELETE/MERGE. returningOldAlias and returningNewAlias
211 * are the alias names for OLD and NEW, which may be user-supplied values,
212 * the defaults "old" and "new", or NULL (if the default "old"/"new" is
213 * already in use as the alias for some other relation).
214 */
215 char *returningOldAlias pg_node_attr(query_jumble_ignore);
216 char *returningNewAlias pg_node_attr(query_jumble_ignore);
217 List *returningList; /* return-values list (of TargetEntry) */
218
219 List *groupClause; /* a list of SortGroupClause's */
220 bool groupDistinct; /* was GROUP BY DISTINCT used? */
221 bool groupByAll; /* was GROUP BY ALL used? */
222
223 List *groupingSets; /* a list of GroupingSet's if present */
224
225 Node *havingQual; /* qualifications applied to groups */
226
227 List *windowClause; /* a list of WindowClause's */
228
229 List *distinctClause; /* a list of SortGroupClause's */
230
231 List *sortClause; /* a list of SortGroupClause's */
232
233 Node *limitOffset; /* # of result tuples to skip (int8 expr) */
234 Node *limitCount; /* # of result tuples to return (int8 expr) */
235 LimitOption limitOption; /* limit type */
236
237 List *rowMarks; /* a list of RowMarkClause's */
238
239 Node *setOperations; /* set-operation tree if this is top level of
240 * a UNION/INTERSECT/EXCEPT query */
241
242 /*
243 * A list of pg_constraint OIDs that the query depends on to be
244 * semantically valid
245 */
247
248 /* a list of WithCheckOption's (added during rewrite) */
250
251 /*
252 * The following two fields identify the portion of the source text string
253 * containing this query. They are typically only populated in top-level
254 * Queries, not in sub-queries. When not set, they might both be zero, or
255 * both be -1 meaning "unknown".
256 */
257 /* start location, or -1 if unknown */
259 /* length in bytes; 0 means "rest of string" */
262
263
264/****************************************************************************
265 * Supporting data structures for Parse Trees
266 *
267 * Most of these node types appear in raw parsetrees output by the grammar,
268 * and get transformed to something else by the analyzer. A few of them
269 * are used as-is in transformed querytrees.
270 ****************************************************************************/
271
272/*
273 * TypeName - specifies a type in definitions
274 *
275 * For TypeName structures generated internally, it is often easier to
276 * specify the type by OID than by name. If "names" is NIL then the
277 * actual type OID is given by typeOid, otherwise typeOid is unused.
278 * Similarly, if "typmods" is NIL then the actual typmod is expected to
279 * be prespecified in typemod, otherwise typemod is unused.
280 *
281 * If pct_type is true, then names is actually a field name and we look up
282 * the type of that field. Otherwise (the normal case), names is a type
283 * name possibly qualified with schema and database name.
284 */
285typedef struct TypeName
286{
288 List *names; /* qualified name (list of String nodes) */
289 Oid typeOid; /* type identified by OID */
290 bool setof; /* is a set? */
291 bool pct_type; /* %TYPE specified? */
292 List *typmods; /* type modifier expression(s) */
293 int32 typemod; /* prespecified type modifier */
294 List *arrayBounds; /* array bounds */
295 ParseLoc location; /* token location, or -1 if unknown */
297
298/*
299 * ColumnRef - specifies a reference to a column, or possibly a whole tuple
300 *
301 * The "fields" list must be nonempty. It can contain String nodes
302 * (representing names) and A_Star nodes (representing occurrence of a '*').
303 * Currently, A_Star must appear only as the last list element --- the grammar
304 * is responsible for enforcing this!
305 *
306 * Note: any container subscripting or selection of fields from composite columns
307 * is represented by an A_Indirection node above the ColumnRef. However,
308 * for simplicity in the normal case, initial field selection from a table
309 * name is represented within ColumnRef and not by adding A_Indirection.
310 */
311typedef struct ColumnRef
312{
314 List *fields; /* field names (String nodes) or A_Star */
315 ParseLoc location; /* token location, or -1 if unknown */
317
318/*
319 * ParamRef - specifies a $n parameter reference
320 */
321typedef struct ParamRef
322{
324 int number; /* the number of the parameter */
325 ParseLoc location; /* token location, or -1 if unknown */
327
328/*
329 * A_Expr - infix, prefix, and postfix expressions
330 */
331typedef enum A_Expr_Kind
332{
333 AEXPR_OP, /* normal operator */
334 AEXPR_OP_ANY, /* scalar op ANY (array) */
335 AEXPR_OP_ALL, /* scalar op ALL (array) */
336 AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */
337 AEXPR_NOT_DISTINCT, /* IS NOT DISTINCT FROM - name must be "=" */
338 AEXPR_NULLIF, /* NULLIF - name must be "=" */
339 AEXPR_IN, /* [NOT] IN - name must be "=" or "<>" */
340 AEXPR_LIKE, /* [NOT] LIKE - name must be "~~" or "!~~" */
341 AEXPR_ILIKE, /* [NOT] ILIKE - name must be "~~*" or "!~~*" */
342 AEXPR_SIMILAR, /* [NOT] SIMILAR - name must be "~" or "!~" */
343 AEXPR_BETWEEN, /* name must be "BETWEEN" */
344 AEXPR_NOT_BETWEEN, /* name must be "NOT BETWEEN" */
345 AEXPR_BETWEEN_SYM, /* name must be "BETWEEN SYMMETRIC" */
346 AEXPR_NOT_BETWEEN_SYM, /* name must be "NOT BETWEEN SYMMETRIC" */
348
349typedef struct A_Expr
350{
352
354 A_Expr_Kind kind; /* see above */
355 List *name; /* possibly-qualified name of operator */
356 Node *lexpr; /* left argument, or NULL if none */
357 Node *rexpr; /* right argument, or NULL if none */
358
359 /*
360 * If rexpr is a list of some kind, we separately track its starting and
361 * ending location; it's not the same as the starting and ending location
362 * of the token itself.
363 */
366 ParseLoc location; /* token location, or -1 if unknown */
368
369/*
370 * A_Const - a literal constant
371 *
372 * Value nodes are inline for performance. You can treat 'val' as a node,
373 * as in IsA(&val, Integer). 'val' is not valid if isnull is true.
374 */
384
385typedef struct A_Const
386{
388
391 bool isnull; /* SQL NULL constant */
392 ParseLoc location; /* token location, or -1 if unknown */
394
395/*
396 * TypeCast - a CAST expression
397 */
398typedef struct TypeCast
399{
401 Node *arg; /* the expression being casted */
402 TypeName *typeName; /* the target type */
403 ParseLoc location; /* token location, or -1 if unknown */
405
406/*
407 * CollateClause - a COLLATE expression
408 */
409typedef struct CollateClause
410{
412 Node *arg; /* input expression */
413 List *collname; /* possibly-qualified collation name */
414 ParseLoc location; /* token location, or -1 if unknown */
416
417/*
418 * RoleSpec - a role name or one of a few special values.
419 */
420typedef enum RoleSpecType
421{
422 ROLESPEC_CSTRING, /* role name is stored as a C string */
423 ROLESPEC_CURRENT_ROLE, /* role spec is CURRENT_ROLE */
424 ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
425 ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
426 ROLESPEC_PUBLIC, /* role name is "public" */
428
429typedef struct RoleSpec
430{
432 RoleSpecType roletype; /* Type of this rolespec */
433 char *rolename; /* filled only for ROLESPEC_CSTRING */
434 ParseLoc location; /* token location, or -1 if unknown */
436
437/*
438 * FuncCall - a function or aggregate invocation
439 *
440 * agg_order (if not NIL) indicates we saw 'foo(... ORDER BY ...)', or if
441 * agg_within_group is true, it was 'foo(...) WITHIN GROUP (ORDER BY ...)'.
442 * agg_star indicates we saw a 'foo(*)' construct, while agg_distinct
443 * indicates we saw 'foo(DISTINCT ...)'. In any of these cases, the
444 * construct *must* be an aggregate call. Otherwise, it might be either an
445 * aggregate or some other kind of function. However, if FILTER or OVER is
446 * present it had better be an aggregate or window function.
447 *
448 * Normally, you'd initialize this via makeFuncCall() and then only change the
449 * parts of the struct its defaults don't match afterwards, as needed.
450 */
451typedef struct FuncCall
452{
454 List *funcname; /* qualified name of function */
455 List *args; /* the arguments (list of exprs) */
456 List *agg_order; /* ORDER BY (list of SortBy) */
457 Node *agg_filter; /* FILTER clause, if any */
458 struct WindowDef *over; /* OVER clause, if any */
459 int ignore_nulls; /* ignore nulls for window function */
460 bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */
461 bool agg_star; /* argument was really '*' */
462 bool agg_distinct; /* arguments were labeled DISTINCT */
463 bool func_variadic; /* last argument was labeled VARIADIC */
464 CoercionForm funcformat; /* how to display this node */
465 ParseLoc location; /* token location, or -1 if unknown */
467
468/*
469 * A_Star - '*' representing all columns of a table or compound field
470 *
471 * This can appear within ColumnRef.fields, A_Indirection.indirection, and
472 * ResTarget.indirection lists.
473 */
474typedef struct A_Star
475{
478
479/*
480 * A_Indices - array subscript or slice bounds ([idx] or [lidx:uidx])
481 *
482 * In slice case, either or both of lidx and uidx can be NULL (omitted).
483 * In non-slice case, uidx holds the single subscript and lidx is always NULL.
484 */
485typedef struct A_Indices
486{
488 bool is_slice; /* true if slice (i.e., colon present) */
489 Node *lidx; /* slice lower bound, if any */
490 Node *uidx; /* subscript, or slice upper bound if any */
492
493/*
494 * A_Indirection - select a field and/or array element from an expression
495 *
496 * The indirection list can contain A_Indices nodes (representing
497 * subscripting), String nodes (representing field selection --- the
498 * string value is the name of the field to select), and A_Star nodes
499 * (representing selection of all fields of a composite type).
500 * For example, a complex selection operation like
501 * (foo).field1[42][7].field2
502 * would be represented with a single A_Indirection node having a 4-element
503 * indirection list.
504 *
505 * Currently, A_Star must appear only as the last list element --- the grammar
506 * is responsible for enforcing this!
507 */
508typedef struct A_Indirection
509{
511 Node *arg; /* the thing being selected from */
512 List *indirection; /* subscripts and/or field names and/or * */
514
515/*
516 * A_ArrayExpr - an ARRAY[] construct
517 */
518typedef struct A_ArrayExpr
519{
521 List *elements; /* array element expressions */
522 ParseLoc list_start; /* start of the element list */
523 ParseLoc list_end; /* end of the elements list */
524 ParseLoc location; /* token location, or -1 if unknown */
526
527/*
528 * ResTarget -
529 * result target (used in target list of pre-transformed parse trees)
530 *
531 * In a SELECT target list, 'name' is the column label from an
532 * 'AS ColumnLabel' clause, or NULL if there was none, and 'val' is the
533 * value expression itself. The 'indirection' field is not used.
534 *
535 * INSERT uses ResTarget in its target-column-names list. Here, 'name' is
536 * the name of the destination column, 'indirection' stores any subscripts
537 * attached to the destination, and 'val' is not used.
538 *
539 * In an UPDATE target list, 'name' is the name of the destination column,
540 * 'indirection' stores any subscripts attached to the destination, and
541 * 'val' is the expression to assign.
542 *
543 * See A_Indirection for more info about what can appear in 'indirection'.
544 */
545typedef struct ResTarget
546{
548 char *name; /* column name or NULL */
549 List *indirection; /* subscripts, field names, and '*', or NIL */
550 Node *val; /* the value expression to compute or assign */
551 ParseLoc location; /* token location, or -1 if unknown */
553
554/*
555 * MultiAssignRef - element of a row source expression for UPDATE
556 *
557 * In an UPDATE target list, when we have SET (a,b,c) = row-valued-expression,
558 * we generate separate ResTarget items for each of a,b,c. Their "val" trees
559 * are MultiAssignRef nodes numbered 1..n, linking to a common copy of the
560 * row-valued-expression (which parse analysis will process only once, when
561 * handling the MultiAssignRef with colno=1).
562 */
563typedef struct MultiAssignRef
564{
566 Node *source; /* the row-valued expression */
567 int colno; /* column number for this target (1..n) */
568 int ncolumns; /* number of targets in the construct */
570
571/*
572 * SortBy - for ORDER BY clause
573 */
574typedef struct SortBy
575{
577 Node *node; /* expression to sort on */
578 SortByDir sortby_dir; /* ASC/DESC/USING/default */
579 SortByNulls sortby_nulls; /* NULLS FIRST/LAST */
580 List *useOp; /* name of op to use, if SORTBY_USING */
581 ParseLoc location; /* operator location, or -1 if none/unknown */
583
584/*
585 * WindowDef - raw representation of WINDOW and OVER clauses
586 *
587 * For entries in a WINDOW list, "name" is the window name being defined.
588 * For OVER clauses, we use "name" for the "OVER window" syntax, or "refname"
589 * for the "OVER (window)" syntax, which is subtly different --- the latter
590 * implies overriding the window frame clause.
591 */
592typedef struct WindowDef
593{
595 char *name; /* window's own name */
596 char *refname; /* referenced window name, if any */
597 List *partitionClause; /* PARTITION BY expression list */
598 List *orderClause; /* ORDER BY (list of SortBy) */
599 int frameOptions; /* frame_clause options, see below */
600 Node *startOffset; /* expression for starting bound, if any */
601 Node *endOffset; /* expression for ending bound, if any */
602 ParseLoc location; /* parse location, or -1 if none/unknown */
604
605/*
606 * frameOptions is an OR of these bits. The NONDEFAULT and BETWEEN bits are
607 * used so that ruleutils.c can tell which properties were specified and
608 * which were defaulted; the correct behavioral bits must be set either way.
609 * The START_foo and END_foo options must come in pairs of adjacent bits for
610 * the convenience of gram.y, even though some of them are useless/invalid.
611 */
612#define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */
613#define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */
614#define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */
615#define FRAMEOPTION_GROUPS 0x00008 /* GROUPS behavior */
616#define FRAMEOPTION_BETWEEN 0x00010 /* BETWEEN given? */
617#define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00020 /* start is U. P. */
618#define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00040 /* (disallowed) */
619#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00080 /* (disallowed) */
620#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00100 /* end is U. F. */
621#define FRAMEOPTION_START_CURRENT_ROW 0x00200 /* start is C. R. */
622#define FRAMEOPTION_END_CURRENT_ROW 0x00400 /* end is C. R. */
623#define FRAMEOPTION_START_OFFSET_PRECEDING 0x00800 /* start is O. P. */
624#define FRAMEOPTION_END_OFFSET_PRECEDING 0x01000 /* end is O. P. */
625#define FRAMEOPTION_START_OFFSET_FOLLOWING 0x02000 /* start is O. F. */
626#define FRAMEOPTION_END_OFFSET_FOLLOWING 0x04000 /* end is O. F. */
627#define FRAMEOPTION_EXCLUDE_CURRENT_ROW 0x08000 /* omit C.R. */
628#define FRAMEOPTION_EXCLUDE_GROUP 0x10000 /* omit C.R. & peers */
629#define FRAMEOPTION_EXCLUDE_TIES 0x20000 /* omit C.R.'s peers */
630
631#define FRAMEOPTION_START_OFFSET \
632 (FRAMEOPTION_START_OFFSET_PRECEDING | FRAMEOPTION_START_OFFSET_FOLLOWING)
633#define FRAMEOPTION_END_OFFSET \
634 (FRAMEOPTION_END_OFFSET_PRECEDING | FRAMEOPTION_END_OFFSET_FOLLOWING)
635#define FRAMEOPTION_EXCLUSION \
636 (FRAMEOPTION_EXCLUDE_CURRENT_ROW | FRAMEOPTION_EXCLUDE_GROUP | \
637 FRAMEOPTION_EXCLUDE_TIES)
638
639#define FRAMEOPTION_DEFAULTS \
640 (FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \
641 FRAMEOPTION_END_CURRENT_ROW)
642
643/*
644 * RangeSubselect - subquery appearing in a FROM clause
645 */
646typedef struct RangeSubselect
647{
649 bool lateral; /* does it have LATERAL prefix? */
650 Node *subquery; /* the untransformed sub-select clause */
651 Alias *alias; /* table alias & optional column aliases */
653
654/*
655 * RangeFunction - function call appearing in a FROM clause
656 *
657 * functions is a List because we use this to represent the construct
658 * ROWS FROM(func1(...), func2(...), ...). Each element of this list is a
659 * two-element sublist, the first element being the untransformed function
660 * call tree, and the second element being a possibly-empty list of ColumnDef
661 * nodes representing any columndef list attached to that function within the
662 * ROWS FROM() syntax.
663 *
664 * alias and coldeflist represent any alias and/or columndef list attached
665 * at the top level. (We disallow coldeflist appearing both here and
666 * per-function, but that's checked in parse analysis, not by the grammar.)
667 */
668typedef struct RangeFunction
669{
671 bool lateral; /* does it have LATERAL prefix? */
672 bool ordinality; /* does it have WITH ORDINALITY suffix? */
673 bool is_rowsfrom; /* is result of ROWS FROM() syntax? */
674 List *functions; /* per-function information, see above */
675 Alias *alias; /* table alias & optional column aliases */
676 List *coldeflist; /* list of ColumnDef nodes to describe result
677 * of function returning RECORD */
679
680/*
681 * RangeTableFunc - raw form of "table functions" such as XMLTABLE
682 *
683 * Note: JSON_TABLE is also a "table function", but it uses JsonTable node,
684 * not RangeTableFunc.
685 */
686typedef struct RangeTableFunc
687{
689 bool lateral; /* does it have LATERAL prefix? */
690 Node *docexpr; /* document expression */
691 Node *rowexpr; /* row generator expression */
692 List *namespaces; /* list of namespaces as ResTarget */
693 List *columns; /* list of RangeTableFuncCol */
694 Alias *alias; /* table alias & optional column aliases */
695 ParseLoc location; /* token location, or -1 if unknown */
697
698/*
699 * RangeTableFuncCol - one column in a RangeTableFunc->columns
700 *
701 * If for_ordinality is true (FOR ORDINALITY), then the column is an int4
702 * column and the rest of the fields are ignored.
703 */
704typedef struct RangeTableFuncCol
705{
707 char *colname; /* name of generated column */
708 TypeName *typeName; /* type of generated column */
709 bool for_ordinality; /* does it have FOR ORDINALITY? */
710 bool is_not_null; /* does it have NOT NULL? */
711 Node *colexpr; /* column filter expression */
712 Node *coldefexpr; /* column default value expression */
713 ParseLoc location; /* token location, or -1 if unknown */
715
716/*
717 * RangeGraphTable - raw form of GRAPH_TABLE clause
718 */
719typedef struct RangeGraphTable
720{
725 Alias *alias; /* table alias & optional column aliases */
726 ParseLoc location; /* token location, or -1 if unknown */
728
729/*
730 * RangeTableSample - TABLESAMPLE appearing in a raw FROM clause
731 *
732 * This node, appearing only in raw parse trees, represents
733 * <relation> TABLESAMPLE <method> (<params>) REPEATABLE (<num>)
734 * Currently, the <relation> can only be a RangeVar, but we might in future
735 * allow RangeSubselect and other options. Note that the RangeTableSample
736 * is wrapped around the node representing the <relation>, rather than being
737 * a subfield of it.
738 */
739typedef struct RangeTableSample
740{
742 Node *relation; /* relation to be sampled */
743 List *method; /* sampling method name (possibly qualified) */
744 List *args; /* argument(s) for sampling method */
745 Node *repeatable; /* REPEATABLE expression, or NULL if none */
746 ParseLoc location; /* method name location, or -1 if unknown */
748
749/*
750 * ColumnDef - column definition (used in various creates)
751 *
752 * If the column has a default value, we may have the value expression
753 * in either "raw" form (an untransformed parse tree) or "cooked" form
754 * (a post-parse-analysis, executable expression tree), depending on
755 * how this ColumnDef node was created (by parsing, or by inheritance
756 * from an existing relation). We should never have both in the same node!
757 *
758 * Similarly, we may have a COLLATE specification in either raw form
759 * (represented as a CollateClause with arg==NULL) or cooked form
760 * (the collation's OID).
761 *
762 * The constraints list may contain a CONSTR_DEFAULT item in a raw
763 * parsetree produced by gram.y, but transformCreateStmt will remove
764 * the item and set raw_default instead. CONSTR_DEFAULT items
765 * should not appear in any subsequent processing.
766 */
767typedef struct ColumnDef
768{
770 char *colname; /* name of column */
771 TypeName *typeName; /* type of column */
772 char *compression; /* compression method for column */
773 int16 inhcount; /* number of times column is inherited */
774 bool is_local; /* column has local (non-inherited) def'n */
775 bool is_not_null; /* NOT NULL constraint specified? */
776 bool is_from_type; /* column definition came from table type */
777 char storage; /* attstorage setting, or 0 for default */
778 char *storage_name; /* attstorage setting name or NULL for default */
779 Node *raw_default; /* default value (untransformed parse tree) */
780 Node *cooked_default; /* default value (transformed expr tree) */
781 char identity; /* attidentity setting */
782 RangeVar *identitySequence; /* to store identity sequence name for
783 * ALTER TABLE ... ADD COLUMN */
784 char generated; /* attgenerated setting */
785 CollateClause *collClause; /* untransformed COLLATE spec, if any */
786 Oid collOid; /* collation OID (InvalidOid if not set) */
787 List *constraints; /* other constraints on column */
788 List *fdwoptions; /* per-column FDW options */
789 ParseLoc location; /* parse location, or -1 if none/unknown */
791
792/*
793 * TableLikeClause - CREATE TABLE ( ... LIKE ... ) clause
794 */
795typedef struct TableLikeClause
796{
799 uint32 options; /* OR of TableLikeOption flags */
800 Oid relationOid; /* If table has been looked up, its OID */
802
816
817/*
818 * IndexElem - index parameters (used in CREATE INDEX, and in ON CONFLICT)
819 *
820 * For a plain index attribute, 'name' is the name of the table column to
821 * index, and 'expr' is NULL. For an index expression, 'name' is NULL and
822 * 'expr' is the expression tree.
823 */
824typedef struct IndexElem
825{
827 char *name; /* name of attribute to index, or NULL */
828 Node *expr; /* expression to index, or NULL */
829 char *indexcolname; /* name for index column; NULL = default */
830 List *collation; /* name of collation; NIL = default */
831 List *opclass; /* name of desired opclass; NIL = default */
832 List *opclassopts; /* opclass-specific options, or NIL */
833 SortByDir ordering; /* ASC/DESC/default */
834 SortByNulls nulls_ordering; /* FIRST/LAST/default */
835 ParseLoc location; /* token location, or -1 if unknown */
837
838/*
839 * DefElem - a generic "name = value" option definition
840 *
841 * In some contexts the name can be qualified. Also, certain SQL commands
842 * allow a SET/ADD/DROP action to be attached to option settings, so it's
843 * convenient to carry a field for that too. (Note: currently, it is our
844 * practice that the grammar allows namespace and action only in statements
845 * where they are relevant; C code can just ignore those fields in other
846 * statements.)
847 */
855
856typedef struct DefElem
857{
859 char *defnamespace; /* NULL if unqualified name */
860 char *defname;
861 Node *arg; /* typically Integer, Float, String, or
862 * TypeName */
863 DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */
864 ParseLoc location; /* token location, or -1 if unknown */
866
867/*
868 * LockingClause - raw representation of FOR [NO KEY] UPDATE/[KEY] SHARE
869 * options
870 *
871 * Note: lockedRels == NIL means "all relations in query". Otherwise it
872 * is a list of RangeVar nodes. (We use RangeVar mainly because it carries
873 * a location field --- currently, parse analysis insists on unqualified
874 * names in LockingClause.)
875 */
876typedef struct LockingClause
877{
879 List *lockedRels; /* FOR [KEY] UPDATE/SHARE relations */
881 LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
883
884/*
885 * XMLSERIALIZE (in raw parse tree only)
886 */
887typedef struct XmlSerialize
888{
890 XmlOptionType xmloption; /* DOCUMENT or CONTENT */
893 bool indent; /* [NO] INDENT */
894 ParseLoc location; /* token location, or -1 if unknown */
896
897/* Partitioning related definitions */
898
899/*
900 * PartitionElem - parse-time representation of a single partition key
901 *
902 * expr can be either a raw expression tree or a parse-analyzed expression.
903 * We don't store these on-disk, though.
904 */
905typedef struct PartitionElem
906{
908 char *name; /* name of column to partition on, or NULL */
909 Node *expr; /* expression to partition on, or NULL */
910 List *collation; /* name of collation; NIL = default */
911 List *opclass; /* name of desired opclass; NIL = default */
912 ParseLoc location; /* token location, or -1 if unknown */
914
921
922/*
923 * PartitionSpec - parse-time representation of a partition key specification
924 *
925 * This represents the key space we will be partitioning on.
926 */
927typedef struct PartitionSpec
928{
931 List *partParams; /* List of PartitionElems */
932 ParseLoc location; /* token location, or -1 if unknown */
934
935/*
936 * PartitionBoundSpec - a partition bound specification
937 *
938 * This represents the portion of the partition key space assigned to a
939 * particular partition. These are stored on disk in pg_class.relpartbound.
940 */
942{
944
945 char strategy; /* see PARTITION_STRATEGY codes above */
946 bool is_default; /* is it a default partition bound? */
947
948 /* Partitioning info for HASH strategy: */
951
952 /* Partitioning info for LIST strategy: */
953 List *listdatums; /* List of Consts (or A_Consts in raw tree) */
954
955 /* Partitioning info for RANGE strategy: */
956 List *lowerdatums; /* List of PartitionRangeDatums */
957 List *upperdatums; /* List of PartitionRangeDatums */
958
959 ParseLoc location; /* token location, or -1 if unknown */
960};
961
962/*
963 * PartitionRangeDatum - one of the values in a range partition bound
964 *
965 * This can be MINVALUE, MAXVALUE or a specific bounded value.
966 */
968{
969 PARTITION_RANGE_DATUM_MINVALUE = -1, /* less than any other value */
970 PARTITION_RANGE_DATUM_VALUE = 0, /* a specific (bounded) value */
971 PARTITION_RANGE_DATUM_MAXVALUE = 1, /* greater than any other value */
973
975{
977
979 Node *value; /* Const (or A_Const in raw tree), if kind is
980 * PARTITION_RANGE_DATUM_VALUE, else NULL */
981
982 ParseLoc location; /* token location, or -1 if unknown */
984
985/*
986 * PartitionDesc - info about a single partition for the ALTER TABLE SPLIT
987 * PARTITION command
988 */
990{
992
993 RangeVar *name; /* name of partition */
994 PartitionBoundSpec *bound; /* FOR VALUES, if attaching */
996
997/*
998 * PartitionCmd - info for ALTER TABLE/INDEX ATTACH/DETACH PARTITION and for
999 * ALTER TABLE SPLIT/MERGE PARTITION(S) commands
1000 */
1001typedef struct PartitionCmd
1002{
1004
1005 /* name of partition to attach/detach/merge/split */
1007
1008 /* FOR VALUES, if attaching */
1010
1011 /*
1012 * list of partitions to be split/merged, used in ALTER TABLE MERGE
1013 * PARTITIONS and ALTER TABLE SPLIT PARTITIONS. For merge partitions,
1014 * partlist is a list of RangeVar; For split partition, it is a list of
1015 * SinglePartitionSpec.
1016 */
1018
1021
1022/*
1023 * Nodes for graph pattern
1024 */
1025
1032
1041
1042#define IS_EDGE_PATTERN(kind) ((kind) == EDGE_PATTERN_ANY || \
1043 (kind) == EDGE_PATTERN_RIGHT || \
1044 (kind) == EDGE_PATTERN_LEFT)
1045
1057
1058/****************************************************************************
1059 * Nodes for a Query tree
1060 ****************************************************************************/
1061
1062/*--------------------
1063 * RangeTblEntry -
1064 * A range table is a List of RangeTblEntry nodes.
1065 *
1066 * A range table entry may represent a plain relation, a sub-select in
1067 * FROM, or the result of a JOIN clause. (Only explicit JOIN syntax
1068 * produces an RTE, not the implicit join resulting from multiple FROM
1069 * items. This is because we only need the RTE to deal with SQL features
1070 * like outer joins and join-output-column aliasing.) Other special
1071 * RTE types also exist, as indicated by RTEKind.
1072 *
1073 * Note that we consider RTE_RELATION to cover anything that has a pg_class
1074 * entry. relkind distinguishes the sub-cases.
1075 *
1076 * alias is an Alias node representing the AS alias-clause attached to the
1077 * FROM expression, or NULL if no clause.
1078 *
1079 * eref is the table reference name and column reference names (either
1080 * real or aliases). Note that system columns (OID etc) are not included
1081 * in the column list.
1082 * eref->aliasname is required to be present, and should generally be used
1083 * to identify the RTE for error messages etc.
1084 *
1085 * In RELATION RTEs, the colnames in both alias and eref are indexed by
1086 * physical attribute number; this means there must be colname entries for
1087 * dropped columns. When building an RTE we insert empty strings ("") for
1088 * dropped columns. Note however that a stored rule may have nonempty
1089 * colnames for columns dropped since the rule was created (and for that
1090 * matter the colnames might be out of date due to column renamings).
1091 * The same comments apply to FUNCTION RTEs when a function's return type
1092 * is a named composite type.
1093 *
1094 * In JOIN RTEs, the colnames in both alias and eref are one-to-one with
1095 * joinaliasvars entries. A JOIN RTE will omit columns of its inputs when
1096 * those columns are known to be dropped at parse time. Again, however,
1097 * a stored rule might contain entries for columns dropped since the rule
1098 * was created. (This is only possible for columns not actually referenced
1099 * in the rule.) When loading a stored rule, we replace the joinaliasvars
1100 * items for any such columns with null pointers. (We can't simply delete
1101 * them from the joinaliasvars list, because that would affect the attnums
1102 * of Vars referencing the rest of the list.)
1103 *
1104 * inFromCl marks those range variables that are listed in the FROM clause.
1105 * It's false for RTEs that are added to a query behind the scenes, such
1106 * as the NEW and OLD variables for a rule, or the subqueries of a UNION.
1107 * This flag is not used during parsing (except in transformLockingClause,
1108 * q.v.); the parser now uses a separate "namespace" data structure to
1109 * control visibility. But it is needed by ruleutils.c to determine
1110 * whether RTEs should be shown in decompiled queries.
1111 *
1112 * securityQuals is a list of security barrier quals (boolean expressions),
1113 * to be tested in the listed order before returning a row from the
1114 * relation. It is always NIL in parser output. Entries are added by the
1115 * rewriter to implement security-barrier views and/or row-level security.
1116 * Note that the planner turns each boolean expression into an implicitly
1117 * AND'ed sublist, as is its usual habit with qualification expressions.
1118 *--------------------
1119 */
1120typedef enum RTEKind
1121{
1122 RTE_RELATION, /* ordinary relation reference */
1123 RTE_SUBQUERY, /* subquery in FROM */
1124 RTE_JOIN, /* join */
1125 RTE_FUNCTION, /* function in FROM */
1126 RTE_TABLEFUNC, /* TableFunc(.., column list) */
1127 RTE_VALUES, /* VALUES (<exprlist>), (<exprlist>), ... */
1128 RTE_CTE, /* common table expr (WITH list element) */
1129 RTE_NAMEDTUPLESTORE, /* tuplestore, e.g. for AFTER triggers */
1130 RTE_GRAPH_TABLE, /* GRAPH_TABLE clause */
1131 RTE_RESULT, /* RTE represents an empty FROM clause; such
1132 * RTEs are added by the planner, they're not
1133 * present during parsing or rewriting */
1134 RTE_GROUP, /* the grouping step */
1136
1137typedef struct RangeTblEntry
1138{
1140
1141 NodeTag type;
1142
1143 /*
1144 * Fields valid in all RTEs:
1145 *
1146 * put alias + eref first to make dump more legible
1147 */
1148 /* user-written alias clause, if any */
1150
1151 /*
1152 * Expanded reference names. This uses a custom query jumble function so
1153 * that the table name is included in the computation, but not its list of
1154 * columns.
1155 */
1157
1158 RTEKind rtekind; /* see above */
1159
1160 /*
1161 * Fields valid for a plain relation RTE (else zero):
1162 *
1163 * inh is true for relation references that should be expanded to include
1164 * inheritance children, if the rel has any. In the parser, this will
1165 * only be true for RTE_RELATION entries. The planner also uses this
1166 * field to mark RTE_SUBQUERY entries that contain UNION ALL queries that
1167 * it has flattened into pulled-up subqueries (creating a structure much
1168 * like the effects of inheritance).
1169 *
1170 * rellockmode is really LOCKMODE, but it's declared int to avoid having
1171 * to include lock-related headers here. It must be RowExclusiveLock if
1172 * the RTE is an INSERT/UPDATE/DELETE/MERGE target, else RowShareLock if
1173 * the RTE is a SELECT FOR UPDATE/FOR SHARE target, else AccessShareLock.
1174 *
1175 * Note: in some cases, rule expansion may result in RTEs that are marked
1176 * with RowExclusiveLock even though they are not the target of the
1177 * current query; this happens if a DO ALSO rule simply scans the original
1178 * target table. We leave such RTEs with their original lockmode so as to
1179 * avoid getting an additional, lesser lock.
1180 *
1181 * perminfoindex is 1-based index of the RTEPermissionInfo belonging to
1182 * this RTE in the containing struct's list of same; 0 if permissions need
1183 * not be checked for this RTE.
1184 *
1185 * As a special case, relid, relkind, rellockmode, and perminfoindex can
1186 * also be set (nonzero) in an RTE_SUBQUERY RTE. This occurs when we
1187 * convert an RTE_RELATION RTE naming a view into an RTE_SUBQUERY
1188 * containing the view's query. We still need to perform run-time locking
1189 * and permission checks on the view, even though it's not directly used
1190 * in the query anymore, and the most expedient way to do that is to
1191 * retain these fields from the old state of the RTE.
1192 *
1193 * As a special case, RTE_NAMEDTUPLESTORE can also set relid to indicate
1194 * that the tuple format of the tuplestore is the same as the referenced
1195 * relation. This allows plans referencing AFTER trigger transition
1196 * tables to be invalidated if the underlying table is altered.
1197 */
1198 /* OID of the relation */
1200 /* inheritance requested? */
1201 bool inh;
1202 /* relation kind (see pg_class.relkind) */
1204 /* lock level that query requires on the rel */
1206 /* index of RTEPermissionInfo entry, or 0 */
1208 /* sampling info, or NULL */
1210
1211 /*
1212 * Fields valid for a subquery RTE (else NULL):
1213 */
1214 /* the sub-query */
1216 /* is from security_barrier view? */
1217 bool security_barrier pg_node_attr(query_jumble_ignore);
1218
1219 /*
1220 * Fields valid for a join RTE (else NULL/zero):
1221 *
1222 * joinaliasvars is a list of (usually) Vars corresponding to the columns
1223 * of the join result. An alias Var referencing column K of the join
1224 * result can be replaced by the K'th element of joinaliasvars --- but to
1225 * simplify the task of reverse-listing aliases correctly, we do not do
1226 * that until planning time. In detail: an element of joinaliasvars can
1227 * be a Var of one of the join's input relations, or such a Var with an
1228 * implicit coercion to the join's output column type, or a COALESCE
1229 * expression containing the two input column Vars (possibly coerced).
1230 * Elements beyond the first joinmergedcols entries are always just Vars,
1231 * and are never referenced from elsewhere in the query (that is, join
1232 * alias Vars are generated only for merged columns). We keep these
1233 * entries only because they're needed in expandRTE() and similar code.
1234 *
1235 * Vars appearing within joinaliasvars are marked with varnullingrels sets
1236 * that describe the nulling effects of this join and lower ones. This is
1237 * essential for FULL JOIN cases, because the COALESCE expression only
1238 * describes the semantics correctly if its inputs have been nulled by the
1239 * join. For other cases, it allows expandRTE() to generate a valid
1240 * representation of the join's output without consulting additional
1241 * parser state.
1242 *
1243 * Within a Query loaded from a stored rule, it is possible for non-merged
1244 * joinaliasvars items to be null pointers, which are placeholders for
1245 * (necessarily unreferenced) columns dropped since the rule was made.
1246 * Also, once planning begins, joinaliasvars items can be almost anything,
1247 * as a result of subquery-flattening substitutions.
1248 *
1249 * joinleftcols is an integer list of physical column numbers of the left
1250 * join input rel that are included in the join; likewise joinrighttcols
1251 * for the right join input rel. (Which rels those are can be determined
1252 * from the associated JoinExpr.) If the join is USING/NATURAL, then the
1253 * first joinmergedcols entries in each list identify the merged columns.
1254 * The merged columns come first in the join output, then remaining
1255 * columns of the left input, then remaining columns of the right.
1256 *
1257 * Note that input columns could have been dropped after creation of a
1258 * stored rule, if they are not referenced in the query (in particular,
1259 * merged columns could not be dropped); this is not accounted for in
1260 * joinleftcols/joinrighttcols.
1261 */
1263 /* number of merged (JOIN USING) columns */
1265 /* list of alias-var expansions */
1267 /* left-side input column numbers */
1269 /* right-side input column numbers */
1271
1272 /*
1273 * join_using_alias is an alias clause attached directly to JOIN/USING. It
1274 * is different from the alias field (above) in that it does not hide the
1275 * range variables of the tables being joined.
1276 */
1278
1279 /*
1280 * Fields valid for a function RTE (else NIL/zero):
1281 *
1282 * When funcordinality is true, the eref->colnames list includes an alias
1283 * for the ordinality column. The ordinality column is otherwise
1284 * implicit, and must be accounted for "by hand" in places such as
1285 * expandRTE().
1286 */
1287 /* list of RangeTblFunction nodes */
1289 /* is this called WITH ORDINALITY? */
1291
1292 /*
1293 * Fields valid for a TableFunc RTE (else NULL):
1294 */
1296
1297 /*
1298 * Fields valid for a graph table RTE (else NULL):
1299 */
1302
1303 /*
1304 * Fields valid for a values RTE (else NIL):
1305 */
1306 /* list of expression lists */
1308
1309 /*
1310 * Fields valid for a CTE RTE (else NULL/zero):
1311 */
1312 /* name of the WITH list item */
1313 char *ctename;
1314 /* number of query levels up */
1316 /* is this a recursive self-reference? */
1318
1319 /*
1320 * Fields valid for CTE, VALUES, ENR, and TableFunc RTEs (else NIL):
1321 *
1322 * We need these for CTE RTEs so that the types of self-referential
1323 * columns are well-defined. For VALUES RTEs, storing these explicitly
1324 * saves having to re-determine the info by scanning the values_lists. For
1325 * ENRs, we store the types explicitly here (we could get the information
1326 * from the catalogs if 'relid' was supplied, but we'd still need these
1327 * for TupleDesc-based ENRs, so we might as well always store the type
1328 * info here). For TableFuncs, these fields are redundant with data in
1329 * the TableFunc node, but keeping them here allows some code sharing with
1330 * the other cases.
1331 *
1332 * For ENRs only, we have to consider the possibility of dropped columns.
1333 * A dropped column is included in these lists, but it will have zeroes in
1334 * all three lists (as well as an empty-string entry in eref). Testing
1335 * for zero coltype is the standard way to detect a dropped column.
1336 */
1337 /* OID list of column type OIDs */
1339 /* integer list of column typmods */
1341 /* OID list of column collation OIDs */
1343
1344 /*
1345 * Fields valid for ENR RTEs (else NULL/zero):
1346 */
1347 /* name of ephemeral named relation */
1348 char *enrname;
1349 /* estimated or actual from caller */
1351
1352 /*
1353 * Fields valid for a GROUP RTE (else NIL):
1354 */
1355 /* list of grouping expressions */
1357
1358 /*
1359 * Fields valid in all RTEs:
1360 */
1361 /* was LATERAL specified? */
1363 /* present in FROM clause? */
1365 /* security barrier quals to apply, if any */
1368
1369/*
1370 * RTEPermissionInfo
1371 * Per-relation information for permission checking. Added to the Query
1372 * node by the parser when adding the corresponding RTE to the query
1373 * range table and subsequently editorialized on by the rewriter if
1374 * needed after rule expansion.
1375 *
1376 * Only the relations directly mentioned in the query are checked for
1377 * access permissions by the core executor, so only their RTEPermissionInfos
1378 * are present in the Query. However, extensions may want to check inheritance
1379 * children too, depending on the value of rte->inh, so it's copied in 'inh'
1380 * for their perusal.
1381 *
1382 * requiredPerms and checkAsUser specify run-time access permissions checks
1383 * to be performed at query startup. The user must have *all* of the
1384 * permissions that are OR'd together in requiredPerms (never 0!). If
1385 * checkAsUser is not zero, then do the permissions checks using the access
1386 * rights of that user, not the current effective user ID. (This allows rules
1387 * to act as setuid gateways.)
1388 *
1389 * For SELECT/INSERT/UPDATE permissions, if the user doesn't have table-wide
1390 * permissions then it is sufficient to have the permissions on all columns
1391 * identified in selectedCols (for SELECT) and/or insertedCols and/or
1392 * updatedCols (INSERT with ON CONFLICT DO UPDATE may have all 3).
1393 * selectedCols, insertedCols and updatedCols are bitmapsets, which cannot have
1394 * negative integer members, so we subtract FirstLowInvalidHeapAttributeNumber
1395 * from column numbers before storing them in these fields. A whole-row Var
1396 * reference is represented by setting the bit for InvalidAttrNumber.
1397 *
1398 * updatedCols is also used in some other places, for example, to determine
1399 * which triggers to fire and in FDWs to know which changed columns they need
1400 * to ship off.
1401 */
1402typedef struct RTEPermissionInfo
1403{
1405
1406 Oid relid; /* relation OID */
1407 bool inh; /* separately check inheritance children? */
1408 AclMode requiredPerms; /* bitmask of required access permissions */
1409 Oid checkAsUser; /* if valid, check access as this role */
1410 Bitmapset *selectedCols; /* columns needing SELECT permission */
1411 Bitmapset *insertedCols; /* columns needing INSERT permission */
1412 Bitmapset *updatedCols; /* columns needing UPDATE permission */
1414
1415/*
1416 * RangeTblFunction -
1417 * RangeTblEntry subsidiary data for one function in a FUNCTION RTE.
1418 *
1419 * If the function had a column definition list (required for an
1420 * otherwise-unspecified RECORD result), funccolnames lists the names given
1421 * in the definition list, funccoltypes lists their declared column types,
1422 * funccoltypmods lists their typmods, funccolcollations their collations.
1423 * Otherwise, those fields are NIL.
1424 *
1425 * Notice we don't attempt to store info about the results of functions
1426 * returning named composite types, because those can change from time to
1427 * time. We do however remember how many columns we thought the type had
1428 * (including dropped columns!), so that we can successfully ignore any
1429 * columns added after the query was parsed.
1430 *
1431 * The query jumbling only needs to track the function expression.
1432 */
1433typedef struct RangeTblFunction
1434{
1436
1437 Node *funcexpr; /* expression tree for func call */
1438 /* number of columns it contributes to RTE */
1440 /* These fields record the contents of a column definition list, if any: */
1441 /* column names (list of String) */
1443 /* OID list of column type OIDs */
1445 /* integer list of column typmods */
1447 /* OID list of column collation OIDs */
1449
1450 /* This is set during planning for use by the executor: */
1451 /* PARAM_EXEC Param IDs affecting this func */
1454
1455/*
1456 * TableSampleClause - TABLESAMPLE appearing in a transformed FROM clause
1457 *
1458 * Unlike RangeTableSample, this is a subnode of the relevant RangeTblEntry.
1459 */
1460typedef struct TableSampleClause
1461{
1463 Oid tsmhandler; /* OID of the tablesample handler function */
1464 List *args; /* tablesample argument expression(s) */
1465 Expr *repeatable; /* REPEATABLE expression, or NULL if none */
1467
1468/*
1469 * WithCheckOption -
1470 * representation of WITH CHECK OPTION checks to be applied to new tuples
1471 * when inserting/updating an auto-updatable view, or RLS WITH CHECK
1472 * policies to be applied when inserting/updating a relation with RLS.
1473 */
1474typedef enum WCOKind
1475{
1476 WCO_VIEW_CHECK, /* WCO on an auto-updatable view */
1477 WCO_RLS_INSERT_CHECK, /* RLS INSERT WITH CHECK policy */
1478 WCO_RLS_UPDATE_CHECK, /* RLS UPDATE WITH CHECK policy */
1479 WCO_RLS_CONFLICT_CHECK, /* RLS ON CONFLICT DO SELECT/UPDATE USING
1480 * policy */
1481 WCO_RLS_MERGE_UPDATE_CHECK, /* RLS MERGE UPDATE USING policy */
1482 WCO_RLS_MERGE_DELETE_CHECK, /* RLS MERGE DELETE USING policy */
1484
1485typedef struct WithCheckOption
1486{
1488 WCOKind kind; /* kind of WCO */
1489 char *relname; /* name of relation that specified the WCO */
1490 char *polname; /* name of RLS policy being checked */
1491 Node *qual; /* constraint qual to check */
1492 bool cascaded; /* true for a cascaded WCO on a view */
1494
1495/*
1496 * SortGroupClause -
1497 * representation of ORDER BY, GROUP BY, PARTITION BY,
1498 * DISTINCT, DISTINCT ON items
1499 *
1500 * You might think that ORDER BY is only interested in defining ordering,
1501 * and GROUP/DISTINCT are only interested in defining equality. However,
1502 * one way to implement grouping is to sort and then apply a "uniq"-like
1503 * filter. So it's also interesting to keep track of possible sort operators
1504 * for GROUP/DISTINCT, and in particular to try to sort for the grouping
1505 * in a way that will also yield a requested ORDER BY ordering. So we need
1506 * to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates
1507 * the decision to give them the same representation.
1508 *
1509 * tleSortGroupRef must match ressortgroupref of exactly one entry of the
1510 * query's targetlist; that is the expression to be sorted or grouped by.
1511 * eqop is the OID of the equality operator.
1512 * sortop is the OID of the ordering operator (a "<" or ">" operator),
1513 * or InvalidOid if not available.
1514 * nulls_first means about what you'd expect. If sortop is InvalidOid
1515 * then nulls_first is meaningless and should be set to false.
1516 * hashable is true if eqop is hashable (note this condition also depends
1517 * on the datatype of the input expression).
1518 *
1519 * In an ORDER BY item, all fields must be valid. (The eqop isn't essential
1520 * here, but it's cheap to get it along with the sortop, and requiring it
1521 * to be valid eases comparisons to grouping items.) Note that this isn't
1522 * actually enough information to determine an ordering: if the sortop is
1523 * collation-sensitive, a collation OID is needed too. We don't store the
1524 * collation in SortGroupClause because it's not available at the time the
1525 * parser builds the SortGroupClause; instead, consult the exposed collation
1526 * of the referenced targetlist expression to find out what it is.
1527 *
1528 * In a grouping item, eqop must be valid. If the eqop is a btree equality
1529 * operator, then sortop should be set to a compatible ordering operator.
1530 * We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that
1531 * the query presents for the same tlist item. If there is none, we just
1532 * use the default ordering op for the datatype.
1533 *
1534 * If the tlist item's type has a hash opclass but no btree opclass, then
1535 * we will set eqop to the hash equality operator, sortop to InvalidOid,
1536 * and nulls_first to false. A grouping item of this kind can only be
1537 * implemented by hashing, and of course it'll never match an ORDER BY item.
1538 *
1539 * The hashable flag is provided since we generally have the requisite
1540 * information readily available when the SortGroupClause is constructed,
1541 * and it's relatively expensive to get it again later. Note there is no
1542 * need for a "sortable" flag since OidIsValid(sortop) serves the purpose.
1543 *
1544 * A query might have both ORDER BY and DISTINCT (or DISTINCT ON) clauses.
1545 * In SELECT DISTINCT, the distinctClause list is as long or longer than the
1546 * sortClause list, while in SELECT DISTINCT ON it's typically shorter.
1547 * The two lists must match up to the end of the shorter one --- the parser
1548 * rearranges the distinctClause if necessary to make this true. (This
1549 * restriction ensures that only one sort step is needed to both satisfy the
1550 * ORDER BY and set up for the Unique step. This is semantically necessary
1551 * for DISTINCT ON, and presents no real drawback for DISTINCT.)
1552 */
1553typedef struct SortGroupClause
1554{
1556 Index tleSortGroupRef; /* reference into targetlist */
1557 Oid eqop; /* the equality operator ('=' op) */
1558 Oid sortop; /* the ordering operator ('<' op), or 0 */
1559 bool reverse_sort; /* is sortop a "greater than" operator? */
1560 bool nulls_first; /* do NULLs come before normal values? */
1561 /* can eqop be implemented by hashing? */
1564
1565/*
1566 * GroupingSet -
1567 * representation of CUBE, ROLLUP and GROUPING SETS clauses
1568 *
1569 * In a Query with grouping sets, the groupClause contains a flat list of
1570 * SortGroupClause nodes for each distinct expression used. The actual
1571 * structure of the GROUP BY clause is given by the groupingSets tree.
1572 *
1573 * In the raw parser output, GroupingSet nodes (of all types except SIMPLE
1574 * which is not used) are potentially mixed in with the expressions in the
1575 * groupClause of the SelectStmt. (An expression can't contain a GroupingSet,
1576 * but a list may mix GroupingSet and expression nodes.) At this stage, the
1577 * content of each node is a list of expressions, some of which may be RowExprs
1578 * which represent sublists rather than actual row constructors, and nested
1579 * GroupingSet nodes where legal in the grammar. The structure directly
1580 * reflects the query syntax.
1581 *
1582 * In parse analysis, the transformed expressions are used to build the tlist
1583 * and groupClause list (of SortGroupClause nodes), and the groupingSets tree
1584 * is eventually reduced to a fixed format:
1585 *
1586 * EMPTY nodes represent (), and obviously have no content
1587 *
1588 * SIMPLE nodes represent a list of one or more expressions to be treated as an
1589 * atom by the enclosing structure; the content is an integer list of
1590 * ressortgroupref values (see SortGroupClause)
1591 *
1592 * CUBE and ROLLUP nodes contain a list of one or more SIMPLE nodes.
1593 *
1594 * SETS nodes contain a list of EMPTY, SIMPLE, CUBE or ROLLUP nodes, but after
1595 * parse analysis they cannot contain more SETS nodes; enough of the syntactic
1596 * transforms of the spec have been applied that we no longer have arbitrarily
1597 * deep nesting (though we still preserve the use of cube/rollup).
1598 *
1599 * Note that if the groupingSets tree contains no SIMPLE nodes (only EMPTY
1600 * nodes at the leaves), then the groupClause will be empty, but this is still
1601 * an aggregation query (similar to using aggs or HAVING without GROUP BY).
1602 *
1603 * As an example, the following clause:
1604 *
1605 * GROUP BY GROUPING SETS ((a,b), CUBE(c,(d,e)))
1606 *
1607 * looks like this after raw parsing:
1608 *
1609 * SETS( RowExpr(a,b) , CUBE( c, RowExpr(d,e) ) )
1610 *
1611 * and parse analysis converts it to:
1612 *
1613 * SETS( SIMPLE(1,2), CUBE( SIMPLE(3), SIMPLE(4,5) ) )
1614 */
1623
1631
1632/*
1633 * WindowClause -
1634 * transformed representation of WINDOW and OVER clauses
1635 *
1636 * A parsed Query's windowClause list contains these structs. "name" is set
1637 * if the clause originally came from WINDOW, and is NULL if it originally
1638 * was an OVER clause (but note that we collapse out duplicate OVERs).
1639 * partitionClause and orderClause are lists of SortGroupClause structs.
1640 * partitionClause is sanitized by the query planner to remove any columns or
1641 * expressions belonging to redundant PathKeys.
1642 * If we have RANGE with offset PRECEDING/FOLLOWING, the semantics of that are
1643 * specified by startInRangeFunc/inRangeColl/inRangeAsc/inRangeNullsFirst
1644 * for the start offset, or endInRangeFunc/inRange* for the end offset.
1645 * winref is an ID number referenced by WindowFunc nodes; it must be unique
1646 * among the members of a Query's windowClause list.
1647 * When refname isn't null, the partitionClause is always copied from there;
1648 * the orderClause might or might not be copied (see copiedOrder); the framing
1649 * options are never copied, per spec.
1650 *
1651 * The information relevant for the query jumbling is the partition clause
1652 * type and its bounds.
1653 */
1654typedef struct WindowClause
1655{
1657 /* window name (NULL in an OVER clause) */
1659 /* referenced window name, if any */
1661 List *partitionClause; /* PARTITION BY list */
1662 /* ORDER BY list */
1664 int frameOptions; /* frame_clause options, see WindowDef */
1665 Node *startOffset; /* expression for starting bound, if any */
1666 Node *endOffset; /* expression for ending bound, if any */
1667 /* in_range function for startOffset */
1669 /* in_range function for endOffset */
1671 /* collation for in_range tests */
1673 /* use ASC sort order for in_range tests? */
1675 /* nulls sort first for in_range tests? */
1676 bool inRangeNullsFirst pg_node_attr(query_jumble_ignore);
1677 Index winref; /* ID referenced by window functions */
1678 /* did we copy orderClause from refname? */
1681
1682/*
1683 * RowMarkClause -
1684 * parser output representation of FOR [KEY] UPDATE/SHARE clauses
1685 *
1686 * Query.rowMarks contains a separate RowMarkClause node for each relation
1687 * identified as a FOR [KEY] UPDATE/SHARE target. If one of these clauses
1688 * is applied to a subquery, we generate RowMarkClauses for all normal and
1689 * subquery rels in the subquery, but they are marked pushedDown = true to
1690 * distinguish them from clauses that were explicitly written at this query
1691 * level. Also, Query.hasForUpdate tells whether there were explicit FOR
1692 * UPDATE/SHARE/KEY SHARE clauses in the current query level.
1693 */
1694typedef struct RowMarkClause
1695{
1697 Index rti; /* range table index of target relation */
1699 LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
1700 bool pushedDown; /* pushed down from higher query level? */
1702
1703/*
1704 * ForPortionOfClause
1705 * representation of FOR PORTION OF <range-name> FROM <target-start> TO
1706 * <target-end> or FOR PORTION OF <range-name> (<target>)
1707 */
1709{
1711 char *range_name; /* column name of the range/multirange */
1712 ParseLoc location; /* token location, or -1 if unknown */
1713 ParseLoc target_location; /* token location, or -1 if unknown */
1714 Node *target; /* Expr from FOR PORTION OF col (...) syntax */
1715 Node *target_start; /* Expr from FROM ... TO ... syntax */
1716 Node *target_end; /* Expr from FROM ... TO ... syntax */
1718
1719/*
1720 * WithClause -
1721 * representation of WITH clause
1722 *
1723 * Note: WithClause does not propagate into the Query representation;
1724 * but CommonTableExpr does.
1725 */
1726typedef struct WithClause
1727{
1729 List *ctes; /* list of CommonTableExprs */
1730 bool recursive; /* true = WITH RECURSIVE */
1731 ParseLoc location; /* token location, or -1 if unknown */
1733
1734/*
1735 * InferClause -
1736 * ON CONFLICT unique index inference clause
1737 *
1738 * Note: InferClause does not propagate into the Query representation.
1739 */
1740typedef struct InferClause
1741{
1743 List *indexElems; /* IndexElems to infer unique index */
1744 Node *whereClause; /* qualification (partial-index predicate) */
1745 char *conname; /* Constraint name, or NULL if unnamed */
1746 ParseLoc location; /* token location, or -1 if unknown */
1748
1749/*
1750 * OnConflictClause -
1751 * representation of ON CONFLICT clause
1752 *
1753 * Note: OnConflictClause does not propagate into the Query representation.
1754 */
1755typedef struct OnConflictClause
1756{
1758 OnConflictAction action; /* DO NOTHING, SELECT, or UPDATE */
1759 InferClause *infer; /* Optional index inference clause */
1760 LockClauseStrength lockStrength; /* lock strength for DO SELECT */
1761 List *targetList; /* target list (of ResTarget) for DO UPDATE */
1762 Node *whereClause; /* qualifications */
1763 ParseLoc location; /* token location, or -1 if unknown */
1765
1766/*
1767 * CommonTableExpr -
1768 * representation of WITH list element
1769 */
1770
1771typedef enum CTEMaterialize
1772{
1773 CTEMaterializeDefault, /* no option specified */
1774 CTEMaterializeAlways, /* MATERIALIZED */
1775 CTEMaterializeNever, /* NOT MATERIALIZED */
1777
1786
1787typedef struct CTECycleClause
1788{
1796 /* These fields are set during parse analysis: */
1797 Oid cycle_mark_type; /* common type of _value and _default */
1800 Oid cycle_mark_neop; /* <> operator for type */
1802
1803typedef struct CommonTableExpr
1804{
1806
1807 /*
1808 * Query name (never qualified). The string name is included in the query
1809 * jumbling because RTE_CTE RTEs need it.
1810 */
1811 char *ctename;
1812 /* optional list of column names */
1814 CTEMaterialize ctematerialized; /* is this an optimization fence? */
1815 /* SelectStmt/InsertStmt/etc before parse analysis, Query afterwards: */
1816 Node *ctequery; /* the CTE's subquery */
1819 ParseLoc location; /* token location, or -1 if unknown */
1820 /* These fields are set during parse analysis: */
1821 /* is this CTE actually recursive? */
1823
1824 /*
1825 * Number of RTEs referencing this CTE (excluding internal
1826 * self-references), irrelevant for query jumbling.
1827 */
1829 /* list of output column names */
1831 /* OID list of output column type OIDs */
1833 /* integer list of output column typmods */
1835 /* OID list of column collation OIDs */
1838
1839/* Convenience macro to get the output tlist of a CTE's query */
1840#define GetCTETargetList(cte) \
1841 (AssertMacro(IsA((cte)->ctequery, Query)), \
1842 ((Query *) (cte)->ctequery)->commandType == CMD_SELECT ? \
1843 ((Query *) (cte)->ctequery)->targetList : \
1844 ((Query *) (cte)->ctequery)->returningList)
1845
1846/*
1847 * MergeWhenClause -
1848 * raw parser representation of a WHEN clause in a MERGE statement
1849 *
1850 * This is transformed into MergeAction by parse analysis
1851 */
1852typedef struct MergeWhenClause
1853{
1855 MergeMatchKind matchKind; /* MATCHED/NOT MATCHED BY SOURCE/TARGET */
1856 CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
1857 OverridingKind override; /* OVERRIDING clause */
1858 Node *condition; /* WHEN conditions (raw parser) */
1859 List *targetList; /* INSERT/UPDATE targetlist */
1860 /* the following members are only used in INSERT actions */
1861 List *values; /* VALUES to INSERT, or NULL */
1863
1864/*
1865 * ReturningOptionKind -
1866 * Possible kinds of option in RETURNING WITH(...) list
1867 *
1868 * Currently, this is used only for specifying OLD/NEW aliases.
1869 */
1871{
1872 RETURNING_OPTION_OLD, /* specify alias for OLD in RETURNING */
1873 RETURNING_OPTION_NEW, /* specify alias for NEW in RETURNING */
1875
1876/*
1877 * ReturningOption -
1878 * An individual option in the RETURNING WITH(...) list
1879 */
1880typedef struct ReturningOption
1881{
1883 ReturningOptionKind option; /* specified option */
1884 char *value; /* option's value */
1885 ParseLoc location; /* token location, or -1 if unknown */
1887
1888/*
1889 * ReturningClause -
1890 * List of RETURNING expressions, together with any WITH(...) options
1891 */
1892typedef struct ReturningClause
1893{
1895 List *options; /* list of ReturningOption elements */
1896 List *exprs; /* list of expressions to return */
1898
1899/*
1900 * TriggerTransition -
1901 * representation of transition row or table naming clause
1902 *
1903 * Only transition tables are initially supported in the syntax, and only for
1904 * AFTER triggers, but other permutations are accepted by the parser so we can
1905 * give a meaningful message from C code.
1906 */
1914
1915/* Nodes for SQL/JSON support */
1916
1917/*
1918 * JsonOutput -
1919 * representation of JSON output clause (RETURNING type [FORMAT format])
1920 */
1921typedef struct JsonOutput
1922{
1924 TypeName *typeName; /* RETURNING type name, if specified */
1925 JsonReturning *returning; /* RETURNING FORMAT clause and type Oids */
1927
1928/*
1929 * JsonArgument -
1930 * representation of argument from JSON PASSING clause
1931 */
1932typedef struct JsonArgument
1933{
1935 JsonValueExpr *val; /* argument value expression */
1936 char *name; /* argument name */
1938
1939/*
1940 * JsonQuotes -
1941 * representation of [KEEP|OMIT] QUOTES clause for JSON_QUERY()
1942 */
1943typedef enum JsonQuotes
1944{
1945 JS_QUOTES_UNSPEC, /* unspecified */
1946 JS_QUOTES_KEEP, /* KEEP QUOTES */
1947 JS_QUOTES_OMIT, /* OMIT QUOTES */
1949
1950/*
1951 * JsonFuncExpr -
1952 * untransformed representation of function expressions for
1953 * SQL/JSON query functions
1954 */
1955typedef struct JsonFuncExpr
1956{
1958 JsonExprOp op; /* expression type */
1959 char *column_name; /* JSON_TABLE() column name or NULL if this is
1960 * not for a JSON_TABLE() */
1961 JsonValueExpr *context_item; /* context item expression */
1962 Node *pathspec; /* JSON path specification expression */
1963 List *passing; /* list of PASSING clause arguments, if any */
1964 JsonOutput *output; /* output clause, if specified */
1965 JsonBehavior *on_empty; /* ON EMPTY behavior */
1966 JsonBehavior *on_error; /* ON ERROR behavior */
1967 JsonWrapper wrapper; /* array wrapper behavior (JSON_QUERY only) */
1968 JsonQuotes quotes; /* omit or keep quotes? (JSON_QUERY only) */
1969 ParseLoc location; /* token location, or -1 if unknown */
1971
1972/*
1973 * JsonTablePathSpec
1974 * untransformed specification of JSON path expression with an optional
1975 * name
1976 */
1986
1987/*
1988 * JsonTable -
1989 * untransformed representation of JSON_TABLE
1990 */
1991typedef struct JsonTable
1992{
1994 JsonValueExpr *context_item; /* context item expression */
1995 JsonTablePathSpec *pathspec; /* JSON path specification */
1996 List *passing; /* list of PASSING clause arguments, if any */
1997 List *columns; /* list of JsonTableColumn */
1998 JsonBehavior *on_error; /* ON ERROR behavior */
1999 Alias *alias; /* table alias in FROM clause */
2000 bool lateral; /* does it have LATERAL prefix? */
2001 ParseLoc location; /* token location, or -1 if unknown */
2003
2004/*
2005 * JsonTableColumnType -
2006 * enumeration of JSON_TABLE column types
2007 */
2016
2017/*
2018 * JsonTableColumn -
2019 * untransformed representation of JSON_TABLE column
2020 */
2021typedef struct JsonTableColumn
2022{
2024 JsonTableColumnType coltype; /* column type */
2025 char *name; /* column name */
2026 TypeName *typeName; /* column type name */
2027 JsonTablePathSpec *pathspec; /* JSON path specification */
2028 JsonFormat *format; /* JSON format clause, if specified */
2029 JsonWrapper wrapper; /* WRAPPER behavior for formatted columns */
2030 JsonQuotes quotes; /* omit or keep quotes on scalar strings? */
2031 List *columns; /* nested columns */
2032 JsonBehavior *on_empty; /* ON EMPTY behavior */
2033 JsonBehavior *on_error; /* ON ERROR behavior */
2034 ParseLoc location; /* token location, or -1 if unknown */
2036
2037/*
2038 * JsonKeyValue -
2039 * untransformed representation of JSON object key-value pair for
2040 * JSON_OBJECT() and JSON_OBJECTAGG()
2041 */
2042typedef struct JsonKeyValue
2043{
2045 Expr *key; /* key expression */
2046 JsonValueExpr *value; /* JSON value expression */
2048
2049/*
2050 * JsonParseExpr -
2051 * untransformed representation of JSON()
2052 */
2053typedef struct JsonParseExpr
2054{
2056 JsonValueExpr *expr; /* string expression */
2057 JsonOutput *output; /* RETURNING clause, if specified */
2058 bool unique_keys; /* WITH UNIQUE KEYS? */
2059 ParseLoc location; /* token location, or -1 if unknown */
2061
2062/*
2063 * JsonScalarExpr -
2064 * untransformed representation of JSON_SCALAR()
2065 */
2066typedef struct JsonScalarExpr
2067{
2069 Expr *expr; /* scalar expression */
2070 JsonOutput *output; /* RETURNING clause, if specified */
2071 ParseLoc location; /* token location, or -1 if unknown */
2073
2074/*
2075 * JsonSerializeExpr -
2076 * untransformed representation of JSON_SERIALIZE() function
2077 */
2078typedef struct JsonSerializeExpr
2079{
2081 JsonValueExpr *expr; /* json value expression */
2082 JsonOutput *output; /* RETURNING clause, if specified */
2083 ParseLoc location; /* token location, or -1 if unknown */
2085
2086/*
2087 * JsonObjectConstructor -
2088 * untransformed representation of JSON_OBJECT() constructor
2089 */
2091{
2093 List *exprs; /* list of JsonKeyValue pairs */
2094 JsonOutput *output; /* RETURNING clause, if specified */
2095 bool absent_on_null; /* skip NULL values? */
2096 bool unique; /* check key uniqueness? */
2097 ParseLoc location; /* token location, or -1 if unknown */
2099
2100/*
2101 * JsonArrayConstructor -
2102 * untransformed representation of JSON_ARRAY(element,...) constructor
2103 */
2105{
2107 List *exprs; /* list of JsonValueExpr elements */
2108 JsonOutput *output; /* RETURNING clause, if specified */
2109 bool absent_on_null; /* skip NULL elements? */
2110 ParseLoc location; /* token location, or -1 if unknown */
2112
2113/*
2114 * JsonArrayQueryConstructor -
2115 * untransformed representation of JSON_ARRAY(subquery) constructor
2116 */
2118{
2120 Node *query; /* subquery */
2121 JsonOutput *output; /* RETURNING clause, if specified */
2122 JsonFormat *format; /* FORMAT clause for subquery, if specified */
2123 bool absent_on_null; /* skip NULL elements? */
2124 ParseLoc location; /* token location, or -1 if unknown */
2126
2127/*
2128 * JsonAggConstructor -
2129 * common fields of untransformed representation of
2130 * JSON_ARRAYAGG() and JSON_OBJECTAGG()
2131 */
2133{
2135 JsonOutput *output; /* RETURNING clause, if any */
2136 Node *agg_filter; /* FILTER clause, if any */
2137 List *agg_order; /* ORDER BY clause, if any */
2138 struct WindowDef *over; /* OVER clause, if any */
2139 ParseLoc location; /* token location, or -1 if unknown */
2141
2142/*
2143 * JsonObjectAgg -
2144 * untransformed representation of JSON_OBJECTAGG()
2145 */
2146typedef struct JsonObjectAgg
2147{
2149 JsonAggConstructor *constructor; /* common fields */
2150 JsonKeyValue *arg; /* object key-value pair */
2151 bool absent_on_null; /* skip NULL values? */
2152 bool unique; /* check key uniqueness? */
2154
2155/*
2156 * JsonArrayAgg -
2157 * untransformed representation of JSON_ARRAYAGG()
2158 */
2159typedef struct JsonArrayAgg
2160{
2162 JsonAggConstructor *constructor; /* common fields */
2163 JsonValueExpr *arg; /* array element expression */
2164 bool absent_on_null; /* skip NULL elements? */
2166
2167
2168/*****************************************************************************
2169 * Raw Grammar Output Statements
2170 *****************************************************************************/
2171
2172/*
2173 * RawStmt --- container for any one statement's raw parse tree
2174 *
2175 * Parse analysis converts a raw parse tree headed by a RawStmt node into
2176 * an analyzed statement headed by a Query node. For optimizable statements,
2177 * the conversion is complex. For utility statements, the parser usually just
2178 * transfers the raw parse tree (sans RawStmt) into the utilityStmt field of
2179 * the Query node, and all the useful work happens at execution time.
2180 *
2181 * stmt_location/stmt_len identify the portion of the source text string
2182 * containing this raw statement (useful for multi-statement strings).
2183 *
2184 * This is irrelevant for query jumbling, as this is not used in parsed
2185 * queries.
2186 */
2187typedef struct RawStmt
2188{
2190
2191 NodeTag type;
2192 Node *stmt; /* raw parse tree */
2193 ParseLoc stmt_location; /* start location, or -1 if unknown */
2194 ParseLoc stmt_len; /* length in bytes; 0 means "rest of string" */
2196
2197/*****************************************************************************
2198 * Optimizable Statements
2199 *****************************************************************************/
2200
2201/* ----------------------
2202 * Insert Statement
2203 *
2204 * The source expression is represented by SelectStmt for both the
2205 * SELECT and VALUES cases. If selectStmt is NULL, then the query
2206 * is INSERT ... DEFAULT VALUES.
2207 * ----------------------
2208 */
2209typedef struct InsertStmt
2210{
2212 RangeVar *relation; /* relation to insert into */
2213 List *cols; /* optional: names of the target columns */
2214 Node *selectStmt; /* the source SELECT/VALUES, or NULL */
2215 OnConflictClause *onConflictClause; /* ON CONFLICT clause */
2216 ReturningClause *returningClause; /* RETURNING clause */
2217 WithClause *withClause; /* WITH clause */
2218 OverridingKind override; /* OVERRIDING clause */
2220
2221/* ----------------------
2222 * Delete Statement
2223 * ----------------------
2224 */
2225typedef struct DeleteStmt
2226{
2228 RangeVar *relation; /* relation to delete from */
2229 List *usingClause; /* optional using clause for more tables */
2230 Node *whereClause; /* qualifications */
2231 ReturningClause *returningClause; /* RETURNING clause */
2232 WithClause *withClause; /* WITH clause */
2233 ForPortionOfClause *forPortionOf; /* FOR PORTION OF clause */
2235
2236/* ----------------------
2237 * Update Statement
2238 * ----------------------
2239 */
2240typedef struct UpdateStmt
2241{
2243 RangeVar *relation; /* relation to update */
2244 List *targetList; /* the target list (of ResTarget) */
2245 Node *whereClause; /* qualifications */
2246 List *fromClause; /* optional from clause for more tables */
2247 ReturningClause *returningClause; /* RETURNING clause */
2248 WithClause *withClause; /* WITH clause */
2249 ForPortionOfClause *forPortionOf; /* FOR PORTION OF clause */
2251
2252/* ----------------------
2253 * Merge Statement
2254 * ----------------------
2255 */
2256typedef struct MergeStmt
2257{
2259 RangeVar *relation; /* target relation to merge into */
2260 Node *sourceRelation; /* source relation */
2261 Node *joinCondition; /* join condition between source and target */
2262 List *mergeWhenClauses; /* list of MergeWhenClause(es) */
2263 ReturningClause *returningClause; /* RETURNING clause */
2264 WithClause *withClause; /* WITH clause */
2266
2267/* ----------------------
2268 * Select Statement
2269 *
2270 * A "simple" SELECT is represented in the output of gram.y by a single
2271 * SelectStmt node; so is a VALUES construct. A query containing set
2272 * operators (UNION, INTERSECT, EXCEPT) is represented by a tree of SelectStmt
2273 * nodes, in which the leaf nodes are component SELECTs and the internal nodes
2274 * represent UNION, INTERSECT, or EXCEPT operators. Using the same node
2275 * type for both leaf and internal nodes allows gram.y to stick ORDER BY,
2276 * LIMIT, etc, clause values into a SELECT statement without worrying
2277 * whether it is a simple or compound SELECT.
2278 * ----------------------
2279 */
2287
2288typedef struct SelectStmt
2289{
2291
2292 /*
2293 * These fields are used only in "leaf" SelectStmts.
2294 */
2295 List *distinctClause; /* NULL, list of DISTINCT ON exprs, or
2296 * lcons(NIL,NIL) for all (SELECT DISTINCT) */
2297 IntoClause *intoClause; /* target for SELECT INTO */
2298 List *targetList; /* the target list (of ResTarget) */
2299 List *fromClause; /* the FROM clause */
2300 Node *whereClause; /* WHERE qualification */
2301 List *groupClause; /* GROUP BY clauses */
2302 bool groupDistinct; /* Is this GROUP BY DISTINCT? */
2303 bool groupByAll; /* Is this GROUP BY ALL? */
2304 Node *havingClause; /* HAVING conditional-expression */
2305 List *windowClause; /* WINDOW window_name AS (...), ... */
2306
2307 /*
2308 * In a "leaf" node representing a VALUES list, the above fields are all
2309 * null, and instead this field is set. Note that the elements of the
2310 * sublists are just expressions, without ResTarget decoration. Also note
2311 * that a list element can be DEFAULT (represented as a SetToDefault
2312 * node), regardless of the context of the VALUES list. It's up to parse
2313 * analysis to reject that where not valid.
2314 */
2315 List *valuesLists; /* untransformed list of expression lists */
2316
2317 /*
2318 * These fields are used in both "leaf" SelectStmts and upper-level
2319 * SelectStmts.
2320 */
2321 List *sortClause; /* sort clause (a list of SortBy's) */
2322 Node *limitOffset; /* # of result tuples to skip */
2323 Node *limitCount; /* # of result tuples to return */
2324 LimitOption limitOption; /* limit type */
2325 List *lockingClause; /* FOR UPDATE (list of LockingClause's) */
2326 WithClause *withClause; /* WITH clause */
2327
2328 /*
2329 * These fields are used only in upper-level SelectStmts.
2330 */
2331 SetOperation op; /* type of set op */
2332 bool all; /* ALL specified? */
2333 struct SelectStmt *larg; /* left child */
2334 struct SelectStmt *rarg; /* right child */
2335 /* Eventually add fields for CORRESPONDING spec here */
2337
2338
2339/* ----------------------
2340 * Set Operation node for post-analysis query trees
2341 *
2342 * After parse analysis, a SELECT with set operations is represented by a
2343 * top-level Query node containing the leaf SELECTs as subqueries in its
2344 * range table. Its setOperations field shows the tree of set operations,
2345 * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal
2346 * nodes replaced by SetOperationStmt nodes. Information about the output
2347 * column types is added, too. (Note that the child nodes do not necessarily
2348 * produce these types directly, but we've checked that their output types
2349 * can be coerced to the output column type.) Also, if it's not UNION ALL,
2350 * information about the types' sort/group semantics is provided in the form
2351 * of a SortGroupClause list (same representation as, eg, DISTINCT).
2352 * The resolved common column collations are provided too; but note that if
2353 * it's not UNION ALL, it's okay for a column to not have a common collation,
2354 * so a member of the colCollations list could be InvalidOid even though the
2355 * column has a collatable type.
2356 * ----------------------
2357 */
2358typedef struct SetOperationStmt
2359{
2361 SetOperation op; /* type of set op */
2362 bool all; /* ALL specified? */
2363 Node *larg; /* left child */
2364 Node *rarg; /* right child */
2365 /* Eventually add fields for CORRESPONDING spec here */
2366
2367 /* Fields derived during parse analysis (irrelevant for query jumbling): */
2368 /* OID list of output column type OIDs */
2370 /* integer list of output column typmods */
2372 /* OID list of output column collation OIDs */
2374 /* a list of SortGroupClause's */
2376 /* groupClauses is NIL if UNION ALL, but must be set otherwise */
2378
2379
2380/*
2381 * RETURN statement (inside SQL function body)
2382 */
2388
2389
2390/* ----------------------
2391 * PL/pgSQL Assignment Statement
2392 *
2393 * Like SelectStmt, this is transformed into a SELECT Query.
2394 * However, the targetlist of the result looks more like an UPDATE.
2395 * ----------------------
2396 */
2397typedef struct PLAssignStmt
2398{
2400
2401 char *name; /* initial column name */
2402 List *indirection; /* subscripts and field names, if any */
2403 int nnames; /* number of names to use in ColumnRef */
2404 SelectStmt *val; /* the PL/pgSQL expression to assign */
2405 ParseLoc location; /* name's token location, or -1 if unknown */
2407
2408
2409/*****************************************************************************
2410 * Other Statements (no optimizations required)
2411 *
2412 * These are not touched by parser/analyze.c except to put them into
2413 * the utilityStmt field of a Query. This is eventually passed to
2414 * ProcessUtility (by-passing rewriting and planning). Some of the
2415 * statements do need attention from parse analysis, and this is
2416 * done by routines in parser/parse_utilcmd.c after ProcessUtility
2417 * receives the command for execution.
2418 * DECLARE CURSOR, EXPLAIN, and CREATE TABLE AS are special cases:
2419 * they contain optimizable statements, which get processed normally
2420 * by parser/analyze.c.
2421 *****************************************************************************/
2422
2423/*
2424 * When a command can act on several kinds of objects with only one
2425 * parse structure required, use these constants to designate the
2426 * object type. Note that commands typically don't support all the types.
2427 */
2428
2485
2486/* ----------------------
2487 * Create Schema Statement
2488 *
2489 * NOTE: the schemaElts list contains raw parsetrees for component statements
2490 * of the schema, such as CREATE TABLE, GRANT, etc. These are analyzed and
2491 * executed after the schema itself is created.
2492 * ----------------------
2493 */
2494typedef struct CreateSchemaStmt
2495{
2497 char *schemaname; /* the name of the schema to create */
2498 RoleSpec *authrole; /* the owner of the created schema */
2499 List *schemaElts; /* schema components (list of parsenodes) */
2500 bool if_not_exists; /* just do nothing if schema already exists? */
2502
2503typedef enum DropBehavior
2504{
2505 DROP_RESTRICT, /* drop fails if any dependent objects */
2506 DROP_CASCADE, /* remove dependent objects too */
2508
2509/* ----------------------
2510 * Alter Table
2511 * ----------------------
2512 */
2513typedef struct AlterTableStmt
2514{
2516 RangeVar *relation; /* table to work on */
2517 List *cmds; /* list of subcommands */
2518 ObjectType objtype; /* type of object */
2519 bool missing_ok; /* skip error if table missing */
2521
2522typedef enum AlterTableType
2523{
2524 AT_AddColumn, /* add column */
2525 AT_AddColumnToView, /* implicitly via CREATE OR REPLACE VIEW */
2526 AT_ColumnDefault, /* alter column default */
2527 AT_CookedColumnDefault, /* add a pre-cooked column default */
2528 AT_DropNotNull, /* alter column drop not null */
2529 AT_SetNotNull, /* alter column set not null */
2530 AT_SetExpression, /* alter column set expression */
2531 AT_DropExpression, /* alter column drop expression */
2532 AT_SetStatistics, /* alter column set statistics */
2533 AT_SetOptions, /* alter column set ( options ) */
2534 AT_ResetOptions, /* alter column reset ( options ) */
2535 AT_SetStorage, /* alter column set storage */
2536 AT_SetCompression, /* alter column set compression */
2537 AT_DropColumn, /* drop column */
2538 AT_AddIndex, /* add index */
2539 AT_ReAddIndex, /* internal to commands/tablecmds.c */
2540 AT_AddConstraint, /* add constraint */
2541 AT_ReAddConstraint, /* internal to commands/tablecmds.c */
2542 AT_ReAddDomainConstraint, /* internal to commands/tablecmds.c */
2543 AT_AlterConstraint, /* alter constraint */
2544 AT_ValidateConstraint, /* validate constraint */
2545 AT_AddIndexConstraint, /* add constraint using existing index */
2546 AT_DropConstraint, /* drop constraint */
2547 AT_ReAddComment, /* internal to commands/tablecmds.c */
2548 AT_AlterColumnType, /* alter column type */
2549 AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */
2550 AT_ChangeOwner, /* change owner */
2551 AT_ClusterOn, /* CLUSTER ON */
2552 AT_DropCluster, /* SET WITHOUT CLUSTER */
2553 AT_SetLogged, /* SET LOGGED */
2554 AT_SetUnLogged, /* SET UNLOGGED */
2555 AT_DropOids, /* SET WITHOUT OIDS */
2556 AT_SetAccessMethod, /* SET ACCESS METHOD */
2557 AT_SetTableSpace, /* SET TABLESPACE */
2558 AT_SetRelOptions, /* SET (...) -- AM specific parameters */
2559 AT_ResetRelOptions, /* RESET (...) -- AM specific parameters */
2560 AT_ReplaceRelOptions, /* replace reloption list in its entirety */
2561 AT_EnableTrig, /* ENABLE TRIGGER name */
2562 AT_EnableAlwaysTrig, /* ENABLE ALWAYS TRIGGER name */
2563 AT_EnableReplicaTrig, /* ENABLE REPLICA TRIGGER name */
2564 AT_DisableTrig, /* DISABLE TRIGGER name */
2565 AT_EnableTrigAll, /* ENABLE TRIGGER ALL */
2566 AT_DisableTrigAll, /* DISABLE TRIGGER ALL */
2567 AT_EnableTrigUser, /* ENABLE TRIGGER USER */
2568 AT_DisableTrigUser, /* DISABLE TRIGGER USER */
2569 AT_EnableRule, /* ENABLE RULE name */
2570 AT_EnableAlwaysRule, /* ENABLE ALWAYS RULE name */
2571 AT_EnableReplicaRule, /* ENABLE REPLICA RULE name */
2572 AT_DisableRule, /* DISABLE RULE name */
2573 AT_AddInherit, /* INHERIT parent */
2574 AT_DropInherit, /* NO INHERIT parent */
2575 AT_AddOf, /* OF <type_name> */
2576 AT_DropOf, /* NOT OF */
2577 AT_ReplicaIdentity, /* REPLICA IDENTITY */
2578 AT_EnableRowSecurity, /* ENABLE ROW SECURITY */
2579 AT_DisableRowSecurity, /* DISABLE ROW SECURITY */
2580 AT_ForceRowSecurity, /* FORCE ROW SECURITY */
2581 AT_NoForceRowSecurity, /* NO FORCE ROW SECURITY */
2582 AT_GenericOptions, /* OPTIONS (...) */
2583 AT_AttachPartition, /* ATTACH PARTITION */
2584 AT_DetachPartition, /* DETACH PARTITION */
2585 AT_DetachPartitionFinalize, /* DETACH PARTITION FINALIZE */
2586 AT_SplitPartition, /* SPLIT PARTITION */
2587 AT_MergePartitions, /* MERGE PARTITIONS */
2588 AT_AddIdentity, /* ADD IDENTITY */
2589 AT_SetIdentity, /* SET identity column options */
2590 AT_DropIdentity, /* DROP IDENTITY */
2591 AT_ReAddStatistics, /* internal to commands/tablecmds.c */
2593
2594typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
2595{
2597 AlterTableType subtype; /* Type of table alteration to apply */
2598 char *name; /* column, constraint, or trigger to act on,
2599 * or tablespace, access method */
2600 int16 num; /* attribute number for columns referenced by
2601 * number */
2603 Node *def; /* definition of new column, index,
2604 * constraint, or parent table */
2605 DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
2606 bool missing_ok; /* skip error if missing? */
2607 bool recurse; /* exec-time recursion */
2609
2610/* Ad-hoc node for AT_AlterConstraint */
2611typedef struct ATAlterConstraint
2612{
2614 char *conname; /* Constraint name */
2615 bool alterEnforceability; /* changing enforceability properties? */
2616 bool is_enforced; /* ENFORCED? */
2617 bool alterDeferrability; /* changing deferrability properties? */
2618 bool deferrable; /* DEFERRABLE? */
2619 bool initdeferred; /* INITIALLY DEFERRED? */
2620 bool alterInheritability; /* changing inheritability properties */
2623
2624/* Ad-hoc node for AT_ReplicaIdentity */
2631
2632
2633/* ----------------------
2634 * Alter Collation
2635 * ----------------------
2636 */
2642
2643
2644/* ----------------------
2645 * Alter Domain
2646 *
2647 * The fields are used in different ways by the different variants of
2648 * this command.
2649 * ----------------------
2650 */
2652{
2653 AD_AlterDefault = 'T', /* SET|DROP DEFAULT */
2654 AD_DropNotNull = 'N', /* DROP NOT NULL */
2655 AD_SetNotNull = 'O', /* SET NOT NULL */
2656 AD_AddConstraint = 'C', /* ADD CONSTRAINT */
2657 AD_DropConstraint = 'X', /* DROP CONSTRAINT */
2658 AD_ValidateConstraint = 'V', /* VALIDATE CONSTRAINT */
2660
2661typedef struct AlterDomainStmt
2662{
2664 AlterDomainType subtype; /* subtype of command */
2665 List *typeName; /* domain to work on */
2666 char *name; /* column or constraint name to act on */
2667 Node *def; /* definition of default or constraint */
2668 DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
2669 bool missing_ok; /* skip error if missing? */
2671
2672
2673/* ----------------------
2674 * Grant|Revoke Statement
2675 * ----------------------
2676 */
2678{
2679 ACL_TARGET_OBJECT, /* grant on specific named object(s) */
2680 ACL_TARGET_ALL_IN_SCHEMA, /* grant on all objects in given schema(s) */
2681 ACL_TARGET_DEFAULTS, /* ALTER DEFAULT PRIVILEGES */
2683
2684typedef struct GrantStmt
2685{
2687 bool is_grant; /* true = GRANT, false = REVOKE */
2688 GrantTargetType targtype; /* type of the grant target */
2689 ObjectType objtype; /* kind of object being operated on */
2690 List *objects; /* list of RangeVar nodes, ObjectWithArgs
2691 * nodes, or plain names (as String values) */
2692 List *privileges; /* list of AccessPriv nodes */
2693 /* privileges == NIL denotes ALL PRIVILEGES */
2694 List *grantees; /* list of RoleSpec nodes */
2695 bool grant_option; /* grant or revoke grant option */
2696 RoleSpec *grantor; /* GRANTED BY clause, or NULL if none */
2697 DropBehavior behavior; /* drop behavior (for REVOKE) */
2699
2700/*
2701 * ObjectWithArgs represents a function/procedure/operator name plus parameter
2702 * identification.
2703 *
2704 * objargs includes only the types of the input parameters of the object.
2705 * In some contexts, that will be all we have, and it's enough to look up
2706 * objects according to the traditional Postgres rules (i.e., when only input
2707 * arguments matter).
2708 *
2709 * objfuncargs, if not NIL, carries the full specification of the parameter
2710 * list, including parameter mode annotations.
2711 *
2712 * Some grammar productions can set args_unspecified = true instead of
2713 * providing parameter info. In this case, lookup will succeed only if
2714 * the object name is unique. Note that otherwise, NIL parameter lists
2715 * mean zero arguments.
2716 */
2717typedef struct ObjectWithArgs
2718{
2720 List *objname; /* qualified name of function/operator */
2721 List *objargs; /* list of Typename nodes (input args only) */
2722 List *objfuncargs; /* list of FunctionParameter nodes */
2723 bool args_unspecified; /* argument list was omitted? */
2725
2726/*
2727 * An access privilege, with optional list of column names
2728 * priv_name == NULL denotes ALL PRIVILEGES (only used with a column list)
2729 * cols == NIL denotes "all columns"
2730 * Note that simple "ALL PRIVILEGES" is represented as a NIL list, not
2731 * an AccessPriv with both fields null.
2732 */
2733typedef struct AccessPriv
2734{
2736 char *priv_name; /* string name of privilege */
2737 List *cols; /* list of String */
2739
2740/* ----------------------
2741 * Grant/Revoke Role Statement
2742 *
2743 * Note: because of the parsing ambiguity with the GRANT <privileges>
2744 * statement, granted_roles is a list of AccessPriv; the execution code
2745 * should complain if any column lists appear. grantee_roles is a list
2746 * of role names, as RoleSpec values.
2747 * ----------------------
2748 */
2749typedef struct GrantRoleStmt
2750{
2752 List *granted_roles; /* list of roles to be granted/revoked */
2753 List *grantee_roles; /* list of member roles to add/delete */
2754 bool is_grant; /* true = GRANT, false = REVOKE */
2755 List *opt; /* options e.g. WITH GRANT OPTION */
2756 RoleSpec *grantor; /* set grantor to other than current role */
2757 DropBehavior behavior; /* drop behavior (for REVOKE) */
2759
2760/* ----------------------
2761 * Alter Default Privileges Statement
2762 * ----------------------
2763 */
2765{
2767 List *options; /* list of DefElem */
2768 GrantStmt *action; /* GRANT/REVOKE action (with objects=NIL) */
2770
2771/* ----------------------
2772 * Copy Statement
2773 *
2774 * We support "COPY relation FROM file", "COPY relation TO file", and
2775 * "COPY (query) TO file". In any given CopyStmt, exactly one of "relation"
2776 * and "query" must be non-NULL.
2777 * ----------------------
2778 */
2779typedef struct CopyStmt
2780{
2782 RangeVar *relation; /* the relation to copy */
2783 Node *query; /* the query (SELECT or DML statement with
2784 * RETURNING) to copy, as a raw parse tree */
2785 List *attlist; /* List of column names (as Strings), or NIL
2786 * for all columns */
2787 bool is_from; /* TO or FROM */
2788 bool is_program; /* is 'filename' a program to popen? */
2789 char *filename; /* filename, or NULL for STDIN/STDOUT */
2790 List *options; /* List of DefElem nodes */
2791 Node *whereClause; /* WHERE condition (or NULL) */
2793
2794/* ----------------------
2795 * SET Statement (includes RESET)
2796 *
2797 * "SET var TO DEFAULT" and "RESET var" are semantically equivalent, but we
2798 * preserve the distinction in VariableSetKind for CreateCommandTag().
2799 * ----------------------
2800 */
2802{
2803 VAR_SET_VALUE, /* SET var = value */
2804 VAR_SET_DEFAULT, /* SET var TO DEFAULT */
2805 VAR_SET_CURRENT, /* SET var FROM CURRENT */
2806 VAR_SET_MULTI, /* special case for SET TRANSACTION ... */
2807 VAR_RESET, /* RESET var */
2808 VAR_RESET_ALL, /* RESET ALL */
2810
2811typedef struct VariableSetStmt
2812{
2814
2815 NodeTag type;
2817 /* variable to be set */
2818 char *name;
2819 /* List of A_Const nodes */
2821
2822 /*
2823 * True if arguments should be accounted for in query jumbling. We use a
2824 * separate flag rather than query_jumble_ignore on "args" as several
2825 * grammar flavors of SET rely on a list of values that are parsed
2826 * directly from the grammar's keywords.
2827 */
2829 /* SET LOCAL? */
2831 /* token location, or -1 if unknown */
2834
2835/* ----------------------
2836 * Show Statement
2837 * ----------------------
2838 */
2844
2845/* ----------------------
2846 * Create Table Statement
2847 *
2848 * NOTE: in the raw gram.y output, ColumnDef and Constraint nodes are
2849 * intermixed in tableElts, and constraints and nnconstraints are NIL. After
2850 * parse analysis, tableElts contains just ColumnDefs, nnconstraints contains
2851 * Constraint nodes of CONSTR_NOTNULL type from various sources, and
2852 * constraints contains just CONSTR_CHECK Constraint nodes.
2853 * ----------------------
2854 */
2855
2856typedef struct CreateStmt
2857{
2859 RangeVar *relation; /* relation to create */
2860 List *tableElts; /* column definitions (list of ColumnDef) */
2861 List *inhRelations; /* relations to inherit from (list of
2862 * RangeVar) */
2863 PartitionBoundSpec *partbound; /* FOR VALUES clause */
2864 PartitionSpec *partspec; /* PARTITION BY clause */
2865 TypeName *ofTypename; /* OF typename */
2866 List *constraints; /* constraints (list of Constraint nodes) */
2867 List *nnconstraints; /* NOT NULL constraints (ditto) */
2868 List *options; /* options from WITH clause */
2869 OnCommitAction oncommit; /* what do we do at COMMIT? */
2870 char *tablespacename; /* table space to use, or NULL */
2871 char *accessMethod; /* table access method */
2872 bool if_not_exists; /* just do nothing if it already exists? */
2874
2875/* ----------
2876 * Definitions for constraints in CreateStmt
2877 *
2878 * Note that column defaults are treated as a type of constraint,
2879 * even though that's a bit odd semantically.
2880 *
2881 * For constraints that use expressions (CONSTR_CHECK, CONSTR_DEFAULT)
2882 * we may have the expression in either "raw" form (an untransformed
2883 * parse tree) or "cooked" form (the nodeToString representation of
2884 * an executable expression tree), depending on how this Constraint
2885 * node was created (by parsing, or by inheritance from an existing
2886 * relation). We should never have both in the same node!
2887 *
2888 * FKCONSTR_ACTION_xxx values are stored into pg_constraint.confupdtype
2889 * and pg_constraint.confdeltype columns; FKCONSTR_MATCH_xxx values are
2890 * stored into pg_constraint.confmatchtype. Changing the code values may
2891 * require an initdb!
2892 *
2893 * If skip_validation is true then we skip checking that the existing rows
2894 * in the table satisfy the constraint, and just install the catalog entries
2895 * for the constraint. A new FK constraint is marked as valid iff
2896 * initially_valid is true. (Usually skip_validation and initially_valid
2897 * are inverses, but we can set both true if the table is known empty.)
2898 *
2899 * Constraint attributes (DEFERRABLE etc) are initially represented as
2900 * separate Constraint nodes for simplicity of parsing. parse_utilcmd.c makes
2901 * a pass through the constraints list to insert the info into the appropriate
2902 * Constraint node.
2903 * ----------
2904 */
2905
2926
2927/* Foreign key action codes */
2928#define FKCONSTR_ACTION_NOACTION 'a'
2929#define FKCONSTR_ACTION_RESTRICT 'r'
2930#define FKCONSTR_ACTION_CASCADE 'c'
2931#define FKCONSTR_ACTION_SETNULL 'n'
2932#define FKCONSTR_ACTION_SETDEFAULT 'd'
2933
2934/* Foreign key matchtype codes */
2935#define FKCONSTR_MATCH_FULL 'f'
2936#define FKCONSTR_MATCH_PARTIAL 'p'
2937#define FKCONSTR_MATCH_SIMPLE 's'
2938
2939typedef struct Constraint
2940{
2942 ConstrType contype; /* see above */
2943 char *conname; /* Constraint name, or NULL if unnamed */
2944 bool deferrable; /* DEFERRABLE? */
2945 bool initdeferred; /* INITIALLY DEFERRED? */
2946 bool is_enforced; /* enforced constraint? */
2947 bool skip_validation; /* skip validation of existing rows? */
2948 bool initially_valid; /* mark the new constraint as valid? */
2949 bool is_no_inherit; /* is constraint non-inheritable? */
2950 Node *raw_expr; /* CHECK or DEFAULT expression, as
2951 * untransformed parse tree */
2952 char *cooked_expr; /* CHECK or DEFAULT expression, as
2953 * nodeToString representation */
2954 char generated_when; /* ALWAYS or BY DEFAULT */
2955 char generated_kind; /* STORED or VIRTUAL */
2956 bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
2957 List *keys; /* String nodes naming referenced key
2958 * column(s); for UNIQUE/PK/NOT NULL */
2959 bool without_overlaps; /* WITHOUT OVERLAPS specified */
2960 List *including; /* String nodes naming referenced nonkey
2961 * column(s); for UNIQUE/PK */
2962 List *exclusions; /* list of (IndexElem, operator name) pairs;
2963 * for exclusion constraints */
2964 List *options; /* options from WITH clause */
2965 char *indexname; /* existing index to use; otherwise NULL */
2966 char *indexspace; /* index tablespace; NULL for default */
2967 bool reset_default_tblspc; /* reset default_tablespace prior to
2968 * creating the index */
2969 char *access_method; /* index access method; NULL for default */
2970 Node *where_clause; /* partial index predicate */
2971
2972 /* Fields used for FOREIGN KEY constraints: */
2973 RangeVar *pktable; /* Primary key table */
2974 List *fk_attrs; /* Attributes of foreign key */
2975 List *pk_attrs; /* Corresponding attrs in PK table */
2976 bool fk_with_period; /* Last attribute of FK uses PERIOD */
2977 bool pk_with_period; /* Last attribute of PK uses PERIOD */
2978 char fk_matchtype; /* FULL, PARTIAL, SIMPLE */
2979 char fk_upd_action; /* ON UPDATE action */
2980 char fk_del_action; /* ON DELETE action */
2981 List *fk_del_set_cols; /* ON DELETE SET NULL/DEFAULT (col1, col2) */
2982 List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */
2983 Oid old_pktable_oid; /* pg_constraint.confrelid of my former
2984 * self */
2985
2986 ParseLoc location; /* token location, or -1 if unknown */
2988
2989/* ----------------------
2990 * Create/Drop Table Space Statements
2991 * ----------------------
2992 */
2993
3002
3004{
3007 bool missing_ok; /* skip error if missing? */
3009
3017
3019{
3022 ObjectType objtype; /* Object type to move */
3023 List *roles; /* List of roles to move objects of */
3027
3028/* ----------------------
3029 * Create/Alter Extension Statements
3030 * ----------------------
3031 */
3032
3034{
3036 char *extname;
3037 bool if_not_exists; /* just do nothing if it already exists? */
3038 List *options; /* List of DefElem nodes */
3040
3041/* Only used for ALTER EXTENSION UPDATE; later might need an action field */
3043{
3045 char *extname;
3046 List *options; /* List of DefElem nodes */
3048
3050{
3052 char *extname; /* Extension's name */
3053 int action; /* +1 = add object, -1 = drop object */
3054 ObjectType objtype; /* Object's type */
3055 Node *object; /* Qualified name of the object */
3057
3058/* ----------------------
3059 * Create/Alter FOREIGN DATA WRAPPER Statements
3060 * ----------------------
3061 */
3062
3063typedef struct CreateFdwStmt
3064{
3066 char *fdwname; /* foreign-data wrapper name */
3067 List *func_options; /* HANDLER/VALIDATOR options */
3068 List *options; /* generic options to FDW */
3070
3071typedef struct AlterFdwStmt
3072{
3074 char *fdwname; /* foreign-data wrapper name */
3075 List *func_options; /* HANDLER/VALIDATOR options */
3076 List *options; /* generic options to FDW */
3078
3079/* ----------------------
3080 * Create/Alter FOREIGN SERVER Statements
3081 * ----------------------
3082 */
3083
3085{
3087 char *servername; /* server name */
3088 char *servertype; /* optional server type */
3089 char *version; /* optional server version */
3090 char *fdwname; /* FDW name */
3091 bool if_not_exists; /* just do nothing if it already exists? */
3092 List *options; /* generic options to server */
3094
3096{
3098 char *servername; /* server name */
3099 char *version; /* optional server version */
3100 List *options; /* generic options to server */
3101 bool has_version; /* version specified */
3103
3104/* ----------------------
3105 * Create FOREIGN TABLE Statement
3106 * ----------------------
3107 */
3108
3115
3116/* ----------------------
3117 * Create/Drop USER MAPPING Statements
3118 * ----------------------
3119 */
3120
3122{
3124 RoleSpec *user; /* user role */
3125 char *servername; /* server name */
3126 bool if_not_exists; /* just do nothing if it already exists? */
3127 List *options; /* generic options to server */
3129
3131{
3133 RoleSpec *user; /* user role */
3134 char *servername; /* server name */
3135 List *options; /* generic options to server */
3137
3139{
3141 RoleSpec *user; /* user role */
3142 char *servername; /* server name */
3143 bool missing_ok; /* ignore missing mappings */
3145
3146/* ----------------------
3147 * Import Foreign Schema Statement
3148 * ----------------------
3149 */
3150
3152{
3153 FDW_IMPORT_SCHEMA_ALL, /* all relations wanted */
3154 FDW_IMPORT_SCHEMA_LIMIT_TO, /* include only listed tables in import */
3155 FDW_IMPORT_SCHEMA_EXCEPT, /* exclude listed tables from import */
3157
3159{
3161 char *server_name; /* FDW server name */
3162 char *remote_schema; /* remote schema name to query */
3163 char *local_schema; /* local schema to create objects in */
3164 ImportForeignSchemaType list_type; /* type of table list */
3165 List *table_list; /* List of RangeVar */
3166 List *options; /* list of options to pass to FDW */
3168
3169/*----------------------
3170 * Create POLICY Statement
3171 *----------------------
3172 */
3173typedef struct CreatePolicyStmt
3174{
3176 char *policy_name; /* Policy's name */
3177 RangeVar *table; /* the table name the policy applies to */
3178 char *cmd_name; /* the command name the policy applies to */
3179 bool permissive; /* restrictive or permissive policy */
3180 List *roles; /* the roles associated with the policy */
3181 Node *qual; /* the policy's condition */
3182 Node *with_check; /* the policy's WITH CHECK condition. */
3184
3185/*----------------------
3186 * Alter POLICY Statement
3187 *----------------------
3188 */
3189typedef struct AlterPolicyStmt
3190{
3192 char *policy_name; /* Policy's name */
3193 RangeVar *table; /* the table name the policy applies to */
3194 List *roles; /* the roles associated with the policy */
3195 Node *qual; /* the policy's condition */
3196 Node *with_check; /* the policy's WITH CHECK condition. */
3198
3199/*----------------------
3200 * Create ACCESS METHOD Statement
3201 *----------------------
3202 */
3203typedef struct CreateAmStmt
3204{
3206 char *amname; /* access method name */
3207 List *handler_name; /* handler function name */
3208 char amtype; /* type of access method */
3210
3211/* ----------------------
3212 * Create TRIGGER Statement
3213 * ----------------------
3214 */
3215typedef struct CreateTrigStmt
3216{
3218 bool replace; /* replace trigger if already exists */
3219 bool isconstraint; /* This is a constraint trigger */
3220 char *trigname; /* TRIGGER's name */
3221 RangeVar *relation; /* relation trigger is on */
3222 List *funcname; /* qual. name of function to call */
3223 List *args; /* list of String or NIL */
3224 bool row; /* ROW/STATEMENT */
3225 /* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
3226 int16 timing; /* BEFORE, AFTER, or INSTEAD */
3227 /* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
3228 int16 events; /* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */
3229 List *columns; /* column names, or NIL for all columns */
3230 Node *whenClause; /* qual expression, or NULL if none */
3231 /* explicitly named transition data */
3232 List *transitionRels; /* TriggerTransition nodes, or NIL if none */
3233 /* The remaining fields are only used for constraint triggers */
3234 bool deferrable; /* [NOT] DEFERRABLE */
3235 bool initdeferred; /* INITIALLY {DEFERRED|IMMEDIATE} */
3236 RangeVar *constrrel; /* opposite relation, if RI trigger */
3238
3239/* ----------------------
3240 * Create EVENT TRIGGER Statement
3241 * ----------------------
3242 */
3244{
3246 char *trigname; /* TRIGGER's name */
3247 char *eventname; /* event's identifier */
3248 List *whenclause; /* list of DefElems indicating filtering */
3249 List *funcname; /* qual. name of function to call */
3251
3252/* ----------------------
3253 * Alter EVENT TRIGGER Statement
3254 * ----------------------
3255 */
3257{
3259 char *trigname; /* TRIGGER's name */
3260 char tgenabled; /* trigger's firing configuration WRT
3261 * session_replication_role */
3263
3264/* ----------------------
3265 * Create LANGUAGE Statements
3266 * ----------------------
3267 */
3268typedef struct CreatePLangStmt
3269{
3271 bool replace; /* T => replace if already exists */
3272 char *plname; /* PL name */
3273 List *plhandler; /* PL call handler function (qual. name) */
3274 List *plinline; /* optional inline function (qual. name) */
3275 List *plvalidator; /* optional validator function (qual. name) */
3276 bool pltrusted; /* PL is trusted */
3278
3279/* ----------------------
3280 * Create/Alter/Drop Role Statements
3281 *
3282 * Note: these node types are also used for the backwards-compatible
3283 * Create/Alter/Drop User/Group statements. In the ALTER and DROP cases
3284 * there's really no need to distinguish what the original spelling was,
3285 * but for CREATE we mark the type because the defaults vary.
3286 * ----------------------
3287 */
3294
3295typedef struct CreateRoleStmt
3296{
3298 RoleStmtType stmt_type; /* ROLE/USER/GROUP */
3299 char *role; /* role name */
3300 List *options; /* List of DefElem nodes */
3302
3303typedef struct AlterRoleStmt
3304{
3306 RoleSpec *role; /* role */
3307 List *options; /* List of DefElem nodes */
3308 int action; /* +1 = add members, -1 = drop members */
3310
3311typedef struct AlterRoleSetStmt
3312{
3314 RoleSpec *role; /* role */
3315 char *database; /* database name, or NULL */
3316 VariableSetStmt *setstmt; /* SET or RESET subcommand */
3318
3319typedef struct DropRoleStmt
3320{
3322 List *roles; /* List of roles to remove */
3323 bool missing_ok; /* skip error if a role is missing? */
3325
3326/* ----------------------
3327 * {Create|Alter} SEQUENCE Statement
3328 * ----------------------
3329 */
3330
3331typedef struct CreateSeqStmt
3332{
3334 RangeVar *sequence; /* the sequence to create */
3336 Oid ownerId; /* ID of owner, or InvalidOid for default */
3338 bool if_not_exists; /* just do nothing if it already exists? */
3340
3341typedef struct AlterSeqStmt
3342{
3344 RangeVar *sequence; /* the sequence to alter */
3347 bool missing_ok; /* skip error if a role is missing? */
3349
3350/* ----------------------
3351 * Create {Aggregate|Operator|Type} Statement
3352 * ----------------------
3353 */
3354typedef struct DefineStmt
3355{
3357 ObjectType kind; /* aggregate, operator, type */
3358 bool oldstyle; /* hack to signal old CREATE AGG syntax */
3359 List *defnames; /* qualified name (list of String) */
3360 List *args; /* a list of TypeName (if needed) */
3361 List *definition; /* a list of DefElem */
3362 bool if_not_exists; /* just do nothing if it already exists? */
3363 bool replace; /* replace if already exists? */
3365
3366/* ----------------------
3367 * Create Domain Statement
3368 * ----------------------
3369 */
3370typedef struct CreateDomainStmt
3371{
3373 List *domainname; /* qualified name (list of String) */
3374 TypeName *typeName; /* the base type */
3375 CollateClause *collClause; /* untransformed COLLATE spec, if any */
3376 List *constraints; /* constraints (list of Constraint nodes) */
3378
3379/* ----------------------
3380 * Create Operator Class Statement
3381 * ----------------------
3382 */
3383typedef struct CreateOpClassStmt
3384{
3386 List *opclassname; /* qualified name (list of String) */
3387 List *opfamilyname; /* qualified name (ditto); NIL if omitted */
3388 char *amname; /* name of index AM opclass is for */
3389 TypeName *datatype; /* datatype of indexed column */
3390 List *items; /* List of CreateOpClassItem nodes */
3391 bool isDefault; /* Should be marked as default for type? */
3393
3394#define OPCLASS_ITEM_OPERATOR 1
3395#define OPCLASS_ITEM_FUNCTION 2
3396#define OPCLASS_ITEM_STORAGETYPE 3
3397
3398typedef struct CreateOpClassItem
3399{
3401 int itemtype; /* see codes above */
3402 ObjectWithArgs *name; /* operator or function name and args */
3403 int number; /* strategy num or support proc num */
3404 List *order_family; /* only used for ordering operators */
3405 List *class_args; /* amproclefttype/amprocrighttype or
3406 * amoplefttype/amoprighttype */
3407 /* fields used for a storagetype item: */
3408 TypeName *storedtype; /* datatype stored in index */
3410
3411/* ----------------------
3412 * Create Operator Family Statement
3413 * ----------------------
3414 */
3416{
3418 List *opfamilyname; /* qualified name (list of String) */
3419 char *amname; /* name of index AM opfamily is for */
3421
3422/* ----------------------
3423 * Alter Operator Family Statement
3424 * ----------------------
3425 */
3426typedef struct AlterOpFamilyStmt
3427{
3429 List *opfamilyname; /* qualified name (list of String) */
3430 char *amname; /* name of index AM opfamily is for */
3431 bool isDrop; /* ADD or DROP the items? */
3432 List *items; /* List of CreateOpClassItem nodes */
3434
3435/* ----------------------
3436 * Drop Table|Sequence|View|Index|Type|Domain|Conversion|Schema Statement
3437 * ----------------------
3438 */
3439
3440typedef struct DropStmt
3441{
3443 List *objects; /* list of names */
3444 ObjectType removeType; /* object type */
3445 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3446 bool missing_ok; /* skip error if object is missing? */
3447 bool concurrent; /* drop index concurrently? */
3449
3450/* ----------------------
3451 * Truncate Table Statement
3452 * ----------------------
3453 */
3454typedef struct TruncateStmt
3455{
3457 List *relations; /* relations (RangeVars) to be truncated */
3458 bool restart_seqs; /* restart owned sequences? */
3459 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3461
3462/* ----------------------
3463 * Comment On Statement
3464 * ----------------------
3465 */
3466typedef struct CommentStmt
3467{
3469 ObjectType objtype; /* Object's type */
3470 Node *object; /* Qualified name of the object */
3471 char *comment; /* Comment to insert, or NULL to remove */
3473
3474/* ----------------------
3475 * SECURITY LABEL Statement
3476 * ----------------------
3477 */
3478typedef struct SecLabelStmt
3479{
3481 ObjectType objtype; /* Object's type */
3482 Node *object; /* Qualified name of the object */
3483 char *provider; /* Label provider (or NULL) */
3484 char *label; /* New security label to be assigned */
3486
3487/* ----------------------
3488 * Declare Cursor Statement
3489 *
3490 * The "query" field is initially a raw parse tree, and is converted to a
3491 * Query node during parse analysis. Note that rewriting and planning
3492 * of the query are always postponed until execution.
3493 * ----------------------
3494 */
3495#define CURSOR_OPT_BINARY 0x0001 /* BINARY */
3496#define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */
3497#define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */
3498#define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */
3499#define CURSOR_OPT_ASENSITIVE 0x0010 /* ASENSITIVE */
3500#define CURSOR_OPT_HOLD 0x0020 /* WITH HOLD */
3501/* these planner-control flags do not correspond to any SQL grammar: */
3502#define CURSOR_OPT_FAST_PLAN 0x0100 /* prefer fast-start plan */
3503#define CURSOR_OPT_GENERIC_PLAN 0x0200 /* force use of generic plan */
3504#define CURSOR_OPT_CUSTOM_PLAN 0x0400 /* force use of custom plan */
3505#define CURSOR_OPT_PARALLEL_OK 0x0800 /* parallel mode OK */
3506
3507typedef struct DeclareCursorStmt
3508{
3510 char *portalname; /* name of the portal (cursor) */
3511 int options; /* bitmask of options (see above) */
3512 Node *query; /* the query (see comments above) */
3514
3515/* ----------------------
3516 * Close Portal Statement
3517 * ----------------------
3518 */
3519typedef struct ClosePortalStmt
3520{
3522 char *portalname; /* name of the portal (cursor) */
3523 /* NULL means CLOSE ALL */
3525
3526/* ----------------------
3527 * Fetch Statement (also Move)
3528 * ----------------------
3529 */
3530typedef enum FetchDirection
3531{
3532 /* for these, howMany is how many rows to fetch; FETCH_ALL means ALL */
3535 /* for these, howMany indicates a position; only one row is fetched */
3539
3555
3556#define FETCH_ALL LONG_MAX
3557
3558typedef struct FetchStmt
3559{
3561 FetchDirection direction; /* see above */
3562 /* number of rows, or position argument */
3564 /* name of portal (cursor) */
3566 /* true if MOVE */
3568
3569 /*
3570 * Set when a direction_keyword (e.g., FETCH FORWARD) is used, to
3571 * distinguish it from a numeric variant (e.g., FETCH 1) for the purpose
3572 * of query jumbling.
3573 */
3575
3576 /* token location, or -1 if unknown */
3579
3580/* ----------------------
3581 * Create Index Statement
3582 *
3583 * This represents creation of an index and/or an associated constraint.
3584 * If isconstraint is true, we should create a pg_constraint entry along
3585 * with the index. But if indexOid isn't InvalidOid, we are not creating an
3586 * index, just a UNIQUE/PKEY constraint using an existing index. isconstraint
3587 * must always be true in this case, and the fields describing the index
3588 * properties are empty.
3589 * ----------------------
3590 */
3591typedef struct IndexStmt
3592{
3594 char *idxname; /* name of new index, or NULL for default */
3595 RangeVar *relation; /* relation to build index on */
3596 char *accessMethod; /* name of access method (eg. btree) */
3597 char *tableSpace; /* tablespace, or NULL for default */
3598 List *indexParams; /* columns to index: a list of IndexElem */
3599 List *indexIncludingParams; /* additional columns to index: a list
3600 * of IndexElem */
3601 List *options; /* WITH clause options: a list of DefElem */
3602 Node *whereClause; /* qualification (partial-index predicate) */
3603 List *excludeOpNames; /* exclusion operator names, or NIL if none */
3604 char *idxcomment; /* comment to apply to index, or NULL */
3605 Oid indexOid; /* OID of an existing index, if any */
3606 RelFileNumber oldNumber; /* relfilenumber of existing storage, if any */
3607 SubTransactionId oldCreateSubid; /* rd_createSubid of oldNumber */
3608 SubTransactionId oldFirstRelfilelocatorSubid; /* rd_firstRelfilelocatorSubid
3609 * of oldNumber */
3610 bool unique; /* is index unique? */
3611 bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
3612 bool primary; /* is index a primary key? */
3613 bool isconstraint; /* is it for a pkey/unique constraint? */
3614 bool iswithoutoverlaps; /* is the constraint WITHOUT OVERLAPS? */
3615 bool deferrable; /* is the constraint DEFERRABLE? */
3616 bool initdeferred; /* is the constraint INITIALLY DEFERRED? */
3617 bool transformed; /* true when transformIndexStmt is finished */
3618 bool concurrent; /* should this be a concurrent index build? */
3619 bool if_not_exists; /* just do nothing if index already exists? */
3620 bool reset_default_tblspc; /* reset default_tablespace prior to
3621 * executing */
3623
3624/* ----------------------
3625 * Create Statistics Statement
3626 * ----------------------
3627 */
3628typedef struct CreateStatsStmt
3629{
3631 List *defnames; /* qualified name (list of String) */
3632 List *stat_types; /* stat types (list of String) */
3633 List *exprs; /* expressions to build statistics on */
3634 List *relations; /* rels to build stats on (list of RangeVar) */
3635 char *stxcomment; /* comment to apply to stats, or NULL */
3636 bool transformed; /* true when transformStatsStmt is finished */
3637 bool if_not_exists; /* do nothing if stats name already exists */
3639
3640/*
3641 * StatsElem - statistics parameters (used in CREATE STATISTICS)
3642 *
3643 * For a plain attribute, 'name' is the name of the referenced table column
3644 * and 'expr' is NULL. For an expression, 'name' is NULL and 'expr' is the
3645 * expression tree.
3646 */
3647typedef struct StatsElem
3648{
3650 char *name; /* name of attribute to index, or NULL */
3651 Node *expr; /* expression to index, or NULL */
3653
3654
3655/* ----------------------
3656 * Alter Statistics Statement
3657 * ----------------------
3658 */
3659typedef struct AlterStatsStmt
3660{
3662 List *defnames; /* qualified name (list of String) */
3663 Node *stxstattarget; /* statistics target */
3664 bool missing_ok; /* skip error if statistics object is missing */
3666
3667/* ----------------------
3668 * Create Function Statement
3669 * ----------------------
3670 */
3672{
3674 bool is_procedure; /* it's really CREATE PROCEDURE */
3675 bool replace; /* T => replace if already exists */
3676 List *funcname; /* qualified name of function to create */
3677 List *parameters; /* a list of FunctionParameter */
3678 TypeName *returnType; /* the return type */
3679 List *options; /* a list of DefElem */
3682
3684{
3685 /* the assigned enum values appear in pg_proc, don't change 'em! */
3686 FUNC_PARAM_IN = 'i', /* input only */
3687 FUNC_PARAM_OUT = 'o', /* output only */
3688 FUNC_PARAM_INOUT = 'b', /* both */
3689 FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */
3690 FUNC_PARAM_TABLE = 't', /* table function output column */
3691 /* this is not used in pg_proc: */
3692 FUNC_PARAM_DEFAULT = 'd', /* default; effectively same as IN */
3694
3695typedef struct FunctionParameter
3696{
3698 char *name; /* parameter name, or NULL if not given */
3699 TypeName *argType; /* TypeName for parameter type */
3700 FunctionParameterMode mode; /* IN/OUT/etc */
3701 Node *defexpr; /* raw default expr, or NULL if not given */
3702 ParseLoc location; /* token location, or -1 if unknown */
3704
3705typedef struct AlterFunctionStmt
3706{
3709 ObjectWithArgs *func; /* name and args of function */
3710 List *actions; /* list of DefElem */
3712
3713/* ----------------------
3714 * DO Statement
3715 *
3716 * DoStmt is the raw parser output, InlineCodeBlock is the execution-time API
3717 * ----------------------
3718 */
3719typedef struct DoStmt
3720{
3722 List *args; /* List of DefElem nodes */
3724
3725typedef struct InlineCodeBlock
3726{
3727 pg_node_attr(nodetag_only) /* this is not a member of parse trees */
3728
3729 NodeTag type;
3730 char *source_text; /* source text of anonymous code block */
3731 Oid langOid; /* OID of selected language */
3732 bool langIsTrusted; /* trusted property of the language */
3733 bool atomic; /* atomic execution context */
3735
3736/* ----------------------
3737 * CALL statement
3738 *
3739 * OUT-mode arguments are removed from the transformed funcexpr. The outargs
3740 * list contains copies of the expressions for all output arguments, in the
3741 * order of the procedure's declared arguments. (outargs is never evaluated,
3742 * but is useful to the caller as a reference for what to assign to.)
3743 * The transformed call state is not relevant in the query jumbling, only the
3744 * function call is.
3745 * ----------------------
3746 */
3747typedef struct CallStmt
3748{
3750 /* from the parser */
3752 /* transformed call, with only input args */
3754 /* transformed output-argument expressions */
3757
3758typedef struct CallContext
3759{
3760 pg_node_attr(nodetag_only) /* this is not a member of parse trees */
3761
3762 NodeTag type;
3765
3766/* ----------------------
3767 * Alter Object Rename Statement
3768 * ----------------------
3769 */
3770typedef struct RenameStmt
3771{
3773 ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */
3774 ObjectType relationType; /* if column name, associated relation type */
3775 RangeVar *relation; /* in case it's a table */
3776 Node *object; /* in case it's some other object */
3777 char *subname; /* name of contained object (column, rule,
3778 * trigger, etc) */
3779 char *newname; /* the new name */
3780 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3781 bool missing_ok; /* skip error if missing? */
3783
3784/* ----------------------
3785 * ALTER object DEPENDS ON EXTENSION extname
3786 * ----------------------
3787 */
3789{
3791 ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */
3792 RangeVar *relation; /* in case a table is involved */
3793 Node *object; /* name of the object */
3794 String *extname; /* extension name */
3795 bool remove; /* set true to remove dep rather than add */
3797
3798/* ----------------------
3799 * ALTER object SET SCHEMA Statement
3800 * ----------------------
3801 */
3803{
3805 ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
3806 RangeVar *relation; /* in case it's a table */
3807 Node *object; /* in case it's some other object */
3808 char *newschema; /* the new schema */
3809 bool missing_ok; /* skip error if missing? */
3811
3812/* ----------------------
3813 * Alter Object Owner Statement
3814 * ----------------------
3815 */
3816typedef struct AlterOwnerStmt
3817{
3819 ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
3820 RangeVar *relation; /* in case it's a table */
3821 Node *object; /* in case it's some other object */
3822 RoleSpec *newowner; /* the new owner */
3824
3825/* ----------------------
3826 * Alter Operator Set ( this-n-that )
3827 * ----------------------
3828 */
3829typedef struct AlterOperatorStmt
3830{
3832 ObjectWithArgs *opername; /* operator name and argument types */
3833 List *options; /* List of DefElem nodes */
3835
3836/* ------------------------
3837 * Alter Type Set ( this-n-that )
3838 * ------------------------
3839 */
3840typedef struct AlterTypeStmt
3841{
3843 List *typeName; /* type name (possibly qualified) */
3844 List *options; /* List of DefElem nodes */
3846
3847/* ----------------------
3848 * Create Rule Statement
3849 * ----------------------
3850 */
3851typedef struct RuleStmt
3852{
3854 RangeVar *relation; /* relation the rule is for */
3855 char *rulename; /* name of the rule */
3856 Node *whereClause; /* qualifications */
3857 CmdType event; /* SELECT, INSERT, etc */
3858 bool instead; /* is a 'do instead'? */
3859 List *actions; /* the action statements */
3860 bool replace; /* OR REPLACE */
3862
3863/* ----------------------
3864 * Notify Statement
3865 * ----------------------
3866 */
3867typedef struct NotifyStmt
3868{
3870 char *conditionname; /* condition name to notify */
3871 char *payload; /* the payload string, or NULL if none */
3873
3874/* ----------------------
3875 * Listen Statement
3876 * ----------------------
3877 */
3878typedef struct ListenStmt
3879{
3881 char *conditionname; /* condition name to listen on */
3883
3884/* ----------------------
3885 * Unlisten Statement
3886 * ----------------------
3887 */
3888typedef struct UnlistenStmt
3889{
3891 char *conditionname; /* name to unlisten on, or NULL for all */
3893
3894/* ----------------------
3895 * {Begin|Commit|Rollback} Transaction Statement
3896 * ----------------------
3897 */
3911
3912typedef struct TransactionStmt
3913{
3915 TransactionStmtKind kind; /* see above */
3916 List *options; /* for BEGIN/START commands */
3917 /* for savepoint commands */
3919 /* for two-phase-commit related commands */
3921 bool chain; /* AND CHAIN option */
3922 /* token location, or -1 if unknown */
3925
3926/* ----------------------
3927 * Create Type Statement, composite types
3928 * ----------------------
3929 */
3930typedef struct CompositeTypeStmt
3931{
3933 RangeVar *typevar; /* the composite type to be created */
3934 List *coldeflist; /* list of ColumnDef nodes */
3936
3937/* ----------------------
3938 * Create Type Statement, enum types
3939 * ----------------------
3940 */
3941typedef struct CreateEnumStmt
3942{
3944 List *typeName; /* qualified name (list of String) */
3945 List *vals; /* enum values (list of String) */
3947
3948/* ----------------------
3949 * Create Type Statement, range types
3950 * ----------------------
3951 */
3952typedef struct CreateRangeStmt
3953{
3955 List *typeName; /* qualified name (list of String) */
3956 List *params; /* range parameters (list of DefElem) */
3958
3959/* ----------------------
3960 * Alter Type Statement, enum types
3961 * ----------------------
3962 */
3963typedef struct AlterEnumStmt
3964{
3966 List *typeName; /* qualified name (list of String) */
3967 char *oldVal; /* old enum value's name, if renaming */
3968 char *newVal; /* new enum value's name */
3969 char *newValNeighbor; /* neighboring enum value, if specified */
3970 bool newValIsAfter; /* place new enum value after neighbor? */
3971 bool skipIfNewValExists; /* no error if new already exists? */
3973
3974/* ----------------------
3975 * Create View Statement
3976 * ----------------------
3977 */
3984
3985typedef struct ViewStmt
3986{
3988 RangeVar *view; /* the view to be created */
3989 List *aliases; /* target column names */
3990 Node *query; /* the SELECT query (as a raw parse tree) */
3991 bool replace; /* replace an existing view? */
3992 List *options; /* options from WITH clause */
3993 ViewCheckOption withCheckOption; /* WITH CHECK OPTION */
3995
3996/* ----------------------
3997 * Load Statement
3998 * ----------------------
3999 */
4000typedef struct LoadStmt
4001{
4003 char *filename; /* file to load */
4005
4006/* ----------------------
4007 * Createdb Statement
4008 * ----------------------
4009 */
4010typedef struct CreatedbStmt
4011{
4013 char *dbname; /* name of database to create */
4014 List *options; /* List of DefElem nodes */
4016
4017/* ----------------------
4018 * Alter Database
4019 * ----------------------
4020 */
4021typedef struct AlterDatabaseStmt
4022{
4024 char *dbname; /* name of database to alter */
4025 List *options; /* List of DefElem nodes */
4027
4033
4035{
4037 char *dbname; /* database name */
4038 VariableSetStmt *setstmt; /* SET or RESET subcommand */
4040
4041/* ----------------------
4042 * Dropdb Statement
4043 * ----------------------
4044 */
4045typedef struct DropdbStmt
4046{
4048 char *dbname; /* database to drop */
4049 bool missing_ok; /* skip error if db is missing? */
4050 List *options; /* currently only FORCE is supported */
4052
4053/* ----------------------
4054 * Alter System Statement
4055 * ----------------------
4056 */
4062
4063/* ----------------------
4064 * Vacuum and Analyze Statements
4065 *
4066 * Even though these are nominally two statements, it's convenient to use
4067 * just one node type for both.
4068 * ----------------------
4069 */
4070typedef struct VacuumStmt
4071{
4073 List *options; /* list of DefElem nodes */
4074 List *rels; /* list of VacuumRelation, or NIL for all */
4075 bool is_vacuumcmd; /* true for VACUUM, false otherwise */
4077
4078/*
4079 * Info about a single target table of VACUUM/ANALYZE.
4080 *
4081 * If the OID field is set, it always identifies the table to process.
4082 * Then the relation field can be NULL; if it isn't, it's used only to report
4083 * failure to open/lock the relation.
4084 */
4085typedef struct VacuumRelation
4086{
4088 RangeVar *relation; /* table name to process, or NULL */
4089 Oid oid; /* table's OID; InvalidOid if not looked up */
4090 List *va_cols; /* list of column names, or NIL for all */
4092
4093/* ----------------------
4094 * Repack Statement
4095 * ----------------------
4096 */
4103
4104typedef struct RepackStmt
4105{
4107 RepackCommand command; /* type of command being run */
4108 VacuumRelation *relation; /* relation being repacked */
4109 char *indexname; /* order tuples by this index */
4110 bool usingindex; /* whether USING INDEX is specified */
4111 List *params; /* list of DefElem nodes */
4113
4114/* ----------------------
4115 * Explain Statement
4116 *
4117 * The "query" field is initially a raw parse tree, and is converted to a
4118 * Query node during parse analysis. Note that rewriting and planning
4119 * of the query are always postponed until execution.
4120 * ----------------------
4121 */
4122typedef struct ExplainStmt
4123{
4125 Node *query; /* the query (see comments above) */
4126 List *options; /* list of DefElem nodes */
4128
4129/* ----------------------
4130 * CREATE TABLE AS Statement (a/k/a SELECT INTO)
4131 *
4132 * A query written as CREATE TABLE AS will produce this node type natively.
4133 * A query written as SELECT ... INTO will be transformed to this form during
4134 * parse analysis.
4135 * A query written as CREATE MATERIALIZED view will produce this node type,
4136 * during parse analysis, since it needs all the same data.
4137 *
4138 * The "query" field is handled similarly to EXPLAIN, though note that it
4139 * can be a SELECT or an EXECUTE, but not other DML statements.
4140 * ----------------------
4141 */
4142typedef struct CreateTableAsStmt
4143{
4145 Node *query; /* the query (see comments above) */
4146 IntoClause *into; /* destination table */
4147 ObjectType objtype; /* OBJECT_TABLE or OBJECT_MATVIEW */
4148 bool is_select_into; /* it was written as SELECT INTO */
4149 bool if_not_exists; /* just do nothing if it already exists? */
4151
4152/* ----------------------
4153 * REFRESH MATERIALIZED VIEW Statement
4154 * ----------------------
4155 */
4157{
4159 bool concurrent; /* allow concurrent access? */
4160 bool skipData; /* true for WITH NO DATA */
4161 RangeVar *relation; /* relation to insert into */
4163
4164/* ----------------------
4165 * Checkpoint Statement
4166 * ----------------------
4167 */
4168typedef struct CheckPointStmt
4169{
4171 List *options; /* list of DefElem nodes */
4173
4174/* ----------------------
4175 * Discard Statement
4176 * ----------------------
4177 */
4178
4186
4192
4193/* ----------------------
4194 * LOCK Statement
4195 * ----------------------
4196 */
4197typedef struct LockStmt
4198{
4200 List *relations; /* relations to lock */
4201 int mode; /* lock mode */
4202 bool nowait; /* no wait mode */
4204
4205/* ----------------------
4206 * SET CONSTRAINTS Statement
4207 * ----------------------
4208 */
4210{
4212 List *constraints; /* List of names as RangeVars */
4215
4216/* ----------------------
4217 * REINDEX Statement
4218 * ----------------------
4219 */
4221{
4223 REINDEX_OBJECT_TABLE, /* table or materialized view */
4225 REINDEX_OBJECT_SYSTEM, /* system catalogs */
4228
4229typedef struct ReindexStmt
4230{
4232 ReindexObjectType kind; /* REINDEX_OBJECT_INDEX, REINDEX_OBJECT_TABLE,
4233 * etc. */
4234 RangeVar *relation; /* Table or index to reindex */
4235 const char *name; /* name of database to reindex */
4236 List *params; /* list of DefElem nodes */
4238
4239/* ----------------------
4240 * CREATE CONVERSION Statement
4241 * ----------------------
4242 */
4244{
4246 List *conversion_name; /* Name of the conversion */
4247 char *for_encoding_name; /* source encoding name */
4248 char *to_encoding_name; /* destination encoding name */
4249 List *func_name; /* qualified conversion function name */
4250 bool def; /* is this a default conversion? */
4252
4253/* ----------------------
4254 * CREATE CAST Statement
4255 * ----------------------
4256 */
4266
4267/* ----------------------
4268 * CREATE PROPERTY GRAPH Statement
4269 * ----------------------
4270 */
4278
4287
4302
4310
4318
4319/* ----------------------
4320 * ALTER PROPERTY GRAPH Statement
4321 * ----------------------
4322 */
4323
4329
4348
4349/* ----------------------
4350 * CREATE TRANSFORM Statement
4351 * ----------------------
4352 */
4362
4363/* ----------------------
4364 * PREPARE Statement
4365 * ----------------------
4366 */
4367typedef struct PrepareStmt
4368{
4370 char *name; /* Name of plan, arbitrary */
4371 List *argtypes; /* Types of parameters (List of TypeName) */
4372 Node *query; /* The query itself (as a raw parsetree) */
4374
4375
4376/* ----------------------
4377 * EXECUTE Statement
4378 * ----------------------
4379 */
4380
4381typedef struct ExecuteStmt
4382{
4384 char *name; /* The name of the plan to execute */
4385 List *params; /* Values to assign to parameters */
4387
4388
4389/* ----------------------
4390 * DEALLOCATE Statement
4391 * ----------------------
4392 */
4393typedef struct DeallocateStmt
4394{
4396 /* The name of the plan to remove, NULL if DEALLOCATE ALL */
4398
4399 /*
4400 * True if DEALLOCATE ALL. This is redundant with "name == NULL", but we
4401 * make it a separate field so that exactly this condition (and not the
4402 * precise name) will be accounted for in query jumbling.
4403 */
4404 bool isall;
4405 /* token location, or -1 if unknown */
4408
4409/*
4410 * DROP OWNED statement
4411 */
4418
4419/*
4420 * REASSIGN OWNED statement
4421 */
4428
4429/*
4430 * TS Dictionary stmts: DefineStmt, RenameStmt and DropStmt are default
4431 */
4433{
4435 List *dictname; /* qualified name (list of String) */
4436 List *options; /* List of DefElem nodes */
4438
4439/*
4440 * TS Configuration stmts: DefineStmt, RenameStmt and DropStmt are default
4441 */
4450
4452{
4454 AlterTSConfigType kind; /* ALTER_TSCONFIG_ADD_MAPPING, etc */
4455 List *cfgname; /* qualified name (list of String) */
4456
4457 /*
4458 * dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is
4459 * NIL, but tokentype isn't, DROP MAPPING was specified.
4460 */
4461 List *tokentype; /* list of String */
4462 List *dicts; /* list of list of String */
4463 bool override; /* if true - remove old variant */
4464 bool replace; /* if true - replace dictionary by another */
4465 bool missing_ok; /* for DROP - skip error if missing? */
4467
4468typedef struct PublicationTable
4469{
4471 RangeVar *relation; /* publication relation */
4472 Node *whereClause; /* qualifications */
4473 List *columns; /* List of columns in a publication table */
4474 bool except; /* True if listed in the EXCEPT clause */
4476
4477/*
4478 * Publication object type
4479 */
4481{
4483 PUBLICATIONOBJ_EXCEPT_TABLE, /* A table in the EXCEPT clause */
4484 PUBLICATIONOBJ_TABLES_IN_SCHEMA, /* All tables in schema */
4485 PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA, /* All tables in first element of
4486 * search_path */
4487 PUBLICATIONOBJ_CONTINUATION, /* Continuation of previous type */
4489
4491{
4493 PublicationObjSpecType pubobjtype; /* type of this publication object */
4494 char *name;
4496 ParseLoc location; /* token location, or -1 if unknown */
4498
4499/*
4500 * Types of objects supported by FOR ALL publications
4501 */
4507
4509{
4511 PublicationAllObjType pubobjtype; /* type of this publication object */
4512 List *except_tables; /* tables specified in the EXCEPT clause */
4513 ParseLoc location; /* token location, or -1 if unknown */
4515
4517{
4519 char *pubname; /* Name of the publication */
4520 List *options; /* List of DefElem nodes */
4521 List *pubobjects; /* Optional list of publication objects */
4522 bool for_all_tables; /* Special publication for all tables in db */
4523 bool for_all_sequences; /* Special publication for all sequences
4524 * in db */
4526
4528{
4529 AP_AddObjects, /* add objects to publication */
4530 AP_DropObjects, /* remove objects from publication */
4531 AP_SetObjects, /* set list of objects */
4533
4535{
4537 char *pubname; /* Name of the publication */
4538
4539 /* parameters used for ALTER PUBLICATION ... WITH */
4540 List *options; /* List of DefElem nodes */
4541
4542 /*
4543 * Parameters used for ALTER PUBLICATION ... ADD/DROP/SET publication
4544 * objects.
4545 */
4546 List *pubobjects; /* Optional list of publication objects */
4547 AlterPublicationAction action; /* What action to perform with the given
4548 * objects */
4549 bool for_all_tables; /* True if ALL TABLES is specified */
4550 bool for_all_sequences; /* True if ALL SEQUENCES is specified */
4552
4554{
4556 char *subname; /* Name of the subscription */
4557 char *servername; /* Server name of publisher */
4558 char *conninfo; /* Connection string to publisher */
4559 List *publication; /* One or more publication to subscribe to */
4560 List *options; /* List of DefElem nodes */
4562
4576
4578{
4580 AlterSubscriptionType kind; /* ALTER_SUBSCRIPTION_OPTIONS, etc */
4581 char *subname; /* Name of the subscription */
4582 char *servername; /* Server name of publisher */
4583 char *conninfo; /* Connection string to publisher */
4584 List *publication; /* One or more publication to subscribe to */
4585 List *options; /* List of DefElem nodes */
4587
4589{
4591 char *subname; /* Name of the subscription */
4592 bool missing_ok; /* Skip error if missing? */
4593 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
4595
4596typedef struct WaitStmt
4597{
4599 char *lsn_literal; /* LSN string from grammar */
4600 List *options; /* List of DefElem nodes */
4602
4603
4604#endif /* PARSENODES_H */
#define PG_INT32_MAX
Definition c.h:673
uint32 SubTransactionId
Definition c.h:740
int64_t int64
Definition c.h:621
int16_t int16
Definition c.h:619
int32_t int32
Definition c.h:620
uint64_t uint64
Definition c.h:625
uint32_t uint32
Definition c.h:624
unsigned int Index
Definition c.h:698
LockWaitPolicy
Definition lockoptions.h:38
LockClauseStrength
Definition lockoptions.h:22
OnConflictAction
Definition nodes.h:427
double Cardinality
Definition nodes.h:262
CmdType
Definition nodes.h:273
NodeTag
Definition nodes.h:27
LimitOption
Definition nodes.h:441
int ParseLoc
Definition nodes.h:250
JoinType
Definition nodes.h:298
RoleSpecType
Definition parsenodes.h:421
@ ROLESPEC_CURRENT_USER
Definition parsenodes.h:424
@ ROLESPEC_CSTRING
Definition parsenodes.h:422
@ ROLESPEC_SESSION_USER
Definition parsenodes.h:425
@ ROLESPEC_CURRENT_ROLE
Definition parsenodes.h:423
@ ROLESPEC_PUBLIC
Definition parsenodes.h:426
AlterSubscriptionType
@ ALTER_SUBSCRIPTION_REFRESH_PUBLICATION
@ ALTER_SUBSCRIPTION_ENABLED
@ ALTER_SUBSCRIPTION_DROP_PUBLICATION
@ ALTER_SUBSCRIPTION_SERVER
@ ALTER_SUBSCRIPTION_SET_PUBLICATION
@ ALTER_SUBSCRIPTION_REFRESH_SEQUENCES
@ ALTER_SUBSCRIPTION_SKIP
@ ALTER_SUBSCRIPTION_OPTIONS
@ ALTER_SUBSCRIPTION_CONNECTION
@ ALTER_SUBSCRIPTION_ADD_PUBLICATION
PublicationAllObjType
@ PUBLICATION_ALL_TABLES
@ PUBLICATION_ALL_SEQUENCES
AlterDomainType
@ AD_AddConstraint
@ AD_DropConstraint
@ AD_AlterDefault
@ AD_DropNotNull
@ AD_ValidateConstraint
@ AD_SetNotNull
TransactionStmtKind
@ TRANS_STMT_ROLLBACK_TO
@ TRANS_STMT_START
@ TRANS_STMT_SAVEPOINT
@ TRANS_STMT_BEGIN
@ TRANS_STMT_ROLLBACK
@ TRANS_STMT_COMMIT_PREPARED
@ TRANS_STMT_COMMIT
@ TRANS_STMT_ROLLBACK_PREPARED
@ TRANS_STMT_PREPARE
@ TRANS_STMT_RELEASE
WCOKind
@ WCO_RLS_MERGE_UPDATE_CHECK
@ WCO_RLS_CONFLICT_CHECK
@ WCO_RLS_INSERT_CHECK
@ WCO_VIEW_CHECK
@ WCO_RLS_UPDATE_CHECK
@ WCO_RLS_MERGE_DELETE_CHECK
JsonTableColumnType
@ JTC_FORMATTED
@ JTC_FOR_ORDINALITY
@ JTC_NESTED
@ JTC_EXISTS
@ JTC_REGULAR
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
RepackCommand
@ REPACK_COMMAND_REPACK
@ REPACK_COMMAND_CLUSTER
@ REPACK_COMMAND_VACUUMFULL
GroupingSetKind
@ GROUPING_SET_CUBE
@ GROUPING_SET_SIMPLE
@ GROUPING_SET_ROLLUP
@ GROUPING_SET_SETS
@ GROUPING_SET_EMPTY
SetOperation
@ SETOP_INTERSECT
@ SETOP_UNION
@ SETOP_EXCEPT
@ SETOP_NONE
uint64 AclMode
Definition parsenodes.h:74
JsonQuotes
@ JS_QUOTES_KEEP
@ JS_QUOTES_UNSPEC
@ JS_QUOTES_OMIT
A_Expr_Kind
Definition parsenodes.h:332
@ AEXPR_BETWEEN
Definition parsenodes.h:343
@ AEXPR_NULLIF
Definition parsenodes.h:338
@ AEXPR_NOT_DISTINCT
Definition parsenodes.h:337
@ AEXPR_BETWEEN_SYM
Definition parsenodes.h:345
@ AEXPR_NOT_BETWEEN_SYM
Definition parsenodes.h:346
@ AEXPR_ILIKE
Definition parsenodes.h:341
@ AEXPR_IN
Definition parsenodes.h:339
@ AEXPR_NOT_BETWEEN
Definition parsenodes.h:344
@ AEXPR_DISTINCT
Definition parsenodes.h:336
@ AEXPR_SIMILAR
Definition parsenodes.h:342
@ AEXPR_LIKE
Definition parsenodes.h:340
@ AEXPR_OP
Definition parsenodes.h:333
@ AEXPR_OP_ANY
Definition parsenodes.h:334
@ AEXPR_OP_ALL
Definition parsenodes.h:335
FunctionParameterMode
@ FUNC_PARAM_IN
@ FUNC_PARAM_DEFAULT
@ FUNC_PARAM_OUT
@ FUNC_PARAM_INOUT
@ FUNC_PARAM_TABLE
@ FUNC_PARAM_VARIADIC
AlterTSConfigType
@ ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN
@ ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN
@ ALTER_TSCONFIG_REPLACE_DICT
@ ALTER_TSCONFIG_ADD_MAPPING
@ ALTER_TSCONFIG_DROP_MAPPING
PublicationObjSpecType
@ PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA
@ PUBLICATIONOBJ_TABLES_IN_SCHEMA
@ PUBLICATIONOBJ_TABLE
@ PUBLICATIONOBJ_EXCEPT_TABLE
@ PUBLICATIONOBJ_CONTINUATION
PartitionStrategy
Definition parsenodes.h:916
@ PARTITION_STRATEGY_HASH
Definition parsenodes.h:919
@ PARTITION_STRATEGY_LIST
Definition parsenodes.h:917
@ PARTITION_STRATEGY_RANGE
Definition parsenodes.h:918
ImportForeignSchemaType
@ FDW_IMPORT_SCHEMA_LIMIT_TO
@ FDW_IMPORT_SCHEMA_ALL
@ FDW_IMPORT_SCHEMA_EXCEPT
AlterPublicationAction
@ AP_DropObjects
@ AP_SetObjects
@ AP_AddObjects
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
RTEKind
@ RTE_JOIN
@ RTE_CTE
@ RTE_NAMEDTUPLESTORE
@ RTE_VALUES
@ RTE_SUBQUERY
@ RTE_RESULT
@ RTE_FUNCTION
@ RTE_TABLEFUNC
@ RTE_GROUP
@ RTE_GRAPH_TABLE
@ RTE_RELATION
DefElemAction
Definition parsenodes.h:849
@ DEFELEM_UNSPEC
Definition parsenodes.h:850
@ DEFELEM_DROP
Definition parsenodes.h:853
@ DEFELEM_SET
Definition parsenodes.h:851
@ DEFELEM_ADD
Definition parsenodes.h:852
ConstrType
@ CONSTR_ATTR_ENFORCED
@ CONSTR_FOREIGN
@ CONSTR_ATTR_DEFERRED
@ CONSTR_IDENTITY
@ CONSTR_UNIQUE
@ CONSTR_ATTR_NOT_DEFERRABLE
@ CONSTR_DEFAULT
@ CONSTR_NOTNULL
@ CONSTR_ATTR_IMMEDIATE
@ CONSTR_CHECK
@ CONSTR_NULL
@ CONSTR_GENERATED
@ CONSTR_EXCLUSION
@ CONSTR_ATTR_DEFERRABLE
@ CONSTR_ATTR_NOT_ENFORCED
@ CONSTR_PRIMARY
PartitionRangeDatumKind
Definition parsenodes.h:968
@ PARTITION_RANGE_DATUM_MAXVALUE
Definition parsenodes.h:971
@ PARTITION_RANGE_DATUM_VALUE
Definition parsenodes.h:970
@ PARTITION_RANGE_DATUM_MINVALUE
Definition parsenodes.h:969
GraphElementPatternKind
@ EDGE_PATTERN_RIGHT
@ VERTEX_PATTERN
@ EDGE_PATTERN_LEFT
@ PAREN_EXPR
@ EDGE_PATTERN_ANY
FetchDirection
@ FETCH_RELATIVE
@ FETCH_ABSOLUTE
@ FETCH_FORWARD
@ FETCH_BACKWARD
VariableSetKind
@ VAR_SET_DEFAULT
@ VAR_RESET
@ VAR_SET_MULTI
@ VAR_SET_VALUE
@ VAR_SET_CURRENT
@ VAR_RESET_ALL
DropBehavior
@ DROP_CASCADE
@ DROP_RESTRICT
ObjectType
@ OBJECT_EVENT_TRIGGER
@ OBJECT_FDW
@ OBJECT_TSPARSER
@ OBJECT_COLLATION
@ OBJECT_USER_MAPPING
@ OBJECT_PROPGRAPH
@ OBJECT_ACCESS_METHOD
@ OBJECT_OPCLASS
@ OBJECT_DEFACL
@ OBJECT_AGGREGATE
@ OBJECT_MATVIEW
@ OBJECT_SCHEMA
@ OBJECT_POLICY
@ OBJECT_OPERATOR
@ OBJECT_FOREIGN_TABLE
@ OBJECT_TSCONFIGURATION
@ OBJECT_OPFAMILY
@ OBJECT_DOMAIN
@ OBJECT_COLUMN
@ OBJECT_TABLESPACE
@ OBJECT_ROLE
@ OBJECT_ROUTINE
@ OBJECT_LARGEOBJECT
@ OBJECT_PUBLICATION_NAMESPACE
@ OBJECT_PROCEDURE
@ OBJECT_EXTENSION
@ OBJECT_INDEX
@ OBJECT_DEFAULT
@ OBJECT_DATABASE
@ OBJECT_SEQUENCE
@ OBJECT_TSTEMPLATE
@ OBJECT_LANGUAGE
@ OBJECT_AMOP
@ OBJECT_PUBLICATION_REL
@ OBJECT_FOREIGN_SERVER
@ OBJECT_TSDICTIONARY
@ OBJECT_ATTRIBUTE
@ OBJECT_PUBLICATION
@ OBJECT_RULE
@ OBJECT_CONVERSION
@ OBJECT_AMPROC
@ OBJECT_TABLE
@ OBJECT_VIEW
@ OBJECT_PARAMETER_ACL
@ OBJECT_TYPE
@ OBJECT_FUNCTION
@ OBJECT_TABCONSTRAINT
@ OBJECT_DOMCONSTRAINT
@ OBJECT_SUBSCRIPTION
@ OBJECT_STATISTIC_EXT
@ OBJECT_CAST
@ OBJECT_TRIGGER
@ OBJECT_TRANSFORM
ReindexObjectType
@ REINDEX_OBJECT_DATABASE
@ REINDEX_OBJECT_INDEX
@ REINDEX_OBJECT_SCHEMA
@ REINDEX_OBJECT_SYSTEM
@ REINDEX_OBJECT_TABLE
AlterPropGraphElementKind
@ PROPGRAPH_ELEMENT_KIND_EDGE
@ PROPGRAPH_ELEMENT_KIND_VERTEX
AlterTableType
@ AT_AddIndexConstraint
@ AT_MergePartitions
@ AT_DropOf
@ AT_SetOptions
@ AT_DropIdentity
@ AT_DisableTrigUser
@ AT_DropNotNull
@ AT_AddOf
@ AT_ResetOptions
@ AT_ReplicaIdentity
@ AT_ReplaceRelOptions
@ AT_EnableRowSecurity
@ AT_AddColumnToView
@ AT_ResetRelOptions
@ AT_EnableReplicaTrig
@ AT_DropOids
@ AT_SetIdentity
@ AT_ReAddStatistics
@ AT_SetUnLogged
@ AT_DisableTrig
@ AT_SetCompression
@ AT_DropExpression
@ AT_AddIndex
@ AT_EnableReplicaRule
@ AT_ReAddIndex
@ AT_DropConstraint
@ AT_SetNotNull
@ AT_ClusterOn
@ AT_AddIdentity
@ AT_ForceRowSecurity
@ AT_EnableAlwaysRule
@ AT_SetAccessMethod
@ AT_AlterColumnType
@ AT_DetachPartitionFinalize
@ AT_AddInherit
@ AT_ReAddDomainConstraint
@ AT_EnableTrig
@ AT_DropColumn
@ AT_ReAddComment
@ AT_AlterColumnGenericOptions
@ AT_DisableTrigAll
@ AT_EnableRule
@ AT_NoForceRowSecurity
@ AT_DetachPartition
@ AT_SetStatistics
@ AT_AttachPartition
@ AT_AddConstraint
@ AT_DropInherit
@ AT_EnableAlwaysTrig
@ AT_SetLogged
@ AT_SetStorage
@ AT_DisableRule
@ AT_DisableRowSecurity
@ AT_SetRelOptions
@ AT_ChangeOwner
@ AT_EnableTrigUser
@ AT_SetExpression
@ AT_ReAddConstraint
@ AT_SetTableSpace
@ AT_GenericOptions
@ AT_ColumnDefault
@ AT_CookedColumnDefault
@ AT_AlterConstraint
@ AT_EnableTrigAll
@ AT_SplitPartition
@ AT_DropCluster
@ AT_ValidateConstraint
@ AT_AddColumn
GrantTargetType
@ ACL_TARGET_DEFAULTS
@ ACL_TARGET_OBJECT
@ ACL_TARGET_ALL_IN_SCHEMA
FetchDirectionKeywords
@ FETCH_KEYWORD_LAST
@ FETCH_KEYWORD_RELATIVE
@ FETCH_KEYWORD_PRIOR
@ FETCH_KEYWORD_FIRST
@ FETCH_KEYWORD_NEXT
@ FETCH_KEYWORD_FORWARD_ALL
@ FETCH_KEYWORD_NONE
@ FETCH_KEYWORD_ABSOLUTE
@ FETCH_KEYWORD_FORWARD
@ FETCH_KEYWORD_BACKWARD
@ FETCH_KEYWORD_ALL
@ FETCH_KEYWORD_BACKWARD_ALL
DiscardMode
@ DISCARD_ALL
@ DISCARD_PLANS
@ DISCARD_SEQUENCES
@ DISCARD_TEMP
ReturningOptionKind
@ RETURNING_OPTION_NEW
@ RETURNING_OPTION_OLD
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
RoleStmtType
@ ROLESTMT_ROLE
@ ROLESTMT_USER
@ ROLESTMT_GROUP
TableLikeOption
Definition parsenodes.h:804
@ CREATE_TABLE_LIKE_COMMENTS
Definition parsenodes.h:805
@ CREATE_TABLE_LIKE_GENERATED
Definition parsenodes.h:809
@ CREATE_TABLE_LIKE_IDENTITY
Definition parsenodes.h:810
@ CREATE_TABLE_LIKE_COMPRESSION
Definition parsenodes.h:806
@ CREATE_TABLE_LIKE_STORAGE
Definition parsenodes.h:813
@ CREATE_TABLE_LIKE_ALL
Definition parsenodes.h:814
@ CREATE_TABLE_LIKE_INDEXES
Definition parsenodes.h:811
@ CREATE_TABLE_LIKE_DEFAULTS
Definition parsenodes.h:808
@ CREATE_TABLE_LIKE_STATISTICS
Definition parsenodes.h:812
@ CREATE_TABLE_LIKE_CONSTRAINTS
Definition parsenodes.h:807
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
@ NO_CHECK_OPTION
@ CASCADED_CHECK_OPTION
@ LOCAL_CHECK_OPTION
CTEMaterialize
@ CTEMaterializeNever
@ CTEMaterializeAlways
@ CTEMaterializeDefault
unsigned int Oid
static int fb(int x)
XmlOptionType
Definition primnodes.h:1618
JsonWrapper
Definition primnodes.h:1777
OnCommitAction
Definition primnodes.h:58
JsonExprOp
Definition primnodes.h:1829
CoercionForm
Definition primnodes.h:766
OverridingKind
Definition primnodes.h:28
MergeMatchKind
Definition primnodes.h:2023
CoercionContext
Definition primnodes.h:746
Oid RelFileNumber
Definition relpath.h:25
NodeTag type
Definition parsenodes.h:520
List * elements
Definition parsenodes.h:521
ParseLoc list_start
Definition parsenodes.h:522
ParseLoc list_end
Definition parsenodes.h:523
ParseLoc location
Definition parsenodes.h:524
bool isnull
Definition parsenodes.h:391
union ValUnion val
Definition parsenodes.h:390
ParseLoc location
Definition parsenodes.h:392
pg_node_attr(custom_copy_equal, custom_read_write, custom_query_jumble) NodeTag type
ParseLoc location
Definition parsenodes.h:366
ParseLoc rexpr_list_end
Definition parsenodes.h:365
Node * lexpr
Definition parsenodes.h:356
ParseLoc rexpr_list_start
Definition parsenodes.h:364
pg_node_attr(custom_read_write) NodeTag type
List * name
Definition parsenodes.h:355
A_Expr_Kind kind
Definition parsenodes.h:354
Node * rexpr
Definition parsenodes.h:357
bool is_slice
Definition parsenodes.h:488
Node * uidx
Definition parsenodes.h:490
NodeTag type
Definition parsenodes.h:487
Node * lidx
Definition parsenodes.h:489
List * indirection
Definition parsenodes.h:512
NodeTag type
Definition parsenodes.h:476
char * priv_name
NodeTag type
List * cols
VariableSetStmt * setstmt
AlterDomainType subtype
DropBehavior behavior
char * newValNeighbor
bool skipIfNewValExists
List * func_options
ObjectWithArgs * func
ObjectType objtype
ObjectWithArgs * opername
RangeVar * relation
RoleSpec * newowner
ObjectType objectType
RangeVar * table
PropGraphProperties * add_properties
const char * alter_label
AlterPropGraphElementKind element_kind
DropBehavior drop_behavior
const char * element_alias
const char * drop_label
AlterPublicationAction action
RoleSpec * role
VariableSetStmt * setstmt
RoleSpec * role
RangeVar * sequence
Node * stxstattarget
AlterSubscriptionType kind
VariableSetStmt * setstmt
AlterTSConfigType kind
RoleSpec * newowner
DropBehavior behavior
AlterTableType subtype
RangeVar * relation
ObjectType objtype
char * cycle_path_column
ParseLoc location
Node * cycle_mark_default
List * cycle_col_list
char * cycle_mark_column
Node * cycle_mark_value
ParseLoc location
char * search_seq_column
bool search_breadth_first
List * search_col_list
pg_node_attr(nodetag_only) NodeTag type
FuncExpr * funcexpr
NodeTag type
List * outargs
FuncCall *funccall pg_node_attr(query_jumble_ignore)
List * collname
Definition parsenodes.h:413
ParseLoc location
Definition parsenodes.h:414
bool is_not_null
Definition parsenodes.h:775
CollateClause * collClause
Definition parsenodes.h:785
char identity
Definition parsenodes.h:781
RangeVar * identitySequence
Definition parsenodes.h:782
List * constraints
Definition parsenodes.h:787
Node * cooked_default
Definition parsenodes.h:780
char * storage_name
Definition parsenodes.h:778
char * colname
Definition parsenodes.h:770
TypeName * typeName
Definition parsenodes.h:771
char generated
Definition parsenodes.h:784
NodeTag type
Definition parsenodes.h:769
bool is_from_type
Definition parsenodes.h:776
List * fdwoptions
Definition parsenodes.h:788
Node * raw_default
Definition parsenodes.h:779
char storage
Definition parsenodes.h:777
bool is_local
Definition parsenodes.h:774
int16 inhcount
Definition parsenodes.h:773
char * compression
Definition parsenodes.h:772
ParseLoc location
Definition parsenodes.h:789
ParseLoc location
Definition parsenodes.h:315
List * fields
Definition parsenodes.h:314
NodeTag type
Definition parsenodes.h:313
char * comment
ObjectType objtype
NodeTag type
Node * object
int cterefcount pg_node_attr(query_jumble_ignore)
List *aliascolnames pg_node_attr(query_jumble_ignore)
List *ctecoltypes pg_node_attr(query_jumble_ignore)
CTECycleClause *cycle_clause pg_node_attr(query_jumble_ignore)
List *ctecoltypmods pg_node_attr(query_jumble_ignore)
CTESearchClause *search_clause pg_node_attr(query_jumble_ignore)
CTEMaterialize ctematerialized
List *ctecolnames pg_node_attr(query_jumble_ignore)
List *ctecolcollations pg_node_attr(query_jumble_ignore)
ParseLoc location
bool cterecursive pg_node_attr(query_jumble_ignore)
RangeVar * typevar
bool initdeferred
List * exclusions
ParseLoc location
bool reset_default_tblspc
List * keys
List * pk_attrs
List * fk_del_set_cols
bool fk_with_period
Node * where_clause
char * indexname
char generated_kind
char * indexspace
ConstrType contype
char * access_method
Oid old_pktable_oid
bool is_no_inherit
List * options
char fk_upd_action
List * old_conpfeqop
bool is_enforced
char fk_matchtype
bool nulls_not_distinct
bool pk_with_period
char * cooked_expr
bool initially_valid
bool skip_validation
bool without_overlaps
bool deferrable
NodeTag type
Node * raw_expr
char * conname
char generated_when
RangeVar * pktable
List * including
char fk_del_action
List * fk_attrs
bool is_program
RangeVar * relation
List * options
bool is_from
char * filename
NodeTag type
List * attlist
Node * whereClause
Node * query
List * handler_name
TypeName * sourcetype
TypeName * targettype
CoercionContext context
ObjectWithArgs * func
TypeName * typeName
CollateClause * collClause
List * func_options
TypeName * returnType
ObjectWithArgs * name
TypeName * storedtype
TypeName * datatype
RangeVar * table
RoleStmtType stmt_type
RoleSpec * authrole
RangeVar * sequence
List * tableElts
List * nnconstraints
TypeName * ofTypename
OnCommitAction oncommit
List * options
bool if_not_exists
List * inhRelations
RangeVar * relation
char * tablespacename
PartitionSpec * partspec
NodeTag type
PartitionBoundSpec * partbound
char * accessMethod
List * constraints
IntoClause * into
ObjectType objtype
ObjectWithArgs * tosql
ObjectWithArgs * fromsql
List * transitionRels
RangeVar * constrrel
RangeVar * relation
char *name pg_node_attr(query_jumble_ignore)
ParseLoc location pg_node_attr(query_jumble_location)
char * defnamespace
Definition parsenodes.h:859
NodeTag type
Definition parsenodes.h:858
DefElemAction defaction
Definition parsenodes.h:863
char * defname
Definition parsenodes.h:860
ParseLoc location
Definition parsenodes.h:864
Node * arg
Definition parsenodes.h:861
List * definition
List * defnames
List * args
NodeTag type
ObjectType kind
bool if_not_exists
ReturningClause * returningClause
WithClause * withClause
Node * whereClause
RangeVar * relation
List * usingClause
ForPortionOfClause * forPortionOf
NodeTag type
NodeTag type
DiscardMode target
NodeTag type
List * args
DropBehavior behavior
bool missing_ok
List * objects
ObjectType removeType
bool concurrent
DropBehavior behavior
NodeTag type
DropBehavior behavior
List * options
char * dbname
bool missing_ok
NodeTag type
List * params
NodeTag type
NodeTag type
List * options
long howMany pg_node_attr(query_jumble_ignore)
ParseLoc location pg_node_attr(query_jumble_location)
FetchDirection direction
char * portalname
FetchDirectionKeywords direction_keyword
NodeTag type
Definition value.h:48
ParseLoc target_location
bool agg_within_group
Definition parsenodes.h:460
CoercionForm funcformat
Definition parsenodes.h:464
Node * agg_filter
Definition parsenodes.h:457
List * agg_order
Definition parsenodes.h:456
List * funcname
Definition parsenodes.h:454
List * args
Definition parsenodes.h:455
bool agg_star
Definition parsenodes.h:461
int ignore_nulls
Definition parsenodes.h:459
bool agg_distinct
Definition parsenodes.h:462
NodeTag type
Definition parsenodes.h:453
ParseLoc location
Definition parsenodes.h:465
bool func_variadic
Definition parsenodes.h:463
struct WindowDef * over
Definition parsenodes.h:458
TypeName * argType
FunctionParameterMode mode
DropBehavior behavior
RoleSpec * grantor
List * grantee_roles
List * granted_roles
ObjectType objtype
bool is_grant
List * objects
bool grant_option
List * grantees
List * privileges
GrantTargetType targtype
NodeTag type
DropBehavior behavior
RoleSpec * grantor
GraphElementPatternKind kind
const char * variable
Node * whereClause
List * path_pattern_list
NodeTag type
List * content
GroupingSetKind kind pg_node_attr(query_jumble_ignore)
ParseLoc location
ImportForeignSchemaType list_type
Node * expr
Definition parsenodes.h:828
SortByDir ordering
Definition parsenodes.h:833
List * opclassopts
Definition parsenodes.h:832
NodeTag type
Definition parsenodes.h:826
char * indexcolname
Definition parsenodes.h:829
ParseLoc location
Definition parsenodes.h:835
SortByNulls nulls_ordering
Definition parsenodes.h:834
List * opclass
Definition parsenodes.h:831
char * name
Definition parsenodes.h:827
List * collation
Definition parsenodes.h:830
bool reset_default_tblspc
NodeTag type
bool deferrable
List * indexParams
bool initdeferred
RangeVar * relation
SubTransactionId oldFirstRelfilelocatorSubid
bool iswithoutoverlaps
bool transformed
List * options
char * tableSpace
SubTransactionId oldCreateSubid
bool isconstraint
List * excludeOpNames
bool nulls_not_distinct
bool concurrent
char * idxname
Node * whereClause
bool if_not_exists
char * accessMethod
char * idxcomment
RelFileNumber oldNumber
List * indexIncludingParams
NodeTag type
ParseLoc location
char * conname
List * indexElems
Node * whereClause
pg_node_attr(nodetag_only) NodeTag type
OnConflictClause * onConflictClause
Node * selectStmt
ReturningClause * returningClause
WithClause * withClause
NodeTag type
RangeVar * relation
List * cols
struct WindowDef * over
JsonOutput * output
JsonValueExpr * val
bool absent_on_null
JsonValueExpr * arg
JsonAggConstructor * constructor
JsonOutput * output
JsonOutput * output
char * column_name
JsonWrapper wrapper
JsonQuotes quotes
JsonExprOp op
JsonBehavior * on_empty
ParseLoc location
Node * pathspec
JsonBehavior * on_error
JsonValueExpr * context_item
JsonValueExpr * value
JsonAggConstructor * constructor
JsonKeyValue * arg
JsonReturning * returning
TypeName * typeName
NodeTag type
JsonValueExpr * expr
ParseLoc location
JsonOutput * output
ParseLoc location
JsonOutput * output
JsonOutput * output
JsonValueExpr * expr
ParseLoc location
JsonTableColumnType coltype
JsonBehavior * on_empty
JsonWrapper wrapper
JsonBehavior * on_error
JsonQuotes quotes
JsonFormat * format
TypeName * typeName
JsonTablePathSpec * pathspec
ParseLoc name_location
JsonBehavior * on_error
List * columns
JsonTablePathSpec * pathspec
Alias * alias
NodeTag type
List * passing
JsonValueExpr * context_item
ParseLoc location
Definition pg_list.h:54
NodeTag type
char * conditionname
NodeTag type
char * filename
NodeTag type
bool nowait
List * relations
List * lockedRels
Definition parsenodes.h:879
LockClauseStrength strength
Definition parsenodes.h:880
LockWaitPolicy waitPolicy
Definition parsenodes.h:881
ReturningClause * returningClause
Node * sourceRelation
List * mergeWhenClauses
RangeVar * relation
Node * joinCondition
WithClause * withClause
NodeTag type
CmdType commandType
MergeMatchKind matchKind
Definition nodes.h:135
char * payload
char * conditionname
NodeTag type
InferClause * infer
OnConflictAction action
LockClauseStrength lockStrength
SelectStmt * val
ParseLoc location
List * indirection
ParseLoc location
Definition parsenodes.h:325
NodeTag type
Definition parsenodes.h:323
PartitionBoundSpec * bound
List * partlist
RangeVar * name
List * collation
Definition parsenodes.h:910
ParseLoc location
Definition parsenodes.h:912
PartitionRangeDatumKind kind
Definition parsenodes.h:978
List * partParams
Definition parsenodes.h:931
ParseLoc location
Definition parsenodes.h:932
PartitionStrategy strategy
Definition parsenodes.h:930
List * argtypes
NodeTag type
List * edestvertexcols
char * esrcvertex
RangeVar * etable
char * edestvertex
ParseLoc location
List * esrcvertexcols
struct PropGraphProperties * properties
ParseLoc location
RangeVar * vtable
PublicationAllObjType pubobjtype
PublicationObjSpecType pubobjtype
PublicationTable * pubtable
RangeVar * relation
List * rowMarks
Definition parsenodes.h:237
int mergeTargetRelation pg_node_attr(query_jumble_ignore)
bool hasAggs pg_node_attr(query_jumble_ignore)
bool groupDistinct
Definition parsenodes.h:220
bool hasRecursive pg_node_attr(query_jumble_ignore)
Node * mergeJoinCondition
Definition parsenodes.h:199
Node * limitCount
Definition parsenodes.h:234
FromExpr * jointree
Definition parsenodes.h:185
List * returningList
Definition parsenodes.h:217
bool canSetTag pg_node_attr(query_jumble_ignore)
Node * setOperations
Definition parsenodes.h:239
bool hasSubLinks pg_node_attr(query_jumble_ignore)
List * cteList
Definition parsenodes.h:176
OnConflictExpr * onConflict
Definition parsenodes.h:206
char *returningOldAlias pg_node_attr(query_jumble_ignore)
OverridingKind override pg_node_attr(query_jumble_ignore)
ForPortionOfExpr * forPortionOf
Definition parsenodes.h:151
List * groupClause
Definition parsenodes.h:219
List *rteperminfos pg_node_attr(query_jumble_ignore)
bool hasTargetSRFs pg_node_attr(query_jumble_ignore)
bool hasGroupRTE pg_node_attr(query_jumble_ignore)
int resultRelation pg_node_attr(query_jumble_ignore)
Node * havingQual
Definition parsenodes.h:225
List * rtable
Definition parsenodes.h:178
List *withCheckOptions pg_node_attr(query_jumble_ignore)
ParseLoc stmt_len pg_node_attr(query_jumble_ignore)
bool hasDistinctOn pg_node_attr(query_jumble_ignore)
Node * limitOffset
Definition parsenodes.h:233
List *constraintDeps pg_node_attr(query_jumble_ignore)
bool isReturn pg_node_attr(query_jumble_ignore)
bool hasWindowFuncs pg_node_attr(query_jumble_ignore)
CmdType commandType
Definition parsenodes.h:121
LimitOption limitOption
Definition parsenodes.h:235
Node * utilityStmt
Definition parsenodes.h:141
List * mergeActionList
Definition parsenodes.h:188
bool hasModifyingCTE pg_node_attr(query_jumble_ignore)
NodeTag type
Definition parsenodes.h:119
List * windowClause
Definition parsenodes.h:227
List * targetList
Definition parsenodes.h:201
List * groupingSets
Definition parsenodes.h:223
bool groupByAll
Definition parsenodes.h:221
List * distinctClause
Definition parsenodes.h:229
bool hasForUpdate pg_node_attr(query_jumble_ignore)
List * sortClause
Definition parsenodes.h:231
char *returningNewAlias pg_node_attr(query_jumble_ignore)
ParseLoc stmt_location
Definition parsenodes.h:258
int64 queryId pg_node_attr(equal_ignore, query_jumble_ignore, read_write_ignore, read_as(0))
bool hasRowSecurity pg_node_attr(query_jumble_ignore)
QuerySource querySource pg_node_attr(query_jumble_ignore)
Bitmapset * selectedCols
Bitmapset * insertedCols
Bitmapset * updatedCols
Alias * alias
Definition parsenodes.h:675
List * coldeflist
Definition parsenodes.h:676
List * functions
Definition parsenodes.h:674
struct GraphPattern * graph_pattern
Definition parsenodes.h:723
ParseLoc location
Definition parsenodes.h:726
RangeVar * graph_name
Definition parsenodes.h:722
TypeName * typeName
Definition parsenodes.h:708
List * namespaces
Definition parsenodes.h:692
ParseLoc location
Definition parsenodes.h:695
ParseLoc location
Definition parsenodes.h:746
List *colcollations pg_node_attr(query_jumble_ignore)
List *joinrightcols pg_node_attr(query_jumble_ignore)
Cardinality enrtuples pg_node_attr(query_jumble_ignore)
TableFunc * tablefunc
Alias *alias pg_node_attr(query_jumble_ignore)
List *joinleftcols pg_node_attr(query_jumble_ignore)
bool inFromCl pg_node_attr(query_jumble_ignore)
bool lateral pg_node_attr(query_jumble_ignore)
List *joinaliasvars pg_node_attr(query_jumble_ignore)
bool security_barrier pg_node_attr(query_jumble_ignore)
struct TableSampleClause * tablesample
Alias *eref pg_node_attr(custom_query_jumble)
Query * subquery
List * groupexprs
List *coltypmods pg_node_attr(query_jumble_ignore)
List * values_lists
List *securityQuals pg_node_attr(query_jumble_ignore)
JoinType jointype
int rellockmode pg_node_attr(query_jumble_ignore)
pg_node_attr(custom_read_write) NodeTag type
char relkind pg_node_attr(query_jumble_ignore)
List * graph_table_columns
int joinmergedcols pg_node_attr(query_jumble_ignore)
GraphPattern * graph_pattern
Index perminfoindex pg_node_attr(query_jumble_ignore)
bool self_reference pg_node_attr(query_jumble_ignore)
List *coltypes pg_node_attr(query_jumble_ignore)
Oid relid pg_node_attr(query_jumble_ignore)
RTEKind rtekind
Alias *join_using_alias pg_node_attr(query_jumble_ignore)
List *funccolcollations pg_node_attr(query_jumble_ignore)
Bitmapset *funcparams pg_node_attr(query_jumble_ignore)
List *funccolnames pg_node_attr(query_jumble_ignore)
int funccolcount pg_node_attr(query_jumble_ignore)
List *funccoltypes pg_node_attr(query_jumble_ignore)
List *funccoltypmods pg_node_attr(query_jumble_ignore)
ParseLoc stmt_location
ParseLoc stmt_len
pg_node_attr(no_query_jumble) NodeTag type
Node * stmt
RoleSpec * newrole
RangeVar * relation
const char * name
ReindexObjectType kind
RangeVar * relation
List * params
NodeTag type
RangeVar * relation
bool missing_ok
ObjectType relationType
DropBehavior behavior
ObjectType renameType
NodeTag type
char * newname
char * subname
Node * object
bool usingindex
NodeTag type
VacuumRelation * relation
List * params
char * indexname
RepackCommand command
Node * val
Definition parsenodes.h:550
ParseLoc location
Definition parsenodes.h:551
List * indirection
Definition parsenodes.h:549
char * name
Definition parsenodes.h:548
NodeTag type
Definition parsenodes.h:547
NodeTag type
Node * returnval
ReturningOptionKind option
ParseLoc location
ParseLoc location
Definition parsenodes.h:434
RoleSpecType roletype
Definition parsenodes.h:432
NodeTag type
Definition parsenodes.h:431
char * rolename
Definition parsenodes.h:433
LockClauseStrength strength
LockWaitPolicy waitPolicy
char * rulename
Node * whereClause
bool instead
RangeVar * relation
bool replace
CmdType event
List * actions
NodeTag type
ObjectType objtype
char * provider
LimitOption limitOption
List * sortClause
List * targetList
IntoClause * intoClause
Node * limitOffset
bool groupDistinct
List * fromClause
bool groupByAll
NodeTag type
List * groupClause
Node * havingClause
List * lockingClause
Node * limitCount
List * windowClause
List * distinctClause
List * valuesLists
struct SelectStmt * larg
struct SelectStmt * rarg
Node * whereClause
SetOperation op
WithClause * withClause
List *colCollations pg_node_attr(query_jumble_ignore)
List *colTypes pg_node_attr(query_jumble_ignore)
List *groupClauses pg_node_attr(query_jumble_ignore)
List *colTypmods pg_node_attr(query_jumble_ignore)
SetOperation op
PartitionBoundSpec * bound
Definition parsenodes.h:994
SortByNulls sortby_nulls
Definition parsenodes.h:579
Node * node
Definition parsenodes.h:577
NodeTag type
Definition parsenodes.h:576
List * useOp
Definition parsenodes.h:580
SortByDir sortby_dir
Definition parsenodes.h:578
ParseLoc location
Definition parsenodes.h:581
bool hashable pg_node_attr(query_jumble_ignore)
NodeTag type
char * name
Node * expr
Definition value.h:64
RangeVar * relation
Definition parsenodes.h:798
TransactionStmtKind kind
ParseLoc location pg_node_attr(query_jumble_location)
char *savepoint_name pg_node_attr(query_jumble_ignore)
char *gid pg_node_attr(query_jumble_ignore)
List * relations
DropBehavior behavior
TypeName * typeName
Definition parsenodes.h:402
ParseLoc location
Definition parsenodes.h:403
Node * arg
Definition parsenodes.h:401
NodeTag type
Definition parsenodes.h:400
bool setof
Definition parsenodes.h:290
Oid typeOid
Definition parsenodes.h:289
bool pct_type
Definition parsenodes.h:291
List * names
Definition parsenodes.h:288
NodeTag type
Definition parsenodes.h:287
List * arrayBounds
Definition parsenodes.h:294
int32 typemod
Definition parsenodes.h:293
ParseLoc location
Definition parsenodes.h:295
List * typmods
Definition parsenodes.h:292
char * conditionname
List * targetList
ForPortionOfClause * forPortionOf
List * fromClause
NodeTag type
Node * whereClause
ReturningClause * returningClause
RangeVar * relation
WithClause * withClause
RangeVar * relation
NodeTag type
List * options
bool is_vacuumcmd
List * rels
ParseLoc location pg_node_attr(query_jumble_location)
VariableSetKind kind
pg_node_attr(custom_query_jumble) NodeTag type
bool replace
List * options
Node * query
List * aliases
RangeVar * view
NodeTag type
ViewCheckOption withCheckOption
NodeTag type
List * options
char * lsn_literal
bool inRangeNullsFirst pg_node_attr(query_jumble_ignore)
bool inRangeAsc pg_node_attr(query_jumble_ignore)
Node * startOffset
Oid inRangeColl pg_node_attr(query_jumble_ignore)
List * partitionClause
bool copiedOrder pg_node_attr(query_jumble_ignore)
char *refname pg_node_attr(query_jumble_ignore)
Oid startInRangeFunc pg_node_attr(query_jumble_ignore)
Oid endInRangeFunc pg_node_attr(query_jumble_ignore)
char *name pg_node_attr(query_jumble_ignore)
Node * endOffset
List * orderClause
List * orderClause
Definition parsenodes.h:598
ParseLoc location
Definition parsenodes.h:602
NodeTag type
Definition parsenodes.h:594
List * partitionClause
Definition parsenodes.h:597
Node * startOffset
Definition parsenodes.h:600
char * refname
Definition parsenodes.h:596
Node * endOffset
Definition parsenodes.h:601
int frameOptions
Definition parsenodes.h:599
char * name
Definition parsenodes.h:595
List * ctes
NodeTag type
ParseLoc location
ParseLoc location
Definition parsenodes.h:894
TypeName * typeName
Definition parsenodes.h:892
NodeTag type
Definition parsenodes.h:889
XmlOptionType xmloption
Definition parsenodes.h:890
BitString bsval
Definition parsenodes.h:382
Node node
Definition parsenodes.h:377
Float fval
Definition parsenodes.h:379
String sval
Definition parsenodes.h:381
Boolean boolval
Definition parsenodes.h:380
Integer ival
Definition parsenodes.h:378
const char * type
const char * name