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 /* has aggregates in tlist or havingQual */
152 /* has window functions in tlist */
154 /* has set-returning functions in tlist */
156 /* has subquery SubLink */
158 /* distinctClause is from DISTINCT ON */
160 /* WITH RECURSIVE was specified */
162 /* has INSERT/UPDATE/DELETE/MERGE in WITH */
163 bool hasModifyingCTE pg_node_attr(query_jumble_ignore);
164 /* FOR [KEY] UPDATE/SHARE was specified */
166 /* rewriter has applied some RLS policy */
167 bool hasRowSecurity pg_node_attr(query_jumble_ignore);
168 /* parser has added an RTE_GROUP RTE */
170 /* is a RETURN statement */
172
173 List *cteList; /* WITH list (of CommonTableExpr's) */
174
175 List *rtable; /* list of range table entries */
176
177 /*
178 * list of RTEPermissionInfo nodes for the rtable entries having
179 * perminfoindex > 0
180 */
182 FromExpr *jointree; /* table join tree (FROM and WHERE clauses);
183 * also USING clause for MERGE */
184
185 List *mergeActionList; /* list of actions for MERGE (only) */
186
187 /*
188 * rtable index of target relation for MERGE to pull data. Initially, this
189 * is the same as resultRelation, but after query rewriting, if the target
190 * relation is a trigger-updatable view, this is the index of the expanded
191 * view subquery, whereas resultRelation is the index of the target view.
192 */
194
195 /* join condition between source and target for MERGE */
197
198 List *targetList; /* target list (of TargetEntry) */
199
200 /* OVERRIDING clause */
202
203 OnConflictExpr *onConflict; /* ON CONFLICT DO NOTHING/SELECT/UPDATE */
204
205 /*
206 * The following three fields describe the contents of the RETURNING list
207 * for INSERT/UPDATE/DELETE/MERGE. returningOldAlias and returningNewAlias
208 * are the alias names for OLD and NEW, which may be user-supplied values,
209 * the defaults "old" and "new", or NULL (if the default "old"/"new" is
210 * already in use as the alias for some other relation).
211 */
212 char *returningOldAlias pg_node_attr(query_jumble_ignore);
213 char *returningNewAlias pg_node_attr(query_jumble_ignore);
214 List *returningList; /* return-values list (of TargetEntry) */
215
216 List *groupClause; /* a list of SortGroupClause's */
217 bool groupDistinct; /* was GROUP BY DISTINCT used? */
218 bool groupByAll; /* was GROUP BY ALL used? */
219
220 List *groupingSets; /* a list of GroupingSet's if present */
221
222 Node *havingQual; /* qualifications applied to groups */
223
224 List *windowClause; /* a list of WindowClause's */
225
226 List *distinctClause; /* a list of SortGroupClause's */
227
228 List *sortClause; /* a list of SortGroupClause's */
229
230 Node *limitOffset; /* # of result tuples to skip (int8 expr) */
231 Node *limitCount; /* # of result tuples to return (int8 expr) */
232 LimitOption limitOption; /* limit type */
233
234 List *rowMarks; /* a list of RowMarkClause's */
235
236 Node *setOperations; /* set-operation tree if this is top level of
237 * a UNION/INTERSECT/EXCEPT query */
238
239 /*
240 * A list of pg_constraint OIDs that the query depends on to be
241 * semantically valid
242 */
244
245 /* a list of WithCheckOption's (added during rewrite) */
247
248 /*
249 * The following two fields identify the portion of the source text string
250 * containing this query. They are typically only populated in top-level
251 * Queries, not in sub-queries. When not set, they might both be zero, or
252 * both be -1 meaning "unknown".
253 */
254 /* start location, or -1 if unknown */
256 /* length in bytes; 0 means "rest of string" */
259
260
261/****************************************************************************
262 * Supporting data structures for Parse Trees
263 *
264 * Most of these node types appear in raw parsetrees output by the grammar,
265 * and get transformed to something else by the analyzer. A few of them
266 * are used as-is in transformed querytrees.
267 ****************************************************************************/
268
269/*
270 * TypeName - specifies a type in definitions
271 *
272 * For TypeName structures generated internally, it is often easier to
273 * specify the type by OID than by name. If "names" is NIL then the
274 * actual type OID is given by typeOid, otherwise typeOid is unused.
275 * Similarly, if "typmods" is NIL then the actual typmod is expected to
276 * be prespecified in typemod, otherwise typemod is unused.
277 *
278 * If pct_type is true, then names is actually a field name and we look up
279 * the type of that field. Otherwise (the normal case), names is a type
280 * name possibly qualified with schema and database name.
281 */
282typedef struct TypeName
283{
285 List *names; /* qualified name (list of String nodes) */
286 Oid typeOid; /* type identified by OID */
287 bool setof; /* is a set? */
288 bool pct_type; /* %TYPE specified? */
289 List *typmods; /* type modifier expression(s) */
290 int32 typemod; /* prespecified type modifier */
291 List *arrayBounds; /* array bounds */
292 ParseLoc location; /* token location, or -1 if unknown */
294
295/*
296 * ColumnRef - specifies a reference to a column, or possibly a whole tuple
297 *
298 * The "fields" list must be nonempty. It can contain String nodes
299 * (representing names) and A_Star nodes (representing occurrence of a '*').
300 * Currently, A_Star must appear only as the last list element --- the grammar
301 * is responsible for enforcing this!
302 *
303 * Note: any container subscripting or selection of fields from composite columns
304 * is represented by an A_Indirection node above the ColumnRef. However,
305 * for simplicity in the normal case, initial field selection from a table
306 * name is represented within ColumnRef and not by adding A_Indirection.
307 */
308typedef struct ColumnRef
309{
311 List *fields; /* field names (String nodes) or A_Star */
312 ParseLoc location; /* token location, or -1 if unknown */
314
315/*
316 * ParamRef - specifies a $n parameter reference
317 */
318typedef struct ParamRef
319{
321 int number; /* the number of the parameter */
322 ParseLoc location; /* token location, or -1 if unknown */
324
325/*
326 * A_Expr - infix, prefix, and postfix expressions
327 */
328typedef enum A_Expr_Kind
329{
330 AEXPR_OP, /* normal operator */
331 AEXPR_OP_ANY, /* scalar op ANY (array) */
332 AEXPR_OP_ALL, /* scalar op ALL (array) */
333 AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */
334 AEXPR_NOT_DISTINCT, /* IS NOT DISTINCT FROM - name must be "=" */
335 AEXPR_NULLIF, /* NULLIF - name must be "=" */
336 AEXPR_IN, /* [NOT] IN - name must be "=" or "<>" */
337 AEXPR_LIKE, /* [NOT] LIKE - name must be "~~" or "!~~" */
338 AEXPR_ILIKE, /* [NOT] ILIKE - name must be "~~*" or "!~~*" */
339 AEXPR_SIMILAR, /* [NOT] SIMILAR - name must be "~" or "!~" */
340 AEXPR_BETWEEN, /* name must be "BETWEEN" */
341 AEXPR_NOT_BETWEEN, /* name must be "NOT BETWEEN" */
342 AEXPR_BETWEEN_SYM, /* name must be "BETWEEN SYMMETRIC" */
343 AEXPR_NOT_BETWEEN_SYM, /* name must be "NOT BETWEEN SYMMETRIC" */
345
346typedef struct A_Expr
347{
349
351 A_Expr_Kind kind; /* see above */
352 List *name; /* possibly-qualified name of operator */
353 Node *lexpr; /* left argument, or NULL if none */
354 Node *rexpr; /* right argument, or NULL if none */
355
356 /*
357 * If rexpr is a list of some kind, we separately track its starting and
358 * ending location; it's not the same as the starting and ending location
359 * of the token itself.
360 */
363 ParseLoc location; /* token location, or -1 if unknown */
365
366/*
367 * A_Const - a literal constant
368 *
369 * Value nodes are inline for performance. You can treat 'val' as a node,
370 * as in IsA(&val, Integer). 'val' is not valid if isnull is true.
371 */
381
382typedef struct A_Const
383{
385
388 bool isnull; /* SQL NULL constant */
389 ParseLoc location; /* token location, or -1 if unknown */
391
392/*
393 * TypeCast - a CAST expression
394 */
395typedef struct TypeCast
396{
398 Node *arg; /* the expression being casted */
399 TypeName *typeName; /* the target type */
400 ParseLoc location; /* token location, or -1 if unknown */
402
403/*
404 * CollateClause - a COLLATE expression
405 */
406typedef struct CollateClause
407{
409 Node *arg; /* input expression */
410 List *collname; /* possibly-qualified collation name */
411 ParseLoc location; /* token location, or -1 if unknown */
413
414/*
415 * RoleSpec - a role name or one of a few special values.
416 */
417typedef enum RoleSpecType
418{
419 ROLESPEC_CSTRING, /* role name is stored as a C string */
420 ROLESPEC_CURRENT_ROLE, /* role spec is CURRENT_ROLE */
421 ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
422 ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
423 ROLESPEC_PUBLIC, /* role name is "public" */
425
426typedef struct RoleSpec
427{
429 RoleSpecType roletype; /* Type of this rolespec */
430 char *rolename; /* filled only for ROLESPEC_CSTRING */
431 ParseLoc location; /* token location, or -1 if unknown */
433
434/*
435 * FuncCall - a function or aggregate invocation
436 *
437 * agg_order (if not NIL) indicates we saw 'foo(... ORDER BY ...)', or if
438 * agg_within_group is true, it was 'foo(...) WITHIN GROUP (ORDER BY ...)'.
439 * agg_star indicates we saw a 'foo(*)' construct, while agg_distinct
440 * indicates we saw 'foo(DISTINCT ...)'. In any of these cases, the
441 * construct *must* be an aggregate call. Otherwise, it might be either an
442 * aggregate or some other kind of function. However, if FILTER or OVER is
443 * present it had better be an aggregate or window function.
444 *
445 * Normally, you'd initialize this via makeFuncCall() and then only change the
446 * parts of the struct its defaults don't match afterwards, as needed.
447 */
448typedef struct FuncCall
449{
451 List *funcname; /* qualified name of function */
452 List *args; /* the arguments (list of exprs) */
453 List *agg_order; /* ORDER BY (list of SortBy) */
454 Node *agg_filter; /* FILTER clause, if any */
455 struct WindowDef *over; /* OVER clause, if any */
456 int ignore_nulls; /* ignore nulls for window function */
457 bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */
458 bool agg_star; /* argument was really '*' */
459 bool agg_distinct; /* arguments were labeled DISTINCT */
460 bool func_variadic; /* last argument was labeled VARIADIC */
461 CoercionForm funcformat; /* how to display this node */
462 ParseLoc location; /* token location, or -1 if unknown */
464
465/*
466 * A_Star - '*' representing all columns of a table or compound field
467 *
468 * This can appear within ColumnRef.fields, A_Indirection.indirection, and
469 * ResTarget.indirection lists.
470 */
471typedef struct A_Star
472{
475
476/*
477 * A_Indices - array subscript or slice bounds ([idx] or [lidx:uidx])
478 *
479 * In slice case, either or both of lidx and uidx can be NULL (omitted).
480 * In non-slice case, uidx holds the single subscript and lidx is always NULL.
481 */
482typedef struct A_Indices
483{
485 bool is_slice; /* true if slice (i.e., colon present) */
486 Node *lidx; /* slice lower bound, if any */
487 Node *uidx; /* subscript, or slice upper bound if any */
489
490/*
491 * A_Indirection - select a field and/or array element from an expression
492 *
493 * The indirection list can contain A_Indices nodes (representing
494 * subscripting), String nodes (representing field selection --- the
495 * string value is the name of the field to select), and A_Star nodes
496 * (representing selection of all fields of a composite type).
497 * For example, a complex selection operation like
498 * (foo).field1[42][7].field2
499 * would be represented with a single A_Indirection node having a 4-element
500 * indirection list.
501 *
502 * Currently, A_Star must appear only as the last list element --- the grammar
503 * is responsible for enforcing this!
504 */
505typedef struct A_Indirection
506{
508 Node *arg; /* the thing being selected from */
509 List *indirection; /* subscripts and/or field names and/or * */
511
512/*
513 * A_ArrayExpr - an ARRAY[] construct
514 */
515typedef struct A_ArrayExpr
516{
518 List *elements; /* array element expressions */
519 ParseLoc list_start; /* start of the element list */
520 ParseLoc list_end; /* end of the elements list */
521 ParseLoc location; /* token location, or -1 if unknown */
523
524/*
525 * ResTarget -
526 * result target (used in target list of pre-transformed parse trees)
527 *
528 * In a SELECT target list, 'name' is the column label from an
529 * 'AS ColumnLabel' clause, or NULL if there was none, and 'val' is the
530 * value expression itself. The 'indirection' field is not used.
531 *
532 * INSERT uses ResTarget in its target-column-names list. Here, 'name' is
533 * the name of the destination column, 'indirection' stores any subscripts
534 * attached to the destination, and 'val' is not used.
535 *
536 * In an UPDATE target list, 'name' is the name of the destination column,
537 * 'indirection' stores any subscripts attached to the destination, and
538 * 'val' is the expression to assign.
539 *
540 * See A_Indirection for more info about what can appear in 'indirection'.
541 */
542typedef struct ResTarget
543{
545 char *name; /* column name or NULL */
546 List *indirection; /* subscripts, field names, and '*', or NIL */
547 Node *val; /* the value expression to compute or assign */
548 ParseLoc location; /* token location, or -1 if unknown */
550
551/*
552 * MultiAssignRef - element of a row source expression for UPDATE
553 *
554 * In an UPDATE target list, when we have SET (a,b,c) = row-valued-expression,
555 * we generate separate ResTarget items for each of a,b,c. Their "val" trees
556 * are MultiAssignRef nodes numbered 1..n, linking to a common copy of the
557 * row-valued-expression (which parse analysis will process only once, when
558 * handling the MultiAssignRef with colno=1).
559 */
560typedef struct MultiAssignRef
561{
563 Node *source; /* the row-valued expression */
564 int colno; /* column number for this target (1..n) */
565 int ncolumns; /* number of targets in the construct */
567
568/*
569 * SortBy - for ORDER BY clause
570 */
571typedef struct SortBy
572{
574 Node *node; /* expression to sort on */
575 SortByDir sortby_dir; /* ASC/DESC/USING/default */
576 SortByNulls sortby_nulls; /* NULLS FIRST/LAST */
577 List *useOp; /* name of op to use, if SORTBY_USING */
578 ParseLoc location; /* operator location, or -1 if none/unknown */
580
581/*
582 * WindowDef - raw representation of WINDOW and OVER clauses
583 *
584 * For entries in a WINDOW list, "name" is the window name being defined.
585 * For OVER clauses, we use "name" for the "OVER window" syntax, or "refname"
586 * for the "OVER (window)" syntax, which is subtly different --- the latter
587 * implies overriding the window frame clause.
588 */
589typedef struct WindowDef
590{
592 char *name; /* window's own name */
593 char *refname; /* referenced window name, if any */
594 List *partitionClause; /* PARTITION BY expression list */
595 List *orderClause; /* ORDER BY (list of SortBy) */
596 int frameOptions; /* frame_clause options, see below */
597 Node *startOffset; /* expression for starting bound, if any */
598 Node *endOffset; /* expression for ending bound, if any */
599 ParseLoc location; /* parse location, or -1 if none/unknown */
601
602/*
603 * frameOptions is an OR of these bits. The NONDEFAULT and BETWEEN bits are
604 * used so that ruleutils.c can tell which properties were specified and
605 * which were defaulted; the correct behavioral bits must be set either way.
606 * The START_foo and END_foo options must come in pairs of adjacent bits for
607 * the convenience of gram.y, even though some of them are useless/invalid.
608 */
609#define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */
610#define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */
611#define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */
612#define FRAMEOPTION_GROUPS 0x00008 /* GROUPS behavior */
613#define FRAMEOPTION_BETWEEN 0x00010 /* BETWEEN given? */
614#define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00020 /* start is U. P. */
615#define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00040 /* (disallowed) */
616#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00080 /* (disallowed) */
617#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00100 /* end is U. F. */
618#define FRAMEOPTION_START_CURRENT_ROW 0x00200 /* start is C. R. */
619#define FRAMEOPTION_END_CURRENT_ROW 0x00400 /* end is C. R. */
620#define FRAMEOPTION_START_OFFSET_PRECEDING 0x00800 /* start is O. P. */
621#define FRAMEOPTION_END_OFFSET_PRECEDING 0x01000 /* end is O. P. */
622#define FRAMEOPTION_START_OFFSET_FOLLOWING 0x02000 /* start is O. F. */
623#define FRAMEOPTION_END_OFFSET_FOLLOWING 0x04000 /* end is O. F. */
624#define FRAMEOPTION_EXCLUDE_CURRENT_ROW 0x08000 /* omit C.R. */
625#define FRAMEOPTION_EXCLUDE_GROUP 0x10000 /* omit C.R. & peers */
626#define FRAMEOPTION_EXCLUDE_TIES 0x20000 /* omit C.R.'s peers */
627
628#define FRAMEOPTION_START_OFFSET \
629 (FRAMEOPTION_START_OFFSET_PRECEDING | FRAMEOPTION_START_OFFSET_FOLLOWING)
630#define FRAMEOPTION_END_OFFSET \
631 (FRAMEOPTION_END_OFFSET_PRECEDING | FRAMEOPTION_END_OFFSET_FOLLOWING)
632#define FRAMEOPTION_EXCLUSION \
633 (FRAMEOPTION_EXCLUDE_CURRENT_ROW | FRAMEOPTION_EXCLUDE_GROUP | \
634 FRAMEOPTION_EXCLUDE_TIES)
635
636#define FRAMEOPTION_DEFAULTS \
637 (FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \
638 FRAMEOPTION_END_CURRENT_ROW)
639
640/*
641 * RangeSubselect - subquery appearing in a FROM clause
642 */
643typedef struct RangeSubselect
644{
646 bool lateral; /* does it have LATERAL prefix? */
647 Node *subquery; /* the untransformed sub-select clause */
648 Alias *alias; /* table alias & optional column aliases */
650
651/*
652 * RangeFunction - function call appearing in a FROM clause
653 *
654 * functions is a List because we use this to represent the construct
655 * ROWS FROM(func1(...), func2(...), ...). Each element of this list is a
656 * two-element sublist, the first element being the untransformed function
657 * call tree, and the second element being a possibly-empty list of ColumnDef
658 * nodes representing any columndef list attached to that function within the
659 * ROWS FROM() syntax.
660 *
661 * alias and coldeflist represent any alias and/or columndef list attached
662 * at the top level. (We disallow coldeflist appearing both here and
663 * per-function, but that's checked in parse analysis, not by the grammar.)
664 */
665typedef struct RangeFunction
666{
668 bool lateral; /* does it have LATERAL prefix? */
669 bool ordinality; /* does it have WITH ORDINALITY suffix? */
670 bool is_rowsfrom; /* is result of ROWS FROM() syntax? */
671 List *functions; /* per-function information, see above */
672 Alias *alias; /* table alias & optional column aliases */
673 List *coldeflist; /* list of ColumnDef nodes to describe result
674 * of function returning RECORD */
676
677/*
678 * RangeTableFunc - raw form of "table functions" such as XMLTABLE
679 *
680 * Note: JSON_TABLE is also a "table function", but it uses JsonTable node,
681 * not RangeTableFunc.
682 */
683typedef struct RangeTableFunc
684{
686 bool lateral; /* does it have LATERAL prefix? */
687 Node *docexpr; /* document expression */
688 Node *rowexpr; /* row generator expression */
689 List *namespaces; /* list of namespaces as ResTarget */
690 List *columns; /* list of RangeTableFuncCol */
691 Alias *alias; /* table alias & optional column aliases */
692 ParseLoc location; /* token location, or -1 if unknown */
694
695/*
696 * RangeTableFuncCol - one column in a RangeTableFunc->columns
697 *
698 * If for_ordinality is true (FOR ORDINALITY), then the column is an int4
699 * column and the rest of the fields are ignored.
700 */
701typedef struct RangeTableFuncCol
702{
704 char *colname; /* name of generated column */
705 TypeName *typeName; /* type of generated column */
706 bool for_ordinality; /* does it have FOR ORDINALITY? */
707 bool is_not_null; /* does it have NOT NULL? */
708 Node *colexpr; /* column filter expression */
709 Node *coldefexpr; /* column default value expression */
710 ParseLoc location; /* token location, or -1 if unknown */
712
713/*
714 * RangeGraphTable - raw form of GRAPH_TABLE clause
715 */
716typedef struct RangeGraphTable
717{
722 Alias *alias; /* table alias & optional column aliases */
723 ParseLoc location; /* token location, or -1 if unknown */
725
726/*
727 * RangeTableSample - TABLESAMPLE appearing in a raw FROM clause
728 *
729 * This node, appearing only in raw parse trees, represents
730 * <relation> TABLESAMPLE <method> (<params>) REPEATABLE (<num>)
731 * Currently, the <relation> can only be a RangeVar, but we might in future
732 * allow RangeSubselect and other options. Note that the RangeTableSample
733 * is wrapped around the node representing the <relation>, rather than being
734 * a subfield of it.
735 */
736typedef struct RangeTableSample
737{
739 Node *relation; /* relation to be sampled */
740 List *method; /* sampling method name (possibly qualified) */
741 List *args; /* argument(s) for sampling method */
742 Node *repeatable; /* REPEATABLE expression, or NULL if none */
743 ParseLoc location; /* method name location, or -1 if unknown */
745
746/*
747 * ColumnDef - column definition (used in various creates)
748 *
749 * If the column has a default value, we may have the value expression
750 * in either "raw" form (an untransformed parse tree) or "cooked" form
751 * (a post-parse-analysis, executable expression tree), depending on
752 * how this ColumnDef node was created (by parsing, or by inheritance
753 * from an existing relation). We should never have both in the same node!
754 *
755 * Similarly, we may have a COLLATE specification in either raw form
756 * (represented as a CollateClause with arg==NULL) or cooked form
757 * (the collation's OID).
758 *
759 * The constraints list may contain a CONSTR_DEFAULT item in a raw
760 * parsetree produced by gram.y, but transformCreateStmt will remove
761 * the item and set raw_default instead. CONSTR_DEFAULT items
762 * should not appear in any subsequent processing.
763 */
764typedef struct ColumnDef
765{
767 char *colname; /* name of column */
768 TypeName *typeName; /* type of column */
769 char *compression; /* compression method for column */
770 int16 inhcount; /* number of times column is inherited */
771 bool is_local; /* column has local (non-inherited) def'n */
772 bool is_not_null; /* NOT NULL constraint specified? */
773 bool is_from_type; /* column definition came from table type */
774 char storage; /* attstorage setting, or 0 for default */
775 char *storage_name; /* attstorage setting name or NULL for default */
776 Node *raw_default; /* default value (untransformed parse tree) */
777 Node *cooked_default; /* default value (transformed expr tree) */
778 char identity; /* attidentity setting */
779 RangeVar *identitySequence; /* to store identity sequence name for
780 * ALTER TABLE ... ADD COLUMN */
781 char generated; /* attgenerated setting */
782 CollateClause *collClause; /* untransformed COLLATE spec, if any */
783 Oid collOid; /* collation OID (InvalidOid if not set) */
784 List *constraints; /* other constraints on column */
785 List *fdwoptions; /* per-column FDW options */
786 ParseLoc location; /* parse location, or -1 if none/unknown */
788
789/*
790 * TableLikeClause - CREATE TABLE ( ... LIKE ... ) clause
791 */
792typedef struct TableLikeClause
793{
796 bits32 options; /* OR of TableLikeOption flags */
797 Oid relationOid; /* If table has been looked up, its OID */
799
813
814/*
815 * IndexElem - index parameters (used in CREATE INDEX, and in ON CONFLICT)
816 *
817 * For a plain index attribute, 'name' is the name of the table column to
818 * index, and 'expr' is NULL. For an index expression, 'name' is NULL and
819 * 'expr' is the expression tree.
820 */
821typedef struct IndexElem
822{
824 char *name; /* name of attribute to index, or NULL */
825 Node *expr; /* expression to index, or NULL */
826 char *indexcolname; /* name for index column; NULL = default */
827 List *collation; /* name of collation; NIL = default */
828 List *opclass; /* name of desired opclass; NIL = default */
829 List *opclassopts; /* opclass-specific options, or NIL */
830 SortByDir ordering; /* ASC/DESC/default */
831 SortByNulls nulls_ordering; /* FIRST/LAST/default */
832 ParseLoc location; /* token location, or -1 if unknown */
834
835/*
836 * DefElem - a generic "name = value" option definition
837 *
838 * In some contexts the name can be qualified. Also, certain SQL commands
839 * allow a SET/ADD/DROP action to be attached to option settings, so it's
840 * convenient to carry a field for that too. (Note: currently, it is our
841 * practice that the grammar allows namespace and action only in statements
842 * where they are relevant; C code can just ignore those fields in other
843 * statements.)
844 */
852
853typedef struct DefElem
854{
856 char *defnamespace; /* NULL if unqualified name */
857 char *defname;
858 Node *arg; /* typically Integer, Float, String, or
859 * TypeName */
860 DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */
861 ParseLoc location; /* token location, or -1 if unknown */
863
864/*
865 * LockingClause - raw representation of FOR [NO KEY] UPDATE/[KEY] SHARE
866 * options
867 *
868 * Note: lockedRels == NIL means "all relations in query". Otherwise it
869 * is a list of RangeVar nodes. (We use RangeVar mainly because it carries
870 * a location field --- currently, parse analysis insists on unqualified
871 * names in LockingClause.)
872 */
873typedef struct LockingClause
874{
876 List *lockedRels; /* FOR [KEY] UPDATE/SHARE relations */
878 LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
880
881/*
882 * XMLSERIALIZE (in raw parse tree only)
883 */
884typedef struct XmlSerialize
885{
887 XmlOptionType xmloption; /* DOCUMENT or CONTENT */
890 bool indent; /* [NO] INDENT */
891 ParseLoc location; /* token location, or -1 if unknown */
893
894/* Partitioning related definitions */
895
896/*
897 * PartitionElem - parse-time representation of a single partition key
898 *
899 * expr can be either a raw expression tree or a parse-analyzed expression.
900 * We don't store these on-disk, though.
901 */
902typedef struct PartitionElem
903{
905 char *name; /* name of column to partition on, or NULL */
906 Node *expr; /* expression to partition on, or NULL */
907 List *collation; /* name of collation; NIL = default */
908 List *opclass; /* name of desired opclass; NIL = default */
909 ParseLoc location; /* token location, or -1 if unknown */
911
918
919/*
920 * PartitionSpec - parse-time representation of a partition key specification
921 *
922 * This represents the key space we will be partitioning on.
923 */
924typedef struct PartitionSpec
925{
928 List *partParams; /* List of PartitionElems */
929 ParseLoc location; /* token location, or -1 if unknown */
931
932/*
933 * PartitionBoundSpec - a partition bound specification
934 *
935 * This represents the portion of the partition key space assigned to a
936 * particular partition. These are stored on disk in pg_class.relpartbound.
937 */
939{
941
942 char strategy; /* see PARTITION_STRATEGY codes above */
943 bool is_default; /* is it a default partition bound? */
944
945 /* Partitioning info for HASH strategy: */
948
949 /* Partitioning info for LIST strategy: */
950 List *listdatums; /* List of Consts (or A_Consts in raw tree) */
951
952 /* Partitioning info for RANGE strategy: */
953 List *lowerdatums; /* List of PartitionRangeDatums */
954 List *upperdatums; /* List of PartitionRangeDatums */
955
956 ParseLoc location; /* token location, or -1 if unknown */
957};
958
959/*
960 * PartitionRangeDatum - one of the values in a range partition bound
961 *
962 * This can be MINVALUE, MAXVALUE or a specific bounded value.
963 */
965{
966 PARTITION_RANGE_DATUM_MINVALUE = -1, /* less than any other value */
967 PARTITION_RANGE_DATUM_VALUE = 0, /* a specific (bounded) value */
968 PARTITION_RANGE_DATUM_MAXVALUE = 1, /* greater than any other value */
970
972{
974
976 Node *value; /* Const (or A_Const in raw tree), if kind is
977 * PARTITION_RANGE_DATUM_VALUE, else NULL */
978
979 ParseLoc location; /* token location, or -1 if unknown */
981
982/*
983 * PartitionDesc - info about a single partition for the ALTER TABLE SPLIT
984 * PARTITION command
985 */
987{
989
990 RangeVar *name; /* name of partition */
991 PartitionBoundSpec *bound; /* FOR VALUES, if attaching */
993
994/*
995 * PartitionCmd - info for ALTER TABLE/INDEX ATTACH/DETACH PARTITION and for
996 * ALTER TABLE SPLIT/MERGE PARTITION(S) commands
997 */
998typedef struct PartitionCmd
999{
1001
1002 /* name of partition to attach/detach/merge/split */
1004
1005 /* FOR VALUES, if attaching */
1007
1008 /*
1009 * list of partitions to be split/merged, used in ALTER TABLE MERGE
1010 * PARTITIONS and ALTER TABLE SPLIT PARTITIONS. For merge partitions,
1011 * partlist is a list of RangeVar; For split partition, it is a list of
1012 * SinglePartitionSpec.
1013 */
1015
1018
1019/*
1020 * Nodes for graph pattern
1021 */
1022
1029
1038
1039#define IS_EDGE_PATTERN(kind) ((kind) == EDGE_PATTERN_ANY || \
1040 (kind) == EDGE_PATTERN_RIGHT || \
1041 (kind) == EDGE_PATTERN_LEFT)
1042
1054
1055/****************************************************************************
1056 * Nodes for a Query tree
1057 ****************************************************************************/
1058
1059/*--------------------
1060 * RangeTblEntry -
1061 * A range table is a List of RangeTblEntry nodes.
1062 *
1063 * A range table entry may represent a plain relation, a sub-select in
1064 * FROM, or the result of a JOIN clause. (Only explicit JOIN syntax
1065 * produces an RTE, not the implicit join resulting from multiple FROM
1066 * items. This is because we only need the RTE to deal with SQL features
1067 * like outer joins and join-output-column aliasing.) Other special
1068 * RTE types also exist, as indicated by RTEKind.
1069 *
1070 * Note that we consider RTE_RELATION to cover anything that has a pg_class
1071 * entry. relkind distinguishes the sub-cases.
1072 *
1073 * alias is an Alias node representing the AS alias-clause attached to the
1074 * FROM expression, or NULL if no clause.
1075 *
1076 * eref is the table reference name and column reference names (either
1077 * real or aliases). Note that system columns (OID etc) are not included
1078 * in the column list.
1079 * eref->aliasname is required to be present, and should generally be used
1080 * to identify the RTE for error messages etc.
1081 *
1082 * In RELATION RTEs, the colnames in both alias and eref are indexed by
1083 * physical attribute number; this means there must be colname entries for
1084 * dropped columns. When building an RTE we insert empty strings ("") for
1085 * dropped columns. Note however that a stored rule may have nonempty
1086 * colnames for columns dropped since the rule was created (and for that
1087 * matter the colnames might be out of date due to column renamings).
1088 * The same comments apply to FUNCTION RTEs when a function's return type
1089 * is a named composite type.
1090 *
1091 * In JOIN RTEs, the colnames in both alias and eref are one-to-one with
1092 * joinaliasvars entries. A JOIN RTE will omit columns of its inputs when
1093 * those columns are known to be dropped at parse time. Again, however,
1094 * a stored rule might contain entries for columns dropped since the rule
1095 * was created. (This is only possible for columns not actually referenced
1096 * in the rule.) When loading a stored rule, we replace the joinaliasvars
1097 * items for any such columns with null pointers. (We can't simply delete
1098 * them from the joinaliasvars list, because that would affect the attnums
1099 * of Vars referencing the rest of the list.)
1100 *
1101 * inFromCl marks those range variables that are listed in the FROM clause.
1102 * It's false for RTEs that are added to a query behind the scenes, such
1103 * as the NEW and OLD variables for a rule, or the subqueries of a UNION.
1104 * This flag is not used during parsing (except in transformLockingClause,
1105 * q.v.); the parser now uses a separate "namespace" data structure to
1106 * control visibility. But it is needed by ruleutils.c to determine
1107 * whether RTEs should be shown in decompiled queries.
1108 *
1109 * securityQuals is a list of security barrier quals (boolean expressions),
1110 * to be tested in the listed order before returning a row from the
1111 * relation. It is always NIL in parser output. Entries are added by the
1112 * rewriter to implement security-barrier views and/or row-level security.
1113 * Note that the planner turns each boolean expression into an implicitly
1114 * AND'ed sublist, as is its usual habit with qualification expressions.
1115 *--------------------
1116 */
1117typedef enum RTEKind
1118{
1119 RTE_RELATION, /* ordinary relation reference */
1120 RTE_SUBQUERY, /* subquery in FROM */
1121 RTE_JOIN, /* join */
1122 RTE_FUNCTION, /* function in FROM */
1123 RTE_TABLEFUNC, /* TableFunc(.., column list) */
1124 RTE_VALUES, /* VALUES (<exprlist>), (<exprlist>), ... */
1125 RTE_CTE, /* common table expr (WITH list element) */
1126 RTE_NAMEDTUPLESTORE, /* tuplestore, e.g. for AFTER triggers */
1127 RTE_GRAPH_TABLE, /* GRAPH_TABLE clause */
1128 RTE_RESULT, /* RTE represents an empty FROM clause; such
1129 * RTEs are added by the planner, they're not
1130 * present during parsing or rewriting */
1131 RTE_GROUP, /* the grouping step */
1133
1134typedef struct RangeTblEntry
1135{
1137
1138 NodeTag type;
1139
1140 /*
1141 * Fields valid in all RTEs:
1142 *
1143 * put alias + eref first to make dump more legible
1144 */
1145 /* user-written alias clause, if any */
1147
1148 /*
1149 * Expanded reference names. This uses a custom query jumble function so
1150 * that the table name is included in the computation, but not its list of
1151 * columns.
1152 */
1154
1155 RTEKind rtekind; /* see above */
1156
1157 /*
1158 * Fields valid for a plain relation RTE (else zero):
1159 *
1160 * inh is true for relation references that should be expanded to include
1161 * inheritance children, if the rel has any. In the parser, this will
1162 * only be true for RTE_RELATION entries. The planner also uses this
1163 * field to mark RTE_SUBQUERY entries that contain UNION ALL queries that
1164 * it has flattened into pulled-up subqueries (creating a structure much
1165 * like the effects of inheritance).
1166 *
1167 * rellockmode is really LOCKMODE, but it's declared int to avoid having
1168 * to include lock-related headers here. It must be RowExclusiveLock if
1169 * the RTE is an INSERT/UPDATE/DELETE/MERGE target, else RowShareLock if
1170 * the RTE is a SELECT FOR UPDATE/FOR SHARE target, else AccessShareLock.
1171 *
1172 * Note: in some cases, rule expansion may result in RTEs that are marked
1173 * with RowExclusiveLock even though they are not the target of the
1174 * current query; this happens if a DO ALSO rule simply scans the original
1175 * target table. We leave such RTEs with their original lockmode so as to
1176 * avoid getting an additional, lesser lock.
1177 *
1178 * perminfoindex is 1-based index of the RTEPermissionInfo belonging to
1179 * this RTE in the containing struct's list of same; 0 if permissions need
1180 * not be checked for this RTE.
1181 *
1182 * As a special case, relid, relkind, rellockmode, and perminfoindex can
1183 * also be set (nonzero) in an RTE_SUBQUERY RTE. This occurs when we
1184 * convert an RTE_RELATION RTE naming a view into an RTE_SUBQUERY
1185 * containing the view's query. We still need to perform run-time locking
1186 * and permission checks on the view, even though it's not directly used
1187 * in the query anymore, and the most expedient way to do that is to
1188 * retain these fields from the old state of the RTE.
1189 *
1190 * As a special case, RTE_NAMEDTUPLESTORE can also set relid to indicate
1191 * that the tuple format of the tuplestore is the same as the referenced
1192 * relation. This allows plans referencing AFTER trigger transition
1193 * tables to be invalidated if the underlying table is altered.
1194 */
1195 /* OID of the relation */
1197 /* inheritance requested? */
1198 bool inh;
1199 /* relation kind (see pg_class.relkind) */
1201 /* lock level that query requires on the rel */
1203 /* index of RTEPermissionInfo entry, or 0 */
1205 /* sampling info, or NULL */
1207
1208 /*
1209 * Fields valid for a subquery RTE (else NULL):
1210 */
1211 /* the sub-query */
1213 /* is from security_barrier view? */
1214 bool security_barrier pg_node_attr(query_jumble_ignore);
1215
1216 /*
1217 * Fields valid for a join RTE (else NULL/zero):
1218 *
1219 * joinaliasvars is a list of (usually) Vars corresponding to the columns
1220 * of the join result. An alias Var referencing column K of the join
1221 * result can be replaced by the K'th element of joinaliasvars --- but to
1222 * simplify the task of reverse-listing aliases correctly, we do not do
1223 * that until planning time. In detail: an element of joinaliasvars can
1224 * be a Var of one of the join's input relations, or such a Var with an
1225 * implicit coercion to the join's output column type, or a COALESCE
1226 * expression containing the two input column Vars (possibly coerced).
1227 * Elements beyond the first joinmergedcols entries are always just Vars,
1228 * and are never referenced from elsewhere in the query (that is, join
1229 * alias Vars are generated only for merged columns). We keep these
1230 * entries only because they're needed in expandRTE() and similar code.
1231 *
1232 * Vars appearing within joinaliasvars are marked with varnullingrels sets
1233 * that describe the nulling effects of this join and lower ones. This is
1234 * essential for FULL JOIN cases, because the COALESCE expression only
1235 * describes the semantics correctly if its inputs have been nulled by the
1236 * join. For other cases, it allows expandRTE() to generate a valid
1237 * representation of the join's output without consulting additional
1238 * parser state.
1239 *
1240 * Within a Query loaded from a stored rule, it is possible for non-merged
1241 * joinaliasvars items to be null pointers, which are placeholders for
1242 * (necessarily unreferenced) columns dropped since the rule was made.
1243 * Also, once planning begins, joinaliasvars items can be almost anything,
1244 * as a result of subquery-flattening substitutions.
1245 *
1246 * joinleftcols is an integer list of physical column numbers of the left
1247 * join input rel that are included in the join; likewise joinrighttcols
1248 * for the right join input rel. (Which rels those are can be determined
1249 * from the associated JoinExpr.) If the join is USING/NATURAL, then the
1250 * first joinmergedcols entries in each list identify the merged columns.
1251 * The merged columns come first in the join output, then remaining
1252 * columns of the left input, then remaining columns of the right.
1253 *
1254 * Note that input columns could have been dropped after creation of a
1255 * stored rule, if they are not referenced in the query (in particular,
1256 * merged columns could not be dropped); this is not accounted for in
1257 * joinleftcols/joinrighttcols.
1258 */
1260 /* number of merged (JOIN USING) columns */
1262 /* list of alias-var expansions */
1264 /* left-side input column numbers */
1266 /* right-side input column numbers */
1268
1269 /*
1270 * join_using_alias is an alias clause attached directly to JOIN/USING. It
1271 * is different from the alias field (above) in that it does not hide the
1272 * range variables of the tables being joined.
1273 */
1275
1276 /*
1277 * Fields valid for a function RTE (else NIL/zero):
1278 *
1279 * When funcordinality is true, the eref->colnames list includes an alias
1280 * for the ordinality column. The ordinality column is otherwise
1281 * implicit, and must be accounted for "by hand" in places such as
1282 * expandRTE().
1283 */
1284 /* list of RangeTblFunction nodes */
1286 /* is this called WITH ORDINALITY? */
1288
1289 /*
1290 * Fields valid for a TableFunc RTE (else NULL):
1291 */
1293
1294 /*
1295 * Fields valid for a graph table RTE (else NULL):
1296 */
1299
1300 /*
1301 * Fields valid for a values RTE (else NIL):
1302 */
1303 /* list of expression lists */
1305
1306 /*
1307 * Fields valid for a CTE RTE (else NULL/zero):
1308 */
1309 /* name of the WITH list item */
1310 char *ctename;
1311 /* number of query levels up */
1313 /* is this a recursive self-reference? */
1315
1316 /*
1317 * Fields valid for CTE, VALUES, ENR, and TableFunc RTEs (else NIL):
1318 *
1319 * We need these for CTE RTEs so that the types of self-referential
1320 * columns are well-defined. For VALUES RTEs, storing these explicitly
1321 * saves having to re-determine the info by scanning the values_lists. For
1322 * ENRs, we store the types explicitly here (we could get the information
1323 * from the catalogs if 'relid' was supplied, but we'd still need these
1324 * for TupleDesc-based ENRs, so we might as well always store the type
1325 * info here). For TableFuncs, these fields are redundant with data in
1326 * the TableFunc node, but keeping them here allows some code sharing with
1327 * the other cases.
1328 *
1329 * For ENRs only, we have to consider the possibility of dropped columns.
1330 * A dropped column is included in these lists, but it will have zeroes in
1331 * all three lists (as well as an empty-string entry in eref). Testing
1332 * for zero coltype is the standard way to detect a dropped column.
1333 */
1334 /* OID list of column type OIDs */
1336 /* integer list of column typmods */
1338 /* OID list of column collation OIDs */
1340
1341 /*
1342 * Fields valid for ENR RTEs (else NULL/zero):
1343 */
1344 /* name of ephemeral named relation */
1345 char *enrname;
1346 /* estimated or actual from caller */
1348
1349 /*
1350 * Fields valid for a GROUP RTE (else NIL):
1351 */
1352 /* list of grouping expressions */
1354
1355 /*
1356 * Fields valid in all RTEs:
1357 */
1358 /* was LATERAL specified? */
1360 /* present in FROM clause? */
1362 /* security barrier quals to apply, if any */
1365
1366/*
1367 * RTEPermissionInfo
1368 * Per-relation information for permission checking. Added to the Query
1369 * node by the parser when adding the corresponding RTE to the query
1370 * range table and subsequently editorialized on by the rewriter if
1371 * needed after rule expansion.
1372 *
1373 * Only the relations directly mentioned in the query are checked for
1374 * access permissions by the core executor, so only their RTEPermissionInfos
1375 * are present in the Query. However, extensions may want to check inheritance
1376 * children too, depending on the value of rte->inh, so it's copied in 'inh'
1377 * for their perusal.
1378 *
1379 * requiredPerms and checkAsUser specify run-time access permissions checks
1380 * to be performed at query startup. The user must have *all* of the
1381 * permissions that are OR'd together in requiredPerms (never 0!). If
1382 * checkAsUser is not zero, then do the permissions checks using the access
1383 * rights of that user, not the current effective user ID. (This allows rules
1384 * to act as setuid gateways.)
1385 *
1386 * For SELECT/INSERT/UPDATE permissions, if the user doesn't have table-wide
1387 * permissions then it is sufficient to have the permissions on all columns
1388 * identified in selectedCols (for SELECT) and/or insertedCols and/or
1389 * updatedCols (INSERT with ON CONFLICT DO UPDATE may have all 3).
1390 * selectedCols, insertedCols and updatedCols are bitmapsets, which cannot have
1391 * negative integer members, so we subtract FirstLowInvalidHeapAttributeNumber
1392 * from column numbers before storing them in these fields. A whole-row Var
1393 * reference is represented by setting the bit for InvalidAttrNumber.
1394 *
1395 * updatedCols is also used in some other places, for example, to determine
1396 * which triggers to fire and in FDWs to know which changed columns they need
1397 * to ship off.
1398 */
1399typedef struct RTEPermissionInfo
1400{
1402
1403 Oid relid; /* relation OID */
1404 bool inh; /* separately check inheritance children? */
1405 AclMode requiredPerms; /* bitmask of required access permissions */
1406 Oid checkAsUser; /* if valid, check access as this role */
1407 Bitmapset *selectedCols; /* columns needing SELECT permission */
1408 Bitmapset *insertedCols; /* columns needing INSERT permission */
1409 Bitmapset *updatedCols; /* columns needing UPDATE permission */
1411
1412/*
1413 * RangeTblFunction -
1414 * RangeTblEntry subsidiary data for one function in a FUNCTION RTE.
1415 *
1416 * If the function had a column definition list (required for an
1417 * otherwise-unspecified RECORD result), funccolnames lists the names given
1418 * in the definition list, funccoltypes lists their declared column types,
1419 * funccoltypmods lists their typmods, funccolcollations their collations.
1420 * Otherwise, those fields are NIL.
1421 *
1422 * Notice we don't attempt to store info about the results of functions
1423 * returning named composite types, because those can change from time to
1424 * time. We do however remember how many columns we thought the type had
1425 * (including dropped columns!), so that we can successfully ignore any
1426 * columns added after the query was parsed.
1427 *
1428 * The query jumbling only needs to track the function expression.
1429 */
1430typedef struct RangeTblFunction
1431{
1433
1434 Node *funcexpr; /* expression tree for func call */
1435 /* number of columns it contributes to RTE */
1437 /* These fields record the contents of a column definition list, if any: */
1438 /* column names (list of String) */
1440 /* OID list of column type OIDs */
1442 /* integer list of column typmods */
1444 /* OID list of column collation OIDs */
1446
1447 /* This is set during planning for use by the executor: */
1448 /* PARAM_EXEC Param IDs affecting this func */
1451
1452/*
1453 * TableSampleClause - TABLESAMPLE appearing in a transformed FROM clause
1454 *
1455 * Unlike RangeTableSample, this is a subnode of the relevant RangeTblEntry.
1456 */
1457typedef struct TableSampleClause
1458{
1460 Oid tsmhandler; /* OID of the tablesample handler function */
1461 List *args; /* tablesample argument expression(s) */
1462 Expr *repeatable; /* REPEATABLE expression, or NULL if none */
1464
1465/*
1466 * WithCheckOption -
1467 * representation of WITH CHECK OPTION checks to be applied to new tuples
1468 * when inserting/updating an auto-updatable view, or RLS WITH CHECK
1469 * policies to be applied when inserting/updating a relation with RLS.
1470 */
1471typedef enum WCOKind
1472{
1473 WCO_VIEW_CHECK, /* WCO on an auto-updatable view */
1474 WCO_RLS_INSERT_CHECK, /* RLS INSERT WITH CHECK policy */
1475 WCO_RLS_UPDATE_CHECK, /* RLS UPDATE WITH CHECK policy */
1476 WCO_RLS_CONFLICT_CHECK, /* RLS ON CONFLICT DO SELECT/UPDATE USING
1477 * policy */
1478 WCO_RLS_MERGE_UPDATE_CHECK, /* RLS MERGE UPDATE USING policy */
1479 WCO_RLS_MERGE_DELETE_CHECK, /* RLS MERGE DELETE USING policy */
1481
1482typedef struct WithCheckOption
1483{
1485 WCOKind kind; /* kind of WCO */
1486 char *relname; /* name of relation that specified the WCO */
1487 char *polname; /* name of RLS policy being checked */
1488 Node *qual; /* constraint qual to check */
1489 bool cascaded; /* true for a cascaded WCO on a view */
1491
1492/*
1493 * SortGroupClause -
1494 * representation of ORDER BY, GROUP BY, PARTITION BY,
1495 * DISTINCT, DISTINCT ON items
1496 *
1497 * You might think that ORDER BY is only interested in defining ordering,
1498 * and GROUP/DISTINCT are only interested in defining equality. However,
1499 * one way to implement grouping is to sort and then apply a "uniq"-like
1500 * filter. So it's also interesting to keep track of possible sort operators
1501 * for GROUP/DISTINCT, and in particular to try to sort for the grouping
1502 * in a way that will also yield a requested ORDER BY ordering. So we need
1503 * to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates
1504 * the decision to give them the same representation.
1505 *
1506 * tleSortGroupRef must match ressortgroupref of exactly one entry of the
1507 * query's targetlist; that is the expression to be sorted or grouped by.
1508 * eqop is the OID of the equality operator.
1509 * sortop is the OID of the ordering operator (a "<" or ">" operator),
1510 * or InvalidOid if not available.
1511 * nulls_first means about what you'd expect. If sortop is InvalidOid
1512 * then nulls_first is meaningless and should be set to false.
1513 * hashable is true if eqop is hashable (note this condition also depends
1514 * on the datatype of the input expression).
1515 *
1516 * In an ORDER BY item, all fields must be valid. (The eqop isn't essential
1517 * here, but it's cheap to get it along with the sortop, and requiring it
1518 * to be valid eases comparisons to grouping items.) Note that this isn't
1519 * actually enough information to determine an ordering: if the sortop is
1520 * collation-sensitive, a collation OID is needed too. We don't store the
1521 * collation in SortGroupClause because it's not available at the time the
1522 * parser builds the SortGroupClause; instead, consult the exposed collation
1523 * of the referenced targetlist expression to find out what it is.
1524 *
1525 * In a grouping item, eqop must be valid. If the eqop is a btree equality
1526 * operator, then sortop should be set to a compatible ordering operator.
1527 * We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that
1528 * the query presents for the same tlist item. If there is none, we just
1529 * use the default ordering op for the datatype.
1530 *
1531 * If the tlist item's type has a hash opclass but no btree opclass, then
1532 * we will set eqop to the hash equality operator, sortop to InvalidOid,
1533 * and nulls_first to false. A grouping item of this kind can only be
1534 * implemented by hashing, and of course it'll never match an ORDER BY item.
1535 *
1536 * The hashable flag is provided since we generally have the requisite
1537 * information readily available when the SortGroupClause is constructed,
1538 * and it's relatively expensive to get it again later. Note there is no
1539 * need for a "sortable" flag since OidIsValid(sortop) serves the purpose.
1540 *
1541 * A query might have both ORDER BY and DISTINCT (or DISTINCT ON) clauses.
1542 * In SELECT DISTINCT, the distinctClause list is as long or longer than the
1543 * sortClause list, while in SELECT DISTINCT ON it's typically shorter.
1544 * The two lists must match up to the end of the shorter one --- the parser
1545 * rearranges the distinctClause if necessary to make this true. (This
1546 * restriction ensures that only one sort step is needed to both satisfy the
1547 * ORDER BY and set up for the Unique step. This is semantically necessary
1548 * for DISTINCT ON, and presents no real drawback for DISTINCT.)
1549 */
1550typedef struct SortGroupClause
1551{
1553 Index tleSortGroupRef; /* reference into targetlist */
1554 Oid eqop; /* the equality operator ('=' op) */
1555 Oid sortop; /* the ordering operator ('<' op), or 0 */
1556 bool reverse_sort; /* is sortop a "greater than" operator? */
1557 bool nulls_first; /* do NULLs come before normal values? */
1558 /* can eqop be implemented by hashing? */
1561
1562/*
1563 * GroupingSet -
1564 * representation of CUBE, ROLLUP and GROUPING SETS clauses
1565 *
1566 * In a Query with grouping sets, the groupClause contains a flat list of
1567 * SortGroupClause nodes for each distinct expression used. The actual
1568 * structure of the GROUP BY clause is given by the groupingSets tree.
1569 *
1570 * In the raw parser output, GroupingSet nodes (of all types except SIMPLE
1571 * which is not used) are potentially mixed in with the expressions in the
1572 * groupClause of the SelectStmt. (An expression can't contain a GroupingSet,
1573 * but a list may mix GroupingSet and expression nodes.) At this stage, the
1574 * content of each node is a list of expressions, some of which may be RowExprs
1575 * which represent sublists rather than actual row constructors, and nested
1576 * GroupingSet nodes where legal in the grammar. The structure directly
1577 * reflects the query syntax.
1578 *
1579 * In parse analysis, the transformed expressions are used to build the tlist
1580 * and groupClause list (of SortGroupClause nodes), and the groupingSets tree
1581 * is eventually reduced to a fixed format:
1582 *
1583 * EMPTY nodes represent (), and obviously have no content
1584 *
1585 * SIMPLE nodes represent a list of one or more expressions to be treated as an
1586 * atom by the enclosing structure; the content is an integer list of
1587 * ressortgroupref values (see SortGroupClause)
1588 *
1589 * CUBE and ROLLUP nodes contain a list of one or more SIMPLE nodes.
1590 *
1591 * SETS nodes contain a list of EMPTY, SIMPLE, CUBE or ROLLUP nodes, but after
1592 * parse analysis they cannot contain more SETS nodes; enough of the syntactic
1593 * transforms of the spec have been applied that we no longer have arbitrarily
1594 * deep nesting (though we still preserve the use of cube/rollup).
1595 *
1596 * Note that if the groupingSets tree contains no SIMPLE nodes (only EMPTY
1597 * nodes at the leaves), then the groupClause will be empty, but this is still
1598 * an aggregation query (similar to using aggs or HAVING without GROUP BY).
1599 *
1600 * As an example, the following clause:
1601 *
1602 * GROUP BY GROUPING SETS ((a,b), CUBE(c,(d,e)))
1603 *
1604 * looks like this after raw parsing:
1605 *
1606 * SETS( RowExpr(a,b) , CUBE( c, RowExpr(d,e) ) )
1607 *
1608 * and parse analysis converts it to:
1609 *
1610 * SETS( SIMPLE(1,2), CUBE( SIMPLE(3), SIMPLE(4,5) ) )
1611 */
1620
1628
1629/*
1630 * WindowClause -
1631 * transformed representation of WINDOW and OVER clauses
1632 *
1633 * A parsed Query's windowClause list contains these structs. "name" is set
1634 * if the clause originally came from WINDOW, and is NULL if it originally
1635 * was an OVER clause (but note that we collapse out duplicate OVERs).
1636 * partitionClause and orderClause are lists of SortGroupClause structs.
1637 * partitionClause is sanitized by the query planner to remove any columns or
1638 * expressions belonging to redundant PathKeys.
1639 * If we have RANGE with offset PRECEDING/FOLLOWING, the semantics of that are
1640 * specified by startInRangeFunc/inRangeColl/inRangeAsc/inRangeNullsFirst
1641 * for the start offset, or endInRangeFunc/inRange* for the end offset.
1642 * winref is an ID number referenced by WindowFunc nodes; it must be unique
1643 * among the members of a Query's windowClause list.
1644 * When refname isn't null, the partitionClause is always copied from there;
1645 * the orderClause might or might not be copied (see copiedOrder); the framing
1646 * options are never copied, per spec.
1647 *
1648 * The information relevant for the query jumbling is the partition clause
1649 * type and its bounds.
1650 */
1651typedef struct WindowClause
1652{
1654 /* window name (NULL in an OVER clause) */
1656 /* referenced window name, if any */
1658 List *partitionClause; /* PARTITION BY list */
1659 /* ORDER BY list */
1661 int frameOptions; /* frame_clause options, see WindowDef */
1662 Node *startOffset; /* expression for starting bound, if any */
1663 Node *endOffset; /* expression for ending bound, if any */
1664 /* in_range function for startOffset */
1666 /* in_range function for endOffset */
1668 /* collation for in_range tests */
1670 /* use ASC sort order for in_range tests? */
1672 /* nulls sort first for in_range tests? */
1673 bool inRangeNullsFirst pg_node_attr(query_jumble_ignore);
1674 Index winref; /* ID referenced by window functions */
1675 /* did we copy orderClause from refname? */
1678
1679/*
1680 * RowMarkClause -
1681 * parser output representation of FOR [KEY] UPDATE/SHARE clauses
1682 *
1683 * Query.rowMarks contains a separate RowMarkClause node for each relation
1684 * identified as a FOR [KEY] UPDATE/SHARE target. If one of these clauses
1685 * is applied to a subquery, we generate RowMarkClauses for all normal and
1686 * subquery rels in the subquery, but they are marked pushedDown = true to
1687 * distinguish them from clauses that were explicitly written at this query
1688 * level. Also, Query.hasForUpdate tells whether there were explicit FOR
1689 * UPDATE/SHARE/KEY SHARE clauses in the current query level.
1690 */
1691typedef struct RowMarkClause
1692{
1694 Index rti; /* range table index of target relation */
1696 LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
1697 bool pushedDown; /* pushed down from higher query level? */
1699
1700/*
1701 * WithClause -
1702 * representation of WITH clause
1703 *
1704 * Note: WithClause does not propagate into the Query representation;
1705 * but CommonTableExpr does.
1706 */
1707typedef struct WithClause
1708{
1710 List *ctes; /* list of CommonTableExprs */
1711 bool recursive; /* true = WITH RECURSIVE */
1712 ParseLoc location; /* token location, or -1 if unknown */
1714
1715/*
1716 * InferClause -
1717 * ON CONFLICT unique index inference clause
1718 *
1719 * Note: InferClause does not propagate into the Query representation.
1720 */
1721typedef struct InferClause
1722{
1724 List *indexElems; /* IndexElems to infer unique index */
1725 Node *whereClause; /* qualification (partial-index predicate) */
1726 char *conname; /* Constraint name, or NULL if unnamed */
1727 ParseLoc location; /* token location, or -1 if unknown */
1729
1730/*
1731 * OnConflictClause -
1732 * representation of ON CONFLICT clause
1733 *
1734 * Note: OnConflictClause does not propagate into the Query representation.
1735 */
1736typedef struct OnConflictClause
1737{
1739 OnConflictAction action; /* DO NOTHING, SELECT, or UPDATE */
1740 InferClause *infer; /* Optional index inference clause */
1741 LockClauseStrength lockStrength; /* lock strength for DO SELECT */
1742 List *targetList; /* target list (of ResTarget) for DO UPDATE */
1743 Node *whereClause; /* qualifications */
1744 ParseLoc location; /* token location, or -1 if unknown */
1746
1747/*
1748 * CommonTableExpr -
1749 * representation of WITH list element
1750 */
1751
1752typedef enum CTEMaterialize
1753{
1754 CTEMaterializeDefault, /* no option specified */
1755 CTEMaterializeAlways, /* MATERIALIZED */
1756 CTEMaterializeNever, /* NOT MATERIALIZED */
1758
1767
1768typedef struct CTECycleClause
1769{
1777 /* These fields are set during parse analysis: */
1778 Oid cycle_mark_type; /* common type of _value and _default */
1781 Oid cycle_mark_neop; /* <> operator for type */
1783
1784typedef struct CommonTableExpr
1785{
1787
1788 /*
1789 * Query name (never qualified). The string name is included in the query
1790 * jumbling because RTE_CTE RTEs need it.
1791 */
1792 char *ctename;
1793 /* optional list of column names */
1795 CTEMaterialize ctematerialized; /* is this an optimization fence? */
1796 /* SelectStmt/InsertStmt/etc before parse analysis, Query afterwards: */
1797 Node *ctequery; /* the CTE's subquery */
1800 ParseLoc location; /* token location, or -1 if unknown */
1801 /* These fields are set during parse analysis: */
1802 /* is this CTE actually recursive? */
1804
1805 /*
1806 * Number of RTEs referencing this CTE (excluding internal
1807 * self-references), irrelevant for query jumbling.
1808 */
1810 /* list of output column names */
1812 /* OID list of output column type OIDs */
1814 /* integer list of output column typmods */
1816 /* OID list of column collation OIDs */
1819
1820/* Convenience macro to get the output tlist of a CTE's query */
1821#define GetCTETargetList(cte) \
1822 (AssertMacro(IsA((cte)->ctequery, Query)), \
1823 ((Query *) (cte)->ctequery)->commandType == CMD_SELECT ? \
1824 ((Query *) (cte)->ctequery)->targetList : \
1825 ((Query *) (cte)->ctequery)->returningList)
1826
1827/*
1828 * MergeWhenClause -
1829 * raw parser representation of a WHEN clause in a MERGE statement
1830 *
1831 * This is transformed into MergeAction by parse analysis
1832 */
1833typedef struct MergeWhenClause
1834{
1836 MergeMatchKind matchKind; /* MATCHED/NOT MATCHED BY SOURCE/TARGET */
1837 CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
1838 OverridingKind override; /* OVERRIDING clause */
1839 Node *condition; /* WHEN conditions (raw parser) */
1840 List *targetList; /* INSERT/UPDATE targetlist */
1841 /* the following members are only used in INSERT actions */
1842 List *values; /* VALUES to INSERT, or NULL */
1844
1845/*
1846 * ReturningOptionKind -
1847 * Possible kinds of option in RETURNING WITH(...) list
1848 *
1849 * Currently, this is used only for specifying OLD/NEW aliases.
1850 */
1852{
1853 RETURNING_OPTION_OLD, /* specify alias for OLD in RETURNING */
1854 RETURNING_OPTION_NEW, /* specify alias for NEW in RETURNING */
1856
1857/*
1858 * ReturningOption -
1859 * An individual option in the RETURNING WITH(...) list
1860 */
1861typedef struct ReturningOption
1862{
1864 ReturningOptionKind option; /* specified option */
1865 char *value; /* option's value */
1866 ParseLoc location; /* token location, or -1 if unknown */
1868
1869/*
1870 * ReturningClause -
1871 * List of RETURNING expressions, together with any WITH(...) options
1872 */
1873typedef struct ReturningClause
1874{
1876 List *options; /* list of ReturningOption elements */
1877 List *exprs; /* list of expressions to return */
1879
1880/*
1881 * TriggerTransition -
1882 * representation of transition row or table naming clause
1883 *
1884 * Only transition tables are initially supported in the syntax, and only for
1885 * AFTER triggers, but other permutations are accepted by the parser so we can
1886 * give a meaningful message from C code.
1887 */
1895
1896/* Nodes for SQL/JSON support */
1897
1898/*
1899 * JsonOutput -
1900 * representation of JSON output clause (RETURNING type [FORMAT format])
1901 */
1902typedef struct JsonOutput
1903{
1905 TypeName *typeName; /* RETURNING type name, if specified */
1906 JsonReturning *returning; /* RETURNING FORMAT clause and type Oids */
1908
1909/*
1910 * JsonArgument -
1911 * representation of argument from JSON PASSING clause
1912 */
1913typedef struct JsonArgument
1914{
1916 JsonValueExpr *val; /* argument value expression */
1917 char *name; /* argument name */
1919
1920/*
1921 * JsonQuotes -
1922 * representation of [KEEP|OMIT] QUOTES clause for JSON_QUERY()
1923 */
1924typedef enum JsonQuotes
1925{
1926 JS_QUOTES_UNSPEC, /* unspecified */
1927 JS_QUOTES_KEEP, /* KEEP QUOTES */
1928 JS_QUOTES_OMIT, /* OMIT QUOTES */
1930
1931/*
1932 * JsonFuncExpr -
1933 * untransformed representation of function expressions for
1934 * SQL/JSON query functions
1935 */
1936typedef struct JsonFuncExpr
1937{
1939 JsonExprOp op; /* expression type */
1940 char *column_name; /* JSON_TABLE() column name or NULL if this is
1941 * not for a JSON_TABLE() */
1942 JsonValueExpr *context_item; /* context item expression */
1943 Node *pathspec; /* JSON path specification expression */
1944 List *passing; /* list of PASSING clause arguments, if any */
1945 JsonOutput *output; /* output clause, if specified */
1946 JsonBehavior *on_empty; /* ON EMPTY behavior */
1947 JsonBehavior *on_error; /* ON ERROR behavior */
1948 JsonWrapper wrapper; /* array wrapper behavior (JSON_QUERY only) */
1949 JsonQuotes quotes; /* omit or keep quotes? (JSON_QUERY only) */
1950 ParseLoc location; /* token location, or -1 if unknown */
1952
1953/*
1954 * JsonTablePathSpec
1955 * untransformed specification of JSON path expression with an optional
1956 * name
1957 */
1967
1968/*
1969 * JsonTable -
1970 * untransformed representation of JSON_TABLE
1971 */
1972typedef struct JsonTable
1973{
1975 JsonValueExpr *context_item; /* context item expression */
1976 JsonTablePathSpec *pathspec; /* JSON path specification */
1977 List *passing; /* list of PASSING clause arguments, if any */
1978 List *columns; /* list of JsonTableColumn */
1979 JsonBehavior *on_error; /* ON ERROR behavior */
1980 Alias *alias; /* table alias in FROM clause */
1981 bool lateral; /* does it have LATERAL prefix? */
1982 ParseLoc location; /* token location, or -1 if unknown */
1984
1985/*
1986 * JsonTableColumnType -
1987 * enumeration of JSON_TABLE column types
1988 */
1997
1998/*
1999 * JsonTableColumn -
2000 * untransformed representation of JSON_TABLE column
2001 */
2002typedef struct JsonTableColumn
2003{
2005 JsonTableColumnType coltype; /* column type */
2006 char *name; /* column name */
2007 TypeName *typeName; /* column type name */
2008 JsonTablePathSpec *pathspec; /* JSON path specification */
2009 JsonFormat *format; /* JSON format clause, if specified */
2010 JsonWrapper wrapper; /* WRAPPER behavior for formatted columns */
2011 JsonQuotes quotes; /* omit or keep quotes on scalar strings? */
2012 List *columns; /* nested columns */
2013 JsonBehavior *on_empty; /* ON EMPTY behavior */
2014 JsonBehavior *on_error; /* ON ERROR behavior */
2015 ParseLoc location; /* token location, or -1 if unknown */
2017
2018/*
2019 * JsonKeyValue -
2020 * untransformed representation of JSON object key-value pair for
2021 * JSON_OBJECT() and JSON_OBJECTAGG()
2022 */
2023typedef struct JsonKeyValue
2024{
2026 Expr *key; /* key expression */
2027 JsonValueExpr *value; /* JSON value expression */
2029
2030/*
2031 * JsonParseExpr -
2032 * untransformed representation of JSON()
2033 */
2034typedef struct JsonParseExpr
2035{
2037 JsonValueExpr *expr; /* string expression */
2038 JsonOutput *output; /* RETURNING clause, if specified */
2039 bool unique_keys; /* WITH UNIQUE KEYS? */
2040 ParseLoc location; /* token location, or -1 if unknown */
2042
2043/*
2044 * JsonScalarExpr -
2045 * untransformed representation of JSON_SCALAR()
2046 */
2047typedef struct JsonScalarExpr
2048{
2050 Expr *expr; /* scalar expression */
2051 JsonOutput *output; /* RETURNING clause, if specified */
2052 ParseLoc location; /* token location, or -1 if unknown */
2054
2055/*
2056 * JsonSerializeExpr -
2057 * untransformed representation of JSON_SERIALIZE() function
2058 */
2059typedef struct JsonSerializeExpr
2060{
2062 JsonValueExpr *expr; /* json value expression */
2063 JsonOutput *output; /* RETURNING clause, if specified */
2064 ParseLoc location; /* token location, or -1 if unknown */
2066
2067/*
2068 * JsonObjectConstructor -
2069 * untransformed representation of JSON_OBJECT() constructor
2070 */
2072{
2074 List *exprs; /* list of JsonKeyValue pairs */
2075 JsonOutput *output; /* RETURNING clause, if specified */
2076 bool absent_on_null; /* skip NULL values? */
2077 bool unique; /* check key uniqueness? */
2078 ParseLoc location; /* token location, or -1 if unknown */
2080
2081/*
2082 * JsonArrayConstructor -
2083 * untransformed representation of JSON_ARRAY(element,...) constructor
2084 */
2086{
2088 List *exprs; /* list of JsonValueExpr elements */
2089 JsonOutput *output; /* RETURNING clause, if specified */
2090 bool absent_on_null; /* skip NULL elements? */
2091 ParseLoc location; /* token location, or -1 if unknown */
2093
2094/*
2095 * JsonArrayQueryConstructor -
2096 * untransformed representation of JSON_ARRAY(subquery) constructor
2097 */
2099{
2101 Node *query; /* subquery */
2102 JsonOutput *output; /* RETURNING clause, if specified */
2103 JsonFormat *format; /* FORMAT clause for subquery, if specified */
2104 bool absent_on_null; /* skip NULL elements? */
2105 ParseLoc location; /* token location, or -1 if unknown */
2107
2108/*
2109 * JsonAggConstructor -
2110 * common fields of untransformed representation of
2111 * JSON_ARRAYAGG() and JSON_OBJECTAGG()
2112 */
2114{
2116 JsonOutput *output; /* RETURNING clause, if any */
2117 Node *agg_filter; /* FILTER clause, if any */
2118 List *agg_order; /* ORDER BY clause, if any */
2119 struct WindowDef *over; /* OVER clause, if any */
2120 ParseLoc location; /* token location, or -1 if unknown */
2122
2123/*
2124 * JsonObjectAgg -
2125 * untransformed representation of JSON_OBJECTAGG()
2126 */
2127typedef struct JsonObjectAgg
2128{
2130 JsonAggConstructor *constructor; /* common fields */
2131 JsonKeyValue *arg; /* object key-value pair */
2132 bool absent_on_null; /* skip NULL values? */
2133 bool unique; /* check key uniqueness? */
2135
2136/*
2137 * JsonArrayAgg -
2138 * untransformed representation of JSON_ARRAYAGG()
2139 */
2140typedef struct JsonArrayAgg
2141{
2143 JsonAggConstructor *constructor; /* common fields */
2144 JsonValueExpr *arg; /* array element expression */
2145 bool absent_on_null; /* skip NULL elements? */
2147
2148
2149/*****************************************************************************
2150 * Raw Grammar Output Statements
2151 *****************************************************************************/
2152
2153/*
2154 * RawStmt --- container for any one statement's raw parse tree
2155 *
2156 * Parse analysis converts a raw parse tree headed by a RawStmt node into
2157 * an analyzed statement headed by a Query node. For optimizable statements,
2158 * the conversion is complex. For utility statements, the parser usually just
2159 * transfers the raw parse tree (sans RawStmt) into the utilityStmt field of
2160 * the Query node, and all the useful work happens at execution time.
2161 *
2162 * stmt_location/stmt_len identify the portion of the source text string
2163 * containing this raw statement (useful for multi-statement strings).
2164 *
2165 * This is irrelevant for query jumbling, as this is not used in parsed
2166 * queries.
2167 */
2168typedef struct RawStmt
2169{
2171
2172 NodeTag type;
2173 Node *stmt; /* raw parse tree */
2174 ParseLoc stmt_location; /* start location, or -1 if unknown */
2175 ParseLoc stmt_len; /* length in bytes; 0 means "rest of string" */
2177
2178/*****************************************************************************
2179 * Optimizable Statements
2180 *****************************************************************************/
2181
2182/* ----------------------
2183 * Insert Statement
2184 *
2185 * The source expression is represented by SelectStmt for both the
2186 * SELECT and VALUES cases. If selectStmt is NULL, then the query
2187 * is INSERT ... DEFAULT VALUES.
2188 * ----------------------
2189 */
2190typedef struct InsertStmt
2191{
2193 RangeVar *relation; /* relation to insert into */
2194 List *cols; /* optional: names of the target columns */
2195 Node *selectStmt; /* the source SELECT/VALUES, or NULL */
2196 OnConflictClause *onConflictClause; /* ON CONFLICT clause */
2197 ReturningClause *returningClause; /* RETURNING clause */
2198 WithClause *withClause; /* WITH clause */
2199 OverridingKind override; /* OVERRIDING clause */
2201
2202/* ----------------------
2203 * Delete Statement
2204 * ----------------------
2205 */
2206typedef struct DeleteStmt
2207{
2209 RangeVar *relation; /* relation to delete from */
2210 List *usingClause; /* optional using clause for more tables */
2211 Node *whereClause; /* qualifications */
2212 ReturningClause *returningClause; /* RETURNING clause */
2213 WithClause *withClause; /* WITH clause */
2215
2216/* ----------------------
2217 * Update Statement
2218 * ----------------------
2219 */
2220typedef struct UpdateStmt
2221{
2223 RangeVar *relation; /* relation to update */
2224 List *targetList; /* the target list (of ResTarget) */
2225 Node *whereClause; /* qualifications */
2226 List *fromClause; /* optional from clause for more tables */
2227 ReturningClause *returningClause; /* RETURNING clause */
2228 WithClause *withClause; /* WITH clause */
2230
2231/* ----------------------
2232 * Merge Statement
2233 * ----------------------
2234 */
2235typedef struct MergeStmt
2236{
2238 RangeVar *relation; /* target relation to merge into */
2239 Node *sourceRelation; /* source relation */
2240 Node *joinCondition; /* join condition between source and target */
2241 List *mergeWhenClauses; /* list of MergeWhenClause(es) */
2242 ReturningClause *returningClause; /* RETURNING clause */
2243 WithClause *withClause; /* WITH clause */
2245
2246/* ----------------------
2247 * Select Statement
2248 *
2249 * A "simple" SELECT is represented in the output of gram.y by a single
2250 * SelectStmt node; so is a VALUES construct. A query containing set
2251 * operators (UNION, INTERSECT, EXCEPT) is represented by a tree of SelectStmt
2252 * nodes, in which the leaf nodes are component SELECTs and the internal nodes
2253 * represent UNION, INTERSECT, or EXCEPT operators. Using the same node
2254 * type for both leaf and internal nodes allows gram.y to stick ORDER BY,
2255 * LIMIT, etc, clause values into a SELECT statement without worrying
2256 * whether it is a simple or compound SELECT.
2257 * ----------------------
2258 */
2266
2267typedef struct SelectStmt
2268{
2270
2271 /*
2272 * These fields are used only in "leaf" SelectStmts.
2273 */
2274 List *distinctClause; /* NULL, list of DISTINCT ON exprs, or
2275 * lcons(NIL,NIL) for all (SELECT DISTINCT) */
2276 IntoClause *intoClause; /* target for SELECT INTO */
2277 List *targetList; /* the target list (of ResTarget) */
2278 List *fromClause; /* the FROM clause */
2279 Node *whereClause; /* WHERE qualification */
2280 List *groupClause; /* GROUP BY clauses */
2281 bool groupDistinct; /* Is this GROUP BY DISTINCT? */
2282 bool groupByAll; /* Is this GROUP BY ALL? */
2283 Node *havingClause; /* HAVING conditional-expression */
2284 List *windowClause; /* WINDOW window_name AS (...), ... */
2285
2286 /*
2287 * In a "leaf" node representing a VALUES list, the above fields are all
2288 * null, and instead this field is set. Note that the elements of the
2289 * sublists are just expressions, without ResTarget decoration. Also note
2290 * that a list element can be DEFAULT (represented as a SetToDefault
2291 * node), regardless of the context of the VALUES list. It's up to parse
2292 * analysis to reject that where not valid.
2293 */
2294 List *valuesLists; /* untransformed list of expression lists */
2295
2296 /*
2297 * These fields are used in both "leaf" SelectStmts and upper-level
2298 * SelectStmts.
2299 */
2300 List *sortClause; /* sort clause (a list of SortBy's) */
2301 Node *limitOffset; /* # of result tuples to skip */
2302 Node *limitCount; /* # of result tuples to return */
2303 LimitOption limitOption; /* limit type */
2304 List *lockingClause; /* FOR UPDATE (list of LockingClause's) */
2305 WithClause *withClause; /* WITH clause */
2306
2307 /*
2308 * These fields are used only in upper-level SelectStmts.
2309 */
2310 SetOperation op; /* type of set op */
2311 bool all; /* ALL specified? */
2312 struct SelectStmt *larg; /* left child */
2313 struct SelectStmt *rarg; /* right child */
2314 /* Eventually add fields for CORRESPONDING spec here */
2316
2317
2318/* ----------------------
2319 * Set Operation node for post-analysis query trees
2320 *
2321 * After parse analysis, a SELECT with set operations is represented by a
2322 * top-level Query node containing the leaf SELECTs as subqueries in its
2323 * range table. Its setOperations field shows the tree of set operations,
2324 * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal
2325 * nodes replaced by SetOperationStmt nodes. Information about the output
2326 * column types is added, too. (Note that the child nodes do not necessarily
2327 * produce these types directly, but we've checked that their output types
2328 * can be coerced to the output column type.) Also, if it's not UNION ALL,
2329 * information about the types' sort/group semantics is provided in the form
2330 * of a SortGroupClause list (same representation as, eg, DISTINCT).
2331 * The resolved common column collations are provided too; but note that if
2332 * it's not UNION ALL, it's okay for a column to not have a common collation,
2333 * so a member of the colCollations list could be InvalidOid even though the
2334 * column has a collatable type.
2335 * ----------------------
2336 */
2337typedef struct SetOperationStmt
2338{
2340 SetOperation op; /* type of set op */
2341 bool all; /* ALL specified? */
2342 Node *larg; /* left child */
2343 Node *rarg; /* right child */
2344 /* Eventually add fields for CORRESPONDING spec here */
2345
2346 /* Fields derived during parse analysis (irrelevant for query jumbling): */
2347 /* OID list of output column type OIDs */
2349 /* integer list of output column typmods */
2351 /* OID list of output column collation OIDs */
2353 /* a list of SortGroupClause's */
2355 /* groupClauses is NIL if UNION ALL, but must be set otherwise */
2357
2358
2359/*
2360 * RETURN statement (inside SQL function body)
2361 */
2367
2368
2369/* ----------------------
2370 * PL/pgSQL Assignment Statement
2371 *
2372 * Like SelectStmt, this is transformed into a SELECT Query.
2373 * However, the targetlist of the result looks more like an UPDATE.
2374 * ----------------------
2375 */
2376typedef struct PLAssignStmt
2377{
2379
2380 char *name; /* initial column name */
2381 List *indirection; /* subscripts and field names, if any */
2382 int nnames; /* number of names to use in ColumnRef */
2383 SelectStmt *val; /* the PL/pgSQL expression to assign */
2384 ParseLoc location; /* name's token location, or -1 if unknown */
2386
2387
2388/*****************************************************************************
2389 * Other Statements (no optimizations required)
2390 *
2391 * These are not touched by parser/analyze.c except to put them into
2392 * the utilityStmt field of a Query. This is eventually passed to
2393 * ProcessUtility (by-passing rewriting and planning). Some of the
2394 * statements do need attention from parse analysis, and this is
2395 * done by routines in parser/parse_utilcmd.c after ProcessUtility
2396 * receives the command for execution.
2397 * DECLARE CURSOR, EXPLAIN, and CREATE TABLE AS are special cases:
2398 * they contain optimizable statements, which get processed normally
2399 * by parser/analyze.c.
2400 *****************************************************************************/
2401
2402/*
2403 * When a command can act on several kinds of objects with only one
2404 * parse structure required, use these constants to designate the
2405 * object type. Note that commands typically don't support all the types.
2406 */
2407
2464
2465/* ----------------------
2466 * Create Schema Statement
2467 *
2468 * NOTE: the schemaElts list contains raw parsetrees for component statements
2469 * of the schema, such as CREATE TABLE, GRANT, etc. These are analyzed and
2470 * executed after the schema itself is created.
2471 * ----------------------
2472 */
2473typedef struct CreateSchemaStmt
2474{
2476 char *schemaname; /* the name of the schema to create */
2477 RoleSpec *authrole; /* the owner of the created schema */
2478 List *schemaElts; /* schema components (list of parsenodes) */
2479 bool if_not_exists; /* just do nothing if schema already exists? */
2481
2482typedef enum DropBehavior
2483{
2484 DROP_RESTRICT, /* drop fails if any dependent objects */
2485 DROP_CASCADE, /* remove dependent objects too */
2487
2488/* ----------------------
2489 * Alter Table
2490 * ----------------------
2491 */
2492typedef struct AlterTableStmt
2493{
2495 RangeVar *relation; /* table to work on */
2496 List *cmds; /* list of subcommands */
2497 ObjectType objtype; /* type of object */
2498 bool missing_ok; /* skip error if table missing */
2500
2501typedef enum AlterTableType
2502{
2503 AT_AddColumn, /* add column */
2504 AT_AddColumnToView, /* implicitly via CREATE OR REPLACE VIEW */
2505 AT_ColumnDefault, /* alter column default */
2506 AT_CookedColumnDefault, /* add a pre-cooked column default */
2507 AT_DropNotNull, /* alter column drop not null */
2508 AT_SetNotNull, /* alter column set not null */
2509 AT_SetExpression, /* alter column set expression */
2510 AT_DropExpression, /* alter column drop expression */
2511 AT_SetStatistics, /* alter column set statistics */
2512 AT_SetOptions, /* alter column set ( options ) */
2513 AT_ResetOptions, /* alter column reset ( options ) */
2514 AT_SetStorage, /* alter column set storage */
2515 AT_SetCompression, /* alter column set compression */
2516 AT_DropColumn, /* drop column */
2517 AT_AddIndex, /* add index */
2518 AT_ReAddIndex, /* internal to commands/tablecmds.c */
2519 AT_AddConstraint, /* add constraint */
2520 AT_ReAddConstraint, /* internal to commands/tablecmds.c */
2521 AT_ReAddDomainConstraint, /* internal to commands/tablecmds.c */
2522 AT_AlterConstraint, /* alter constraint */
2523 AT_ValidateConstraint, /* validate constraint */
2524 AT_AddIndexConstraint, /* add constraint using existing index */
2525 AT_DropConstraint, /* drop constraint */
2526 AT_ReAddComment, /* internal to commands/tablecmds.c */
2527 AT_AlterColumnType, /* alter column type */
2528 AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */
2529 AT_ChangeOwner, /* change owner */
2530 AT_ClusterOn, /* CLUSTER ON */
2531 AT_DropCluster, /* SET WITHOUT CLUSTER */
2532 AT_SetLogged, /* SET LOGGED */
2533 AT_SetUnLogged, /* SET UNLOGGED */
2534 AT_DropOids, /* SET WITHOUT OIDS */
2535 AT_SetAccessMethod, /* SET ACCESS METHOD */
2536 AT_SetTableSpace, /* SET TABLESPACE */
2537 AT_SetRelOptions, /* SET (...) -- AM specific parameters */
2538 AT_ResetRelOptions, /* RESET (...) -- AM specific parameters */
2539 AT_ReplaceRelOptions, /* replace reloption list in its entirety */
2540 AT_EnableTrig, /* ENABLE TRIGGER name */
2541 AT_EnableAlwaysTrig, /* ENABLE ALWAYS TRIGGER name */
2542 AT_EnableReplicaTrig, /* ENABLE REPLICA TRIGGER name */
2543 AT_DisableTrig, /* DISABLE TRIGGER name */
2544 AT_EnableTrigAll, /* ENABLE TRIGGER ALL */
2545 AT_DisableTrigAll, /* DISABLE TRIGGER ALL */
2546 AT_EnableTrigUser, /* ENABLE TRIGGER USER */
2547 AT_DisableTrigUser, /* DISABLE TRIGGER USER */
2548 AT_EnableRule, /* ENABLE RULE name */
2549 AT_EnableAlwaysRule, /* ENABLE ALWAYS RULE name */
2550 AT_EnableReplicaRule, /* ENABLE REPLICA RULE name */
2551 AT_DisableRule, /* DISABLE RULE name */
2552 AT_AddInherit, /* INHERIT parent */
2553 AT_DropInherit, /* NO INHERIT parent */
2554 AT_AddOf, /* OF <type_name> */
2555 AT_DropOf, /* NOT OF */
2556 AT_ReplicaIdentity, /* REPLICA IDENTITY */
2557 AT_EnableRowSecurity, /* ENABLE ROW SECURITY */
2558 AT_DisableRowSecurity, /* DISABLE ROW SECURITY */
2559 AT_ForceRowSecurity, /* FORCE ROW SECURITY */
2560 AT_NoForceRowSecurity, /* NO FORCE ROW SECURITY */
2561 AT_GenericOptions, /* OPTIONS (...) */
2562 AT_AttachPartition, /* ATTACH PARTITION */
2563 AT_DetachPartition, /* DETACH PARTITION */
2564 AT_DetachPartitionFinalize, /* DETACH PARTITION FINALIZE */
2565 AT_SplitPartition, /* SPLIT PARTITION */
2566 AT_MergePartitions, /* MERGE PARTITIONS */
2567 AT_AddIdentity, /* ADD IDENTITY */
2568 AT_SetIdentity, /* SET identity column options */
2569 AT_DropIdentity, /* DROP IDENTITY */
2570 AT_ReAddStatistics, /* internal to commands/tablecmds.c */
2572
2573typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
2574{
2576 AlterTableType subtype; /* Type of table alteration to apply */
2577 char *name; /* column, constraint, or trigger to act on,
2578 * or tablespace, access method */
2579 int16 num; /* attribute number for columns referenced by
2580 * number */
2582 Node *def; /* definition of new column, index,
2583 * constraint, or parent table */
2584 DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
2585 bool missing_ok; /* skip error if missing? */
2586 bool recurse; /* exec-time recursion */
2588
2589/* Ad-hoc node for AT_AlterConstraint */
2590typedef struct ATAlterConstraint
2591{
2593 char *conname; /* Constraint name */
2594 bool alterEnforceability; /* changing enforceability properties? */
2595 bool is_enforced; /* ENFORCED? */
2596 bool alterDeferrability; /* changing deferrability properties? */
2597 bool deferrable; /* DEFERRABLE? */
2598 bool initdeferred; /* INITIALLY DEFERRED? */
2599 bool alterInheritability; /* changing inheritability properties */
2602
2603/* Ad-hoc node for AT_ReplicaIdentity */
2610
2611
2612/* ----------------------
2613 * Alter Collation
2614 * ----------------------
2615 */
2621
2622
2623/* ----------------------
2624 * Alter Domain
2625 *
2626 * The fields are used in different ways by the different variants of
2627 * this command.
2628 * ----------------------
2629 */
2631{
2632 AD_AlterDefault = 'T', /* SET|DROP DEFAULT */
2633 AD_DropNotNull = 'N', /* DROP NOT NULL */
2634 AD_SetNotNull = 'O', /* SET NOT NULL */
2635 AD_AddConstraint = 'C', /* ADD CONSTRAINT */
2636 AD_DropConstraint = 'X', /* DROP CONSTRAINT */
2637 AD_ValidateConstraint = 'V', /* VALIDATE CONSTRAINT */
2639
2640typedef struct AlterDomainStmt
2641{
2643 AlterDomainType subtype; /* subtype of command */
2644 List *typeName; /* domain to work on */
2645 char *name; /* column or constraint name to act on */
2646 Node *def; /* definition of default or constraint */
2647 DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
2648 bool missing_ok; /* skip error if missing? */
2650
2651
2652/* ----------------------
2653 * Grant|Revoke Statement
2654 * ----------------------
2655 */
2657{
2658 ACL_TARGET_OBJECT, /* grant on specific named object(s) */
2659 ACL_TARGET_ALL_IN_SCHEMA, /* grant on all objects in given schema(s) */
2660 ACL_TARGET_DEFAULTS, /* ALTER DEFAULT PRIVILEGES */
2662
2663typedef struct GrantStmt
2664{
2666 bool is_grant; /* true = GRANT, false = REVOKE */
2667 GrantTargetType targtype; /* type of the grant target */
2668 ObjectType objtype; /* kind of object being operated on */
2669 List *objects; /* list of RangeVar nodes, ObjectWithArgs
2670 * nodes, or plain names (as String values) */
2671 List *privileges; /* list of AccessPriv nodes */
2672 /* privileges == NIL denotes ALL PRIVILEGES */
2673 List *grantees; /* list of RoleSpec nodes */
2674 bool grant_option; /* grant or revoke grant option */
2675 RoleSpec *grantor; /* GRANTED BY clause, or NULL if none */
2676 DropBehavior behavior; /* drop behavior (for REVOKE) */
2678
2679/*
2680 * ObjectWithArgs represents a function/procedure/operator name plus parameter
2681 * identification.
2682 *
2683 * objargs includes only the types of the input parameters of the object.
2684 * In some contexts, that will be all we have, and it's enough to look up
2685 * objects according to the traditional Postgres rules (i.e., when only input
2686 * arguments matter).
2687 *
2688 * objfuncargs, if not NIL, carries the full specification of the parameter
2689 * list, including parameter mode annotations.
2690 *
2691 * Some grammar productions can set args_unspecified = true instead of
2692 * providing parameter info. In this case, lookup will succeed only if
2693 * the object name is unique. Note that otherwise, NIL parameter lists
2694 * mean zero arguments.
2695 */
2696typedef struct ObjectWithArgs
2697{
2699 List *objname; /* qualified name of function/operator */
2700 List *objargs; /* list of Typename nodes (input args only) */
2701 List *objfuncargs; /* list of FunctionParameter nodes */
2702 bool args_unspecified; /* argument list was omitted? */
2704
2705/*
2706 * An access privilege, with optional list of column names
2707 * priv_name == NULL denotes ALL PRIVILEGES (only used with a column list)
2708 * cols == NIL denotes "all columns"
2709 * Note that simple "ALL PRIVILEGES" is represented as a NIL list, not
2710 * an AccessPriv with both fields null.
2711 */
2712typedef struct AccessPriv
2713{
2715 char *priv_name; /* string name of privilege */
2716 List *cols; /* list of String */
2718
2719/* ----------------------
2720 * Grant/Revoke Role Statement
2721 *
2722 * Note: because of the parsing ambiguity with the GRANT <privileges>
2723 * statement, granted_roles is a list of AccessPriv; the execution code
2724 * should complain if any column lists appear. grantee_roles is a list
2725 * of role names, as RoleSpec values.
2726 * ----------------------
2727 */
2728typedef struct GrantRoleStmt
2729{
2731 List *granted_roles; /* list of roles to be granted/revoked */
2732 List *grantee_roles; /* list of member roles to add/delete */
2733 bool is_grant; /* true = GRANT, false = REVOKE */
2734 List *opt; /* options e.g. WITH GRANT OPTION */
2735 RoleSpec *grantor; /* set grantor to other than current role */
2736 DropBehavior behavior; /* drop behavior (for REVOKE) */
2738
2739/* ----------------------
2740 * Alter Default Privileges Statement
2741 * ----------------------
2742 */
2744{
2746 List *options; /* list of DefElem */
2747 GrantStmt *action; /* GRANT/REVOKE action (with objects=NIL) */
2749
2750/* ----------------------
2751 * Copy Statement
2752 *
2753 * We support "COPY relation FROM file", "COPY relation TO file", and
2754 * "COPY (query) TO file". In any given CopyStmt, exactly one of "relation"
2755 * and "query" must be non-NULL.
2756 * ----------------------
2757 */
2758typedef struct CopyStmt
2759{
2761 RangeVar *relation; /* the relation to copy */
2762 Node *query; /* the query (SELECT or DML statement with
2763 * RETURNING) to copy, as a raw parse tree */
2764 List *attlist; /* List of column names (as Strings), or NIL
2765 * for all columns */
2766 bool is_from; /* TO or FROM */
2767 bool is_program; /* is 'filename' a program to popen? */
2768 char *filename; /* filename, or NULL for STDIN/STDOUT */
2769 List *options; /* List of DefElem nodes */
2770 Node *whereClause; /* WHERE condition (or NULL) */
2772
2773/* ----------------------
2774 * SET Statement (includes RESET)
2775 *
2776 * "SET var TO DEFAULT" and "RESET var" are semantically equivalent, but we
2777 * preserve the distinction in VariableSetKind for CreateCommandTag().
2778 * ----------------------
2779 */
2781{
2782 VAR_SET_VALUE, /* SET var = value */
2783 VAR_SET_DEFAULT, /* SET var TO DEFAULT */
2784 VAR_SET_CURRENT, /* SET var FROM CURRENT */
2785 VAR_SET_MULTI, /* special case for SET TRANSACTION ... */
2786 VAR_RESET, /* RESET var */
2787 VAR_RESET_ALL, /* RESET ALL */
2789
2790typedef struct VariableSetStmt
2791{
2793
2794 NodeTag type;
2796 /* variable to be set */
2797 char *name;
2798 /* List of A_Const nodes */
2800
2801 /*
2802 * True if arguments should be accounted for in query jumbling. We use a
2803 * separate flag rather than query_jumble_ignore on "args" as several
2804 * grammar flavors of SET rely on a list of values that are parsed
2805 * directly from the grammar's keywords.
2806 */
2808 /* SET LOCAL? */
2810 /* token location, or -1 if unknown */
2813
2814/* ----------------------
2815 * Show Statement
2816 * ----------------------
2817 */
2823
2824/* ----------------------
2825 * Create Table Statement
2826 *
2827 * NOTE: in the raw gram.y output, ColumnDef and Constraint nodes are
2828 * intermixed in tableElts, and constraints and nnconstraints are NIL. After
2829 * parse analysis, tableElts contains just ColumnDefs, nnconstraints contains
2830 * Constraint nodes of CONSTR_NOTNULL type from various sources, and
2831 * constraints contains just CONSTR_CHECK Constraint nodes.
2832 * ----------------------
2833 */
2834
2835typedef struct CreateStmt
2836{
2838 RangeVar *relation; /* relation to create */
2839 List *tableElts; /* column definitions (list of ColumnDef) */
2840 List *inhRelations; /* relations to inherit from (list of
2841 * RangeVar) */
2842 PartitionBoundSpec *partbound; /* FOR VALUES clause */
2843 PartitionSpec *partspec; /* PARTITION BY clause */
2844 TypeName *ofTypename; /* OF typename */
2845 List *constraints; /* constraints (list of Constraint nodes) */
2846 List *nnconstraints; /* NOT NULL constraints (ditto) */
2847 List *options; /* options from WITH clause */
2848 OnCommitAction oncommit; /* what do we do at COMMIT? */
2849 char *tablespacename; /* table space to use, or NULL */
2850 char *accessMethod; /* table access method */
2851 bool if_not_exists; /* just do nothing if it already exists? */
2853
2854/* ----------
2855 * Definitions for constraints in CreateStmt
2856 *
2857 * Note that column defaults are treated as a type of constraint,
2858 * even though that's a bit odd semantically.
2859 *
2860 * For constraints that use expressions (CONSTR_CHECK, CONSTR_DEFAULT)
2861 * we may have the expression in either "raw" form (an untransformed
2862 * parse tree) or "cooked" form (the nodeToString representation of
2863 * an executable expression tree), depending on how this Constraint
2864 * node was created (by parsing, or by inheritance from an existing
2865 * relation). We should never have both in the same node!
2866 *
2867 * FKCONSTR_ACTION_xxx values are stored into pg_constraint.confupdtype
2868 * and pg_constraint.confdeltype columns; FKCONSTR_MATCH_xxx values are
2869 * stored into pg_constraint.confmatchtype. Changing the code values may
2870 * require an initdb!
2871 *
2872 * If skip_validation is true then we skip checking that the existing rows
2873 * in the table satisfy the constraint, and just install the catalog entries
2874 * for the constraint. A new FK constraint is marked as valid iff
2875 * initially_valid is true. (Usually skip_validation and initially_valid
2876 * are inverses, but we can set both true if the table is known empty.)
2877 *
2878 * Constraint attributes (DEFERRABLE etc) are initially represented as
2879 * separate Constraint nodes for simplicity of parsing. parse_utilcmd.c makes
2880 * a pass through the constraints list to insert the info into the appropriate
2881 * Constraint node.
2882 * ----------
2883 */
2884
2905
2906/* Foreign key action codes */
2907#define FKCONSTR_ACTION_NOACTION 'a'
2908#define FKCONSTR_ACTION_RESTRICT 'r'
2909#define FKCONSTR_ACTION_CASCADE 'c'
2910#define FKCONSTR_ACTION_SETNULL 'n'
2911#define FKCONSTR_ACTION_SETDEFAULT 'd'
2912
2913/* Foreign key matchtype codes */
2914#define FKCONSTR_MATCH_FULL 'f'
2915#define FKCONSTR_MATCH_PARTIAL 'p'
2916#define FKCONSTR_MATCH_SIMPLE 's'
2917
2918typedef struct Constraint
2919{
2921 ConstrType contype; /* see above */
2922 char *conname; /* Constraint name, or NULL if unnamed */
2923 bool deferrable; /* DEFERRABLE? */
2924 bool initdeferred; /* INITIALLY DEFERRED? */
2925 bool is_enforced; /* enforced constraint? */
2926 bool skip_validation; /* skip validation of existing rows? */
2927 bool initially_valid; /* mark the new constraint as valid? */
2928 bool is_no_inherit; /* is constraint non-inheritable? */
2929 Node *raw_expr; /* CHECK or DEFAULT expression, as
2930 * untransformed parse tree */
2931 char *cooked_expr; /* CHECK or DEFAULT expression, as
2932 * nodeToString representation */
2933 char generated_when; /* ALWAYS or BY DEFAULT */
2934 char generated_kind; /* STORED or VIRTUAL */
2935 bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
2936 List *keys; /* String nodes naming referenced key
2937 * column(s); for UNIQUE/PK/NOT NULL */
2938 bool without_overlaps; /* WITHOUT OVERLAPS specified */
2939 List *including; /* String nodes naming referenced nonkey
2940 * column(s); for UNIQUE/PK */
2941 List *exclusions; /* list of (IndexElem, operator name) pairs;
2942 * for exclusion constraints */
2943 List *options; /* options from WITH clause */
2944 char *indexname; /* existing index to use; otherwise NULL */
2945 char *indexspace; /* index tablespace; NULL for default */
2946 bool reset_default_tblspc; /* reset default_tablespace prior to
2947 * creating the index */
2948 char *access_method; /* index access method; NULL for default */
2949 Node *where_clause; /* partial index predicate */
2950
2951 /* Fields used for FOREIGN KEY constraints: */
2952 RangeVar *pktable; /* Primary key table */
2953 List *fk_attrs; /* Attributes of foreign key */
2954 List *pk_attrs; /* Corresponding attrs in PK table */
2955 bool fk_with_period; /* Last attribute of FK uses PERIOD */
2956 bool pk_with_period; /* Last attribute of PK uses PERIOD */
2957 char fk_matchtype; /* FULL, PARTIAL, SIMPLE */
2958 char fk_upd_action; /* ON UPDATE action */
2959 char fk_del_action; /* ON DELETE action */
2960 List *fk_del_set_cols; /* ON DELETE SET NULL/DEFAULT (col1, col2) */
2961 List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */
2962 Oid old_pktable_oid; /* pg_constraint.confrelid of my former
2963 * self */
2964
2965 ParseLoc location; /* token location, or -1 if unknown */
2967
2968/* ----------------------
2969 * Create/Drop Table Space Statements
2970 * ----------------------
2971 */
2972
2981
2983{
2986 bool missing_ok; /* skip error if missing? */
2988
2996
2998{
3001 ObjectType objtype; /* Object type to move */
3002 List *roles; /* List of roles to move objects of */
3006
3007/* ----------------------
3008 * Create/Alter Extension Statements
3009 * ----------------------
3010 */
3011
3013{
3015 char *extname;
3016 bool if_not_exists; /* just do nothing if it already exists? */
3017 List *options; /* List of DefElem nodes */
3019
3020/* Only used for ALTER EXTENSION UPDATE; later might need an action field */
3022{
3024 char *extname;
3025 List *options; /* List of DefElem nodes */
3027
3029{
3031 char *extname; /* Extension's name */
3032 int action; /* +1 = add object, -1 = drop object */
3033 ObjectType objtype; /* Object's type */
3034 Node *object; /* Qualified name of the object */
3036
3037/* ----------------------
3038 * Create/Alter FOREIGN DATA WRAPPER Statements
3039 * ----------------------
3040 */
3041
3042typedef struct CreateFdwStmt
3043{
3045 char *fdwname; /* foreign-data wrapper name */
3046 List *func_options; /* HANDLER/VALIDATOR options */
3047 List *options; /* generic options to FDW */
3049
3050typedef struct AlterFdwStmt
3051{
3053 char *fdwname; /* foreign-data wrapper name */
3054 List *func_options; /* HANDLER/VALIDATOR options */
3055 List *options; /* generic options to FDW */
3057
3058/* ----------------------
3059 * Create/Alter FOREIGN SERVER Statements
3060 * ----------------------
3061 */
3062
3064{
3066 char *servername; /* server name */
3067 char *servertype; /* optional server type */
3068 char *version; /* optional server version */
3069 char *fdwname; /* FDW name */
3070 bool if_not_exists; /* just do nothing if it already exists? */
3071 List *options; /* generic options to server */
3073
3075{
3077 char *servername; /* server name */
3078 char *version; /* optional server version */
3079 List *options; /* generic options to server */
3080 bool has_version; /* version specified */
3082
3083/* ----------------------
3084 * Create FOREIGN TABLE Statement
3085 * ----------------------
3086 */
3087
3094
3095/* ----------------------
3096 * Create/Drop USER MAPPING Statements
3097 * ----------------------
3098 */
3099
3101{
3103 RoleSpec *user; /* user role */
3104 char *servername; /* server name */
3105 bool if_not_exists; /* just do nothing if it already exists? */
3106 List *options; /* generic options to server */
3108
3110{
3112 RoleSpec *user; /* user role */
3113 char *servername; /* server name */
3114 List *options; /* generic options to server */
3116
3118{
3120 RoleSpec *user; /* user role */
3121 char *servername; /* server name */
3122 bool missing_ok; /* ignore missing mappings */
3124
3125/* ----------------------
3126 * Import Foreign Schema Statement
3127 * ----------------------
3128 */
3129
3131{
3132 FDW_IMPORT_SCHEMA_ALL, /* all relations wanted */
3133 FDW_IMPORT_SCHEMA_LIMIT_TO, /* include only listed tables in import */
3134 FDW_IMPORT_SCHEMA_EXCEPT, /* exclude listed tables from import */
3136
3138{
3140 char *server_name; /* FDW server name */
3141 char *remote_schema; /* remote schema name to query */
3142 char *local_schema; /* local schema to create objects in */
3143 ImportForeignSchemaType list_type; /* type of table list */
3144 List *table_list; /* List of RangeVar */
3145 List *options; /* list of options to pass to FDW */
3147
3148/*----------------------
3149 * Create POLICY Statement
3150 *----------------------
3151 */
3152typedef struct CreatePolicyStmt
3153{
3155 char *policy_name; /* Policy's name */
3156 RangeVar *table; /* the table name the policy applies to */
3157 char *cmd_name; /* the command name the policy applies to */
3158 bool permissive; /* restrictive or permissive policy */
3159 List *roles; /* the roles associated with the policy */
3160 Node *qual; /* the policy's condition */
3161 Node *with_check; /* the policy's WITH CHECK condition. */
3163
3164/*----------------------
3165 * Alter POLICY Statement
3166 *----------------------
3167 */
3168typedef struct AlterPolicyStmt
3169{
3171 char *policy_name; /* Policy's name */
3172 RangeVar *table; /* the table name the policy applies to */
3173 List *roles; /* the roles associated with the policy */
3174 Node *qual; /* the policy's condition */
3175 Node *with_check; /* the policy's WITH CHECK condition. */
3177
3178/*----------------------
3179 * Create ACCESS METHOD Statement
3180 *----------------------
3181 */
3182typedef struct CreateAmStmt
3183{
3185 char *amname; /* access method name */
3186 List *handler_name; /* handler function name */
3187 char amtype; /* type of access method */
3189
3190/* ----------------------
3191 * Create TRIGGER Statement
3192 * ----------------------
3193 */
3194typedef struct CreateTrigStmt
3195{
3197 bool replace; /* replace trigger if already exists */
3198 bool isconstraint; /* This is a constraint trigger */
3199 char *trigname; /* TRIGGER's name */
3200 RangeVar *relation; /* relation trigger is on */
3201 List *funcname; /* qual. name of function to call */
3202 List *args; /* list of String or NIL */
3203 bool row; /* ROW/STATEMENT */
3204 /* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
3205 int16 timing; /* BEFORE, AFTER, or INSTEAD */
3206 /* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
3207 int16 events; /* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */
3208 List *columns; /* column names, or NIL for all columns */
3209 Node *whenClause; /* qual expression, or NULL if none */
3210 /* explicitly named transition data */
3211 List *transitionRels; /* TriggerTransition nodes, or NIL if none */
3212 /* The remaining fields are only used for constraint triggers */
3213 bool deferrable; /* [NOT] DEFERRABLE */
3214 bool initdeferred; /* INITIALLY {DEFERRED|IMMEDIATE} */
3215 RangeVar *constrrel; /* opposite relation, if RI trigger */
3217
3218/* ----------------------
3219 * Create EVENT TRIGGER Statement
3220 * ----------------------
3221 */
3223{
3225 char *trigname; /* TRIGGER's name */
3226 char *eventname; /* event's identifier */
3227 List *whenclause; /* list of DefElems indicating filtering */
3228 List *funcname; /* qual. name of function to call */
3230
3231/* ----------------------
3232 * Alter EVENT TRIGGER Statement
3233 * ----------------------
3234 */
3236{
3238 char *trigname; /* TRIGGER's name */
3239 char tgenabled; /* trigger's firing configuration WRT
3240 * session_replication_role */
3242
3243/* ----------------------
3244 * Create LANGUAGE Statements
3245 * ----------------------
3246 */
3247typedef struct CreatePLangStmt
3248{
3250 bool replace; /* T => replace if already exists */
3251 char *plname; /* PL name */
3252 List *plhandler; /* PL call handler function (qual. name) */
3253 List *plinline; /* optional inline function (qual. name) */
3254 List *plvalidator; /* optional validator function (qual. name) */
3255 bool pltrusted; /* PL is trusted */
3257
3258/* ----------------------
3259 * Create/Alter/Drop Role Statements
3260 *
3261 * Note: these node types are also used for the backwards-compatible
3262 * Create/Alter/Drop User/Group statements. In the ALTER and DROP cases
3263 * there's really no need to distinguish what the original spelling was,
3264 * but for CREATE we mark the type because the defaults vary.
3265 * ----------------------
3266 */
3273
3274typedef struct CreateRoleStmt
3275{
3277 RoleStmtType stmt_type; /* ROLE/USER/GROUP */
3278 char *role; /* role name */
3279 List *options; /* List of DefElem nodes */
3281
3282typedef struct AlterRoleStmt
3283{
3285 RoleSpec *role; /* role */
3286 List *options; /* List of DefElem nodes */
3287 int action; /* +1 = add members, -1 = drop members */
3289
3290typedef struct AlterRoleSetStmt
3291{
3293 RoleSpec *role; /* role */
3294 char *database; /* database name, or NULL */
3295 VariableSetStmt *setstmt; /* SET or RESET subcommand */
3297
3298typedef struct DropRoleStmt
3299{
3301 List *roles; /* List of roles to remove */
3302 bool missing_ok; /* skip error if a role is missing? */
3304
3305/* ----------------------
3306 * {Create|Alter} SEQUENCE Statement
3307 * ----------------------
3308 */
3309
3310typedef struct CreateSeqStmt
3311{
3313 RangeVar *sequence; /* the sequence to create */
3315 Oid ownerId; /* ID of owner, or InvalidOid for default */
3317 bool if_not_exists; /* just do nothing if it already exists? */
3319
3320typedef struct AlterSeqStmt
3321{
3323 RangeVar *sequence; /* the sequence to alter */
3326 bool missing_ok; /* skip error if a role is missing? */
3328
3329/* ----------------------
3330 * Create {Aggregate|Operator|Type} Statement
3331 * ----------------------
3332 */
3333typedef struct DefineStmt
3334{
3336 ObjectType kind; /* aggregate, operator, type */
3337 bool oldstyle; /* hack to signal old CREATE AGG syntax */
3338 List *defnames; /* qualified name (list of String) */
3339 List *args; /* a list of TypeName (if needed) */
3340 List *definition; /* a list of DefElem */
3341 bool if_not_exists; /* just do nothing if it already exists? */
3342 bool replace; /* replace if already exists? */
3344
3345/* ----------------------
3346 * Create Domain Statement
3347 * ----------------------
3348 */
3349typedef struct CreateDomainStmt
3350{
3352 List *domainname; /* qualified name (list of String) */
3353 TypeName *typeName; /* the base type */
3354 CollateClause *collClause; /* untransformed COLLATE spec, if any */
3355 List *constraints; /* constraints (list of Constraint nodes) */
3357
3358/* ----------------------
3359 * Create Operator Class Statement
3360 * ----------------------
3361 */
3362typedef struct CreateOpClassStmt
3363{
3365 List *opclassname; /* qualified name (list of String) */
3366 List *opfamilyname; /* qualified name (ditto); NIL if omitted */
3367 char *amname; /* name of index AM opclass is for */
3368 TypeName *datatype; /* datatype of indexed column */
3369 List *items; /* List of CreateOpClassItem nodes */
3370 bool isDefault; /* Should be marked as default for type? */
3372
3373#define OPCLASS_ITEM_OPERATOR 1
3374#define OPCLASS_ITEM_FUNCTION 2
3375#define OPCLASS_ITEM_STORAGETYPE 3
3376
3377typedef struct CreateOpClassItem
3378{
3380 int itemtype; /* see codes above */
3381 ObjectWithArgs *name; /* operator or function name and args */
3382 int number; /* strategy num or support proc num */
3383 List *order_family; /* only used for ordering operators */
3384 List *class_args; /* amproclefttype/amprocrighttype or
3385 * amoplefttype/amoprighttype */
3386 /* fields used for a storagetype item: */
3387 TypeName *storedtype; /* datatype stored in index */
3389
3390/* ----------------------
3391 * Create Operator Family Statement
3392 * ----------------------
3393 */
3395{
3397 List *opfamilyname; /* qualified name (list of String) */
3398 char *amname; /* name of index AM opfamily is for */
3400
3401/* ----------------------
3402 * Alter Operator Family Statement
3403 * ----------------------
3404 */
3405typedef struct AlterOpFamilyStmt
3406{
3408 List *opfamilyname; /* qualified name (list of String) */
3409 char *amname; /* name of index AM opfamily is for */
3410 bool isDrop; /* ADD or DROP the items? */
3411 List *items; /* List of CreateOpClassItem nodes */
3413
3414/* ----------------------
3415 * Drop Table|Sequence|View|Index|Type|Domain|Conversion|Schema Statement
3416 * ----------------------
3417 */
3418
3419typedef struct DropStmt
3420{
3422 List *objects; /* list of names */
3423 ObjectType removeType; /* object type */
3424 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3425 bool missing_ok; /* skip error if object is missing? */
3426 bool concurrent; /* drop index concurrently? */
3428
3429/* ----------------------
3430 * Truncate Table Statement
3431 * ----------------------
3432 */
3433typedef struct TruncateStmt
3434{
3436 List *relations; /* relations (RangeVars) to be truncated */
3437 bool restart_seqs; /* restart owned sequences? */
3438 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3440
3441/* ----------------------
3442 * Comment On Statement
3443 * ----------------------
3444 */
3445typedef struct CommentStmt
3446{
3448 ObjectType objtype; /* Object's type */
3449 Node *object; /* Qualified name of the object */
3450 char *comment; /* Comment to insert, or NULL to remove */
3452
3453/* ----------------------
3454 * SECURITY LABEL Statement
3455 * ----------------------
3456 */
3457typedef struct SecLabelStmt
3458{
3460 ObjectType objtype; /* Object's type */
3461 Node *object; /* Qualified name of the object */
3462 char *provider; /* Label provider (or NULL) */
3463 char *label; /* New security label to be assigned */
3465
3466/* ----------------------
3467 * Declare Cursor Statement
3468 *
3469 * The "query" field is initially a raw parse tree, and is converted to a
3470 * Query node during parse analysis. Note that rewriting and planning
3471 * of the query are always postponed until execution.
3472 * ----------------------
3473 */
3474#define CURSOR_OPT_BINARY 0x0001 /* BINARY */
3475#define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */
3476#define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */
3477#define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */
3478#define CURSOR_OPT_ASENSITIVE 0x0010 /* ASENSITIVE */
3479#define CURSOR_OPT_HOLD 0x0020 /* WITH HOLD */
3480/* these planner-control flags do not correspond to any SQL grammar: */
3481#define CURSOR_OPT_FAST_PLAN 0x0100 /* prefer fast-start plan */
3482#define CURSOR_OPT_GENERIC_PLAN 0x0200 /* force use of generic plan */
3483#define CURSOR_OPT_CUSTOM_PLAN 0x0400 /* force use of custom plan */
3484#define CURSOR_OPT_PARALLEL_OK 0x0800 /* parallel mode OK */
3485
3486typedef struct DeclareCursorStmt
3487{
3489 char *portalname; /* name of the portal (cursor) */
3490 int options; /* bitmask of options (see above) */
3491 Node *query; /* the query (see comments above) */
3493
3494/* ----------------------
3495 * Close Portal Statement
3496 * ----------------------
3497 */
3498typedef struct ClosePortalStmt
3499{
3501 char *portalname; /* name of the portal (cursor) */
3502 /* NULL means CLOSE ALL */
3504
3505/* ----------------------
3506 * Fetch Statement (also Move)
3507 * ----------------------
3508 */
3509typedef enum FetchDirection
3510{
3511 /* for these, howMany is how many rows to fetch; FETCH_ALL means ALL */
3514 /* for these, howMany indicates a position; only one row is fetched */
3518
3534
3535#define FETCH_ALL LONG_MAX
3536
3537typedef struct FetchStmt
3538{
3540 FetchDirection direction; /* see above */
3541 /* number of rows, or position argument */
3543 /* name of portal (cursor) */
3545 /* true if MOVE */
3547
3548 /*
3549 * Set when a direction_keyword (e.g., FETCH FORWARD) is used, to
3550 * distinguish it from a numeric variant (e.g., FETCH 1) for the purpose
3551 * of query jumbling.
3552 */
3554
3555 /* token location, or -1 if unknown */
3558
3559/* ----------------------
3560 * Create Index Statement
3561 *
3562 * This represents creation of an index and/or an associated constraint.
3563 * If isconstraint is true, we should create a pg_constraint entry along
3564 * with the index. But if indexOid isn't InvalidOid, we are not creating an
3565 * index, just a UNIQUE/PKEY constraint using an existing index. isconstraint
3566 * must always be true in this case, and the fields describing the index
3567 * properties are empty.
3568 * ----------------------
3569 */
3570typedef struct IndexStmt
3571{
3573 char *idxname; /* name of new index, or NULL for default */
3574 RangeVar *relation; /* relation to build index on */
3575 char *accessMethod; /* name of access method (eg. btree) */
3576 char *tableSpace; /* tablespace, or NULL for default */
3577 List *indexParams; /* columns to index: a list of IndexElem */
3578 List *indexIncludingParams; /* additional columns to index: a list
3579 * of IndexElem */
3580 List *options; /* WITH clause options: a list of DefElem */
3581 Node *whereClause; /* qualification (partial-index predicate) */
3582 List *excludeOpNames; /* exclusion operator names, or NIL if none */
3583 char *idxcomment; /* comment to apply to index, or NULL */
3584 Oid indexOid; /* OID of an existing index, if any */
3585 RelFileNumber oldNumber; /* relfilenumber of existing storage, if any */
3586 SubTransactionId oldCreateSubid; /* rd_createSubid of oldNumber */
3587 SubTransactionId oldFirstRelfilelocatorSubid; /* rd_firstRelfilelocatorSubid
3588 * of oldNumber */
3589 bool unique; /* is index unique? */
3590 bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
3591 bool primary; /* is index a primary key? */
3592 bool isconstraint; /* is it for a pkey/unique constraint? */
3593 bool iswithoutoverlaps; /* is the constraint WITHOUT OVERLAPS? */
3594 bool deferrable; /* is the constraint DEFERRABLE? */
3595 bool initdeferred; /* is the constraint INITIALLY DEFERRED? */
3596 bool transformed; /* true when transformIndexStmt is finished */
3597 bool concurrent; /* should this be a concurrent index build? */
3598 bool if_not_exists; /* just do nothing if index already exists? */
3599 bool reset_default_tblspc; /* reset default_tablespace prior to
3600 * executing */
3602
3603/* ----------------------
3604 * Create Statistics Statement
3605 * ----------------------
3606 */
3607typedef struct CreateStatsStmt
3608{
3610 List *defnames; /* qualified name (list of String) */
3611 List *stat_types; /* stat types (list of String) */
3612 List *exprs; /* expressions to build statistics on */
3613 List *relations; /* rels to build stats on (list of RangeVar) */
3614 char *stxcomment; /* comment to apply to stats, or NULL */
3615 bool transformed; /* true when transformStatsStmt is finished */
3616 bool if_not_exists; /* do nothing if stats name already exists */
3618
3619/*
3620 * StatsElem - statistics parameters (used in CREATE STATISTICS)
3621 *
3622 * For a plain attribute, 'name' is the name of the referenced table column
3623 * and 'expr' is NULL. For an expression, 'name' is NULL and 'expr' is the
3624 * expression tree.
3625 */
3626typedef struct StatsElem
3627{
3629 char *name; /* name of attribute to index, or NULL */
3630 Node *expr; /* expression to index, or NULL */
3632
3633
3634/* ----------------------
3635 * Alter Statistics Statement
3636 * ----------------------
3637 */
3638typedef struct AlterStatsStmt
3639{
3641 List *defnames; /* qualified name (list of String) */
3642 Node *stxstattarget; /* statistics target */
3643 bool missing_ok; /* skip error if statistics object is missing */
3645
3646/* ----------------------
3647 * Create Function Statement
3648 * ----------------------
3649 */
3651{
3653 bool is_procedure; /* it's really CREATE PROCEDURE */
3654 bool replace; /* T => replace if already exists */
3655 List *funcname; /* qualified name of function to create */
3656 List *parameters; /* a list of FunctionParameter */
3657 TypeName *returnType; /* the return type */
3658 List *options; /* a list of DefElem */
3661
3663{
3664 /* the assigned enum values appear in pg_proc, don't change 'em! */
3665 FUNC_PARAM_IN = 'i', /* input only */
3666 FUNC_PARAM_OUT = 'o', /* output only */
3667 FUNC_PARAM_INOUT = 'b', /* both */
3668 FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */
3669 FUNC_PARAM_TABLE = 't', /* table function output column */
3670 /* this is not used in pg_proc: */
3671 FUNC_PARAM_DEFAULT = 'd', /* default; effectively same as IN */
3673
3674typedef struct FunctionParameter
3675{
3677 char *name; /* parameter name, or NULL if not given */
3678 TypeName *argType; /* TypeName for parameter type */
3679 FunctionParameterMode mode; /* IN/OUT/etc */
3680 Node *defexpr; /* raw default expr, or NULL if not given */
3681 ParseLoc location; /* token location, or -1 if unknown */
3683
3684typedef struct AlterFunctionStmt
3685{
3688 ObjectWithArgs *func; /* name and args of function */
3689 List *actions; /* list of DefElem */
3691
3692/* ----------------------
3693 * DO Statement
3694 *
3695 * DoStmt is the raw parser output, InlineCodeBlock is the execution-time API
3696 * ----------------------
3697 */
3698typedef struct DoStmt
3699{
3701 List *args; /* List of DefElem nodes */
3703
3704typedef struct InlineCodeBlock
3705{
3706 pg_node_attr(nodetag_only) /* this is not a member of parse trees */
3707
3708 NodeTag type;
3709 char *source_text; /* source text of anonymous code block */
3710 Oid langOid; /* OID of selected language */
3711 bool langIsTrusted; /* trusted property of the language */
3712 bool atomic; /* atomic execution context */
3714
3715/* ----------------------
3716 * CALL statement
3717 *
3718 * OUT-mode arguments are removed from the transformed funcexpr. The outargs
3719 * list contains copies of the expressions for all output arguments, in the
3720 * order of the procedure's declared arguments. (outargs is never evaluated,
3721 * but is useful to the caller as a reference for what to assign to.)
3722 * The transformed call state is not relevant in the query jumbling, only the
3723 * function call is.
3724 * ----------------------
3725 */
3726typedef struct CallStmt
3727{
3729 /* from the parser */
3731 /* transformed call, with only input args */
3733 /* transformed output-argument expressions */
3736
3737typedef struct CallContext
3738{
3739 pg_node_attr(nodetag_only) /* this is not a member of parse trees */
3740
3741 NodeTag type;
3744
3745/* ----------------------
3746 * Alter Object Rename Statement
3747 * ----------------------
3748 */
3749typedef struct RenameStmt
3750{
3752 ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */
3753 ObjectType relationType; /* if column name, associated relation type */
3754 RangeVar *relation; /* in case it's a table */
3755 Node *object; /* in case it's some other object */
3756 char *subname; /* name of contained object (column, rule,
3757 * trigger, etc) */
3758 char *newname; /* the new name */
3759 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3760 bool missing_ok; /* skip error if missing? */
3762
3763/* ----------------------
3764 * ALTER object DEPENDS ON EXTENSION extname
3765 * ----------------------
3766 */
3768{
3770 ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */
3771 RangeVar *relation; /* in case a table is involved */
3772 Node *object; /* name of the object */
3773 String *extname; /* extension name */
3774 bool remove; /* set true to remove dep rather than add */
3776
3777/* ----------------------
3778 * ALTER object SET SCHEMA Statement
3779 * ----------------------
3780 */
3782{
3784 ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
3785 RangeVar *relation; /* in case it's a table */
3786 Node *object; /* in case it's some other object */
3787 char *newschema; /* the new schema */
3788 bool missing_ok; /* skip error if missing? */
3790
3791/* ----------------------
3792 * Alter Object Owner Statement
3793 * ----------------------
3794 */
3795typedef struct AlterOwnerStmt
3796{
3798 ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
3799 RangeVar *relation; /* in case it's a table */
3800 Node *object; /* in case it's some other object */
3801 RoleSpec *newowner; /* the new owner */
3803
3804/* ----------------------
3805 * Alter Operator Set ( this-n-that )
3806 * ----------------------
3807 */
3808typedef struct AlterOperatorStmt
3809{
3811 ObjectWithArgs *opername; /* operator name and argument types */
3812 List *options; /* List of DefElem nodes */
3814
3815/* ------------------------
3816 * Alter Type Set ( this-n-that )
3817 * ------------------------
3818 */
3819typedef struct AlterTypeStmt
3820{
3822 List *typeName; /* type name (possibly qualified) */
3823 List *options; /* List of DefElem nodes */
3825
3826/* ----------------------
3827 * Create Rule Statement
3828 * ----------------------
3829 */
3830typedef struct RuleStmt
3831{
3833 RangeVar *relation; /* relation the rule is for */
3834 char *rulename; /* name of the rule */
3835 Node *whereClause; /* qualifications */
3836 CmdType event; /* SELECT, INSERT, etc */
3837 bool instead; /* is a 'do instead'? */
3838 List *actions; /* the action statements */
3839 bool replace; /* OR REPLACE */
3841
3842/* ----------------------
3843 * Notify Statement
3844 * ----------------------
3845 */
3846typedef struct NotifyStmt
3847{
3849 char *conditionname; /* condition name to notify */
3850 char *payload; /* the payload string, or NULL if none */
3852
3853/* ----------------------
3854 * Listen Statement
3855 * ----------------------
3856 */
3857typedef struct ListenStmt
3858{
3860 char *conditionname; /* condition name to listen on */
3862
3863/* ----------------------
3864 * Unlisten Statement
3865 * ----------------------
3866 */
3867typedef struct UnlistenStmt
3868{
3870 char *conditionname; /* name to unlisten on, or NULL for all */
3872
3873/* ----------------------
3874 * {Begin|Commit|Rollback} Transaction Statement
3875 * ----------------------
3876 */
3890
3891typedef struct TransactionStmt
3892{
3894 TransactionStmtKind kind; /* see above */
3895 List *options; /* for BEGIN/START commands */
3896 /* for savepoint commands */
3898 /* for two-phase-commit related commands */
3900 bool chain; /* AND CHAIN option */
3901 /* token location, or -1 if unknown */
3904
3905/* ----------------------
3906 * Create Type Statement, composite types
3907 * ----------------------
3908 */
3909typedef struct CompositeTypeStmt
3910{
3912 RangeVar *typevar; /* the composite type to be created */
3913 List *coldeflist; /* list of ColumnDef nodes */
3915
3916/* ----------------------
3917 * Create Type Statement, enum types
3918 * ----------------------
3919 */
3920typedef struct CreateEnumStmt
3921{
3923 List *typeName; /* qualified name (list of String) */
3924 List *vals; /* enum values (list of String) */
3926
3927/* ----------------------
3928 * Create Type Statement, range types
3929 * ----------------------
3930 */
3931typedef struct CreateRangeStmt
3932{
3934 List *typeName; /* qualified name (list of String) */
3935 List *params; /* range parameters (list of DefElem) */
3937
3938/* ----------------------
3939 * Alter Type Statement, enum types
3940 * ----------------------
3941 */
3942typedef struct AlterEnumStmt
3943{
3945 List *typeName; /* qualified name (list of String) */
3946 char *oldVal; /* old enum value's name, if renaming */
3947 char *newVal; /* new enum value's name */
3948 char *newValNeighbor; /* neighboring enum value, if specified */
3949 bool newValIsAfter; /* place new enum value after neighbor? */
3950 bool skipIfNewValExists; /* no error if new already exists? */
3952
3953/* ----------------------
3954 * Create View Statement
3955 * ----------------------
3956 */
3963
3964typedef struct ViewStmt
3965{
3967 RangeVar *view; /* the view to be created */
3968 List *aliases; /* target column names */
3969 Node *query; /* the SELECT query (as a raw parse tree) */
3970 bool replace; /* replace an existing view? */
3971 List *options; /* options from WITH clause */
3972 ViewCheckOption withCheckOption; /* WITH CHECK OPTION */
3974
3975/* ----------------------
3976 * Load Statement
3977 * ----------------------
3978 */
3979typedef struct LoadStmt
3980{
3982 char *filename; /* file to load */
3984
3985/* ----------------------
3986 * Createdb Statement
3987 * ----------------------
3988 */
3989typedef struct CreatedbStmt
3990{
3992 char *dbname; /* name of database to create */
3993 List *options; /* List of DefElem nodes */
3995
3996/* ----------------------
3997 * Alter Database
3998 * ----------------------
3999 */
4000typedef struct AlterDatabaseStmt
4001{
4003 char *dbname; /* name of database to alter */
4004 List *options; /* List of DefElem nodes */
4006
4012
4014{
4016 char *dbname; /* database name */
4017 VariableSetStmt *setstmt; /* SET or RESET subcommand */
4019
4020/* ----------------------
4021 * Dropdb Statement
4022 * ----------------------
4023 */
4024typedef struct DropdbStmt
4025{
4027 char *dbname; /* database to drop */
4028 bool missing_ok; /* skip error if db is missing? */
4029 List *options; /* currently only FORCE is supported */
4031
4032/* ----------------------
4033 * Alter System Statement
4034 * ----------------------
4035 */
4041
4042/* ----------------------
4043 * Vacuum and Analyze Statements
4044 *
4045 * Even though these are nominally two statements, it's convenient to use
4046 * just one node type for both.
4047 * ----------------------
4048 */
4049typedef struct VacuumStmt
4050{
4052 List *options; /* list of DefElem nodes */
4053 List *rels; /* list of VacuumRelation, or NIL for all */
4054 bool is_vacuumcmd; /* true for VACUUM, false otherwise */
4056
4057/*
4058 * Info about a single target table of VACUUM/ANALYZE.
4059 *
4060 * If the OID field is set, it always identifies the table to process.
4061 * Then the relation field can be NULL; if it isn't, it's used only to report
4062 * failure to open/lock the relation.
4063 */
4064typedef struct VacuumRelation
4065{
4067 RangeVar *relation; /* table name to process, or NULL */
4068 Oid oid; /* table's OID; InvalidOid if not looked up */
4069 List *va_cols; /* list of column names, or NIL for all */
4071
4072/* ----------------------
4073 * Repack Statement
4074 * ----------------------
4075 */
4082
4083typedef struct RepackStmt
4084{
4086 RepackCommand command; /* type of command being run */
4087 VacuumRelation *relation; /* relation being repacked */
4088 char *indexname; /* order tuples by this index */
4089 bool usingindex; /* whether USING INDEX is specified */
4090 List *params; /* list of DefElem nodes */
4092
4093/* ----------------------
4094 * Explain Statement
4095 *
4096 * The "query" field is initially a raw parse tree, and is converted to a
4097 * Query node during parse analysis. Note that rewriting and planning
4098 * of the query are always postponed until execution.
4099 * ----------------------
4100 */
4101typedef struct ExplainStmt
4102{
4104 Node *query; /* the query (see comments above) */
4105 List *options; /* list of DefElem nodes */
4107
4108/* ----------------------
4109 * CREATE TABLE AS Statement (a/k/a SELECT INTO)
4110 *
4111 * A query written as CREATE TABLE AS will produce this node type natively.
4112 * A query written as SELECT ... INTO will be transformed to this form during
4113 * parse analysis.
4114 * A query written as CREATE MATERIALIZED view will produce this node type,
4115 * during parse analysis, since it needs all the same data.
4116 *
4117 * The "query" field is handled similarly to EXPLAIN, though note that it
4118 * can be a SELECT or an EXECUTE, but not other DML statements.
4119 * ----------------------
4120 */
4121typedef struct CreateTableAsStmt
4122{
4124 Node *query; /* the query (see comments above) */
4125 IntoClause *into; /* destination table */
4126 ObjectType objtype; /* OBJECT_TABLE or OBJECT_MATVIEW */
4127 bool is_select_into; /* it was written as SELECT INTO */
4128 bool if_not_exists; /* just do nothing if it already exists? */
4130
4131/* ----------------------
4132 * REFRESH MATERIALIZED VIEW Statement
4133 * ----------------------
4134 */
4136{
4138 bool concurrent; /* allow concurrent access? */
4139 bool skipData; /* true for WITH NO DATA */
4140 RangeVar *relation; /* relation to insert into */
4142
4143/* ----------------------
4144 * Checkpoint Statement
4145 * ----------------------
4146 */
4147typedef struct CheckPointStmt
4148{
4150 List *options; /* list of DefElem nodes */
4152
4153/* ----------------------
4154 * Discard Statement
4155 * ----------------------
4156 */
4157
4165
4171
4172/* ----------------------
4173 * LOCK Statement
4174 * ----------------------
4175 */
4176typedef struct LockStmt
4177{
4179 List *relations; /* relations to lock */
4180 int mode; /* lock mode */
4181 bool nowait; /* no wait mode */
4183
4184/* ----------------------
4185 * SET CONSTRAINTS Statement
4186 * ----------------------
4187 */
4189{
4191 List *constraints; /* List of names as RangeVars */
4194
4195/* ----------------------
4196 * REINDEX Statement
4197 * ----------------------
4198 */
4200{
4202 REINDEX_OBJECT_TABLE, /* table or materialized view */
4204 REINDEX_OBJECT_SYSTEM, /* system catalogs */
4207
4208typedef struct ReindexStmt
4209{
4211 ReindexObjectType kind; /* REINDEX_OBJECT_INDEX, REINDEX_OBJECT_TABLE,
4212 * etc. */
4213 RangeVar *relation; /* Table or index to reindex */
4214 const char *name; /* name of database to reindex */
4215 List *params; /* list of DefElem nodes */
4217
4218/* ----------------------
4219 * CREATE CONVERSION Statement
4220 * ----------------------
4221 */
4223{
4225 List *conversion_name; /* Name of the conversion */
4226 char *for_encoding_name; /* source encoding name */
4227 char *to_encoding_name; /* destination encoding name */
4228 List *func_name; /* qualified conversion function name */
4229 bool def; /* is this a default conversion? */
4231
4232/* ----------------------
4233 * CREATE CAST Statement
4234 * ----------------------
4235 */
4245
4246/* ----------------------
4247 * CREATE PROPERTY GRAPH Statement
4248 * ----------------------
4249 */
4257
4266
4281
4289
4297
4298/* ----------------------
4299 * ALTER PROPERTY GRAPH Statement
4300 * ----------------------
4301 */
4302
4308
4327
4328/* ----------------------
4329 * CREATE TRANSFORM Statement
4330 * ----------------------
4331 */
4341
4342/* ----------------------
4343 * PREPARE Statement
4344 * ----------------------
4345 */
4346typedef struct PrepareStmt
4347{
4349 char *name; /* Name of plan, arbitrary */
4350 List *argtypes; /* Types of parameters (List of TypeName) */
4351 Node *query; /* The query itself (as a raw parsetree) */
4353
4354
4355/* ----------------------
4356 * EXECUTE Statement
4357 * ----------------------
4358 */
4359
4360typedef struct ExecuteStmt
4361{
4363 char *name; /* The name of the plan to execute */
4364 List *params; /* Values to assign to parameters */
4366
4367
4368/* ----------------------
4369 * DEALLOCATE Statement
4370 * ----------------------
4371 */
4372typedef struct DeallocateStmt
4373{
4375 /* The name of the plan to remove, NULL if DEALLOCATE ALL */
4377
4378 /*
4379 * True if DEALLOCATE ALL. This is redundant with "name == NULL", but we
4380 * make it a separate field so that exactly this condition (and not the
4381 * precise name) will be accounted for in query jumbling.
4382 */
4383 bool isall;
4384 /* token location, or -1 if unknown */
4387
4388/*
4389 * DROP OWNED statement
4390 */
4397
4398/*
4399 * REASSIGN OWNED statement
4400 */
4407
4408/*
4409 * TS Dictionary stmts: DefineStmt, RenameStmt and DropStmt are default
4410 */
4412{
4414 List *dictname; /* qualified name (list of String) */
4415 List *options; /* List of DefElem nodes */
4417
4418/*
4419 * TS Configuration stmts: DefineStmt, RenameStmt and DropStmt are default
4420 */
4429
4431{
4433 AlterTSConfigType kind; /* ALTER_TSCONFIG_ADD_MAPPING, etc */
4434 List *cfgname; /* qualified name (list of String) */
4435
4436 /*
4437 * dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is
4438 * NIL, but tokentype isn't, DROP MAPPING was specified.
4439 */
4440 List *tokentype; /* list of String */
4441 List *dicts; /* list of list of String */
4442 bool override; /* if true - remove old variant */
4443 bool replace; /* if true - replace dictionary by another */
4444 bool missing_ok; /* for DROP - skip error if missing? */
4446
4447typedef struct PublicationTable
4448{
4450 RangeVar *relation; /* publication relation */
4451 Node *whereClause; /* qualifications */
4452 List *columns; /* List of columns in a publication table */
4453 bool except; /* True if listed in the EXCEPT clause */
4455
4456/*
4457 * Publication object type
4458 */
4460{
4462 PUBLICATIONOBJ_EXCEPT_TABLE, /* A table in the EXCEPT clause */
4463 PUBLICATIONOBJ_TABLES_IN_SCHEMA, /* All tables in schema */
4464 PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA, /* All tables in first element of
4465 * search_path */
4466 PUBLICATIONOBJ_CONTINUATION, /* Continuation of previous type */
4468
4470{
4472 PublicationObjSpecType pubobjtype; /* type of this publication object */
4473 char *name;
4475 ParseLoc location; /* token location, or -1 if unknown */
4477
4478/*
4479 * Types of objects supported by FOR ALL publications
4480 */
4486
4488{
4490 PublicationAllObjType pubobjtype; /* type of this publication object */
4491 List *except_tables; /* tables specified in the EXCEPT clause */
4492 ParseLoc location; /* token location, or -1 if unknown */
4494
4496{
4498 char *pubname; /* Name of the publication */
4499 List *options; /* List of DefElem nodes */
4500 List *pubobjects; /* Optional list of publication objects */
4501 bool for_all_tables; /* Special publication for all tables in db */
4502 bool for_all_sequences; /* Special publication for all sequences
4503 * in db */
4505
4507{
4508 AP_AddObjects, /* add objects to publication */
4509 AP_DropObjects, /* remove objects from publication */
4510 AP_SetObjects, /* set list of objects */
4512
4514{
4516 char *pubname; /* Name of the publication */
4517
4518 /* parameters used for ALTER PUBLICATION ... WITH */
4519 List *options; /* List of DefElem nodes */
4520
4521 /*
4522 * Parameters used for ALTER PUBLICATION ... ADD/DROP/SET publication
4523 * objects.
4524 */
4525 List *pubobjects; /* Optional list of publication objects */
4526 AlterPublicationAction action; /* What action to perform with the given
4527 * objects */
4528 bool for_all_tables; /* True if ALL TABLES is specified */
4529 bool for_all_sequences; /* True if ALL SEQUENCES is specified */
4531
4533{
4535 char *subname; /* Name of the subscription */
4536 char *servername; /* Server name of publisher */
4537 char *conninfo; /* Connection string to publisher */
4538 List *publication; /* One or more publication to subscribe to */
4539 List *options; /* List of DefElem nodes */
4541
4555
4557{
4559 AlterSubscriptionType kind; /* ALTER_SUBSCRIPTION_OPTIONS, etc */
4560 char *subname; /* Name of the subscription */
4561 char *servername; /* Server name of publisher */
4562 char *conninfo; /* Connection string to publisher */
4563 List *publication; /* One or more publication to subscribe to */
4564 List *options; /* List of DefElem nodes */
4566
4568{
4570 char *subname; /* Name of the subscription */
4571 bool missing_ok; /* Skip error if missing? */
4572 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
4574
4575typedef struct WaitStmt
4576{
4578 char *lsn_literal; /* LSN string from grammar */
4579 List *options; /* List of DefElem nodes */
4581
4582
4583#endif /* PARSENODES_H */
#define PG_INT32_MAX
Definition c.h:675
uint32 SubTransactionId
Definition c.h:742
int64_t int64
Definition c.h:615
int16_t int16
Definition c.h:613
uint32 bits32
Definition c.h:627
int32_t int32
Definition c.h:614
uint64_t uint64
Definition c.h:619
unsigned int Index
Definition c.h:700
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:418
@ ROLESPEC_CURRENT_USER
Definition parsenodes.h:421
@ ROLESPEC_CSTRING
Definition parsenodes.h:419
@ ROLESPEC_SESSION_USER
Definition parsenodes.h:422
@ ROLESPEC_CURRENT_ROLE
Definition parsenodes.h:420
@ ROLESPEC_PUBLIC
Definition parsenodes.h:423
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:329
@ AEXPR_BETWEEN
Definition parsenodes.h:340
@ AEXPR_NULLIF
Definition parsenodes.h:335
@ AEXPR_NOT_DISTINCT
Definition parsenodes.h:334
@ AEXPR_BETWEEN_SYM
Definition parsenodes.h:342
@ AEXPR_NOT_BETWEEN_SYM
Definition parsenodes.h:343
@ AEXPR_ILIKE
Definition parsenodes.h:338
@ AEXPR_IN
Definition parsenodes.h:336
@ AEXPR_NOT_BETWEEN
Definition parsenodes.h:341
@ AEXPR_DISTINCT
Definition parsenodes.h:333
@ AEXPR_SIMILAR
Definition parsenodes.h:339
@ AEXPR_LIKE
Definition parsenodes.h:337
@ AEXPR_OP
Definition parsenodes.h:330
@ AEXPR_OP_ANY
Definition parsenodes.h:331
@ AEXPR_OP_ALL
Definition parsenodes.h:332
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:913
@ PARTITION_STRATEGY_HASH
Definition parsenodes.h:916
@ PARTITION_STRATEGY_LIST
Definition parsenodes.h:914
@ PARTITION_STRATEGY_RANGE
Definition parsenodes.h:915
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:846
@ DEFELEM_UNSPEC
Definition parsenodes.h:847
@ DEFELEM_DROP
Definition parsenodes.h:850
@ DEFELEM_SET
Definition parsenodes.h:848
@ DEFELEM_ADD
Definition parsenodes.h:849
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:965
@ PARTITION_RANGE_DATUM_MAXVALUE
Definition parsenodes.h:968
@ PARTITION_RANGE_DATUM_VALUE
Definition parsenodes.h:967
@ PARTITION_RANGE_DATUM_MINVALUE
Definition parsenodes.h:966
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:801
@ CREATE_TABLE_LIKE_COMMENTS
Definition parsenodes.h:802
@ CREATE_TABLE_LIKE_GENERATED
Definition parsenodes.h:806
@ CREATE_TABLE_LIKE_IDENTITY
Definition parsenodes.h:807
@ CREATE_TABLE_LIKE_COMPRESSION
Definition parsenodes.h:803
@ CREATE_TABLE_LIKE_STORAGE
Definition parsenodes.h:810
@ CREATE_TABLE_LIKE_ALL
Definition parsenodes.h:811
@ CREATE_TABLE_LIKE_INDEXES
Definition parsenodes.h:808
@ CREATE_TABLE_LIKE_DEFAULTS
Definition parsenodes.h:805
@ CREATE_TABLE_LIKE_STATISTICS
Definition parsenodes.h:809
@ CREATE_TABLE_LIKE_CONSTRAINTS
Definition parsenodes.h:804
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:517
List * elements
Definition parsenodes.h:518
ParseLoc list_start
Definition parsenodes.h:519
ParseLoc list_end
Definition parsenodes.h:520
ParseLoc location
Definition parsenodes.h:521
bool isnull
Definition parsenodes.h:388
union ValUnion val
Definition parsenodes.h:387
ParseLoc location
Definition parsenodes.h:389
pg_node_attr(custom_copy_equal, custom_read_write, custom_query_jumble) NodeTag type
ParseLoc location
Definition parsenodes.h:363
ParseLoc rexpr_list_end
Definition parsenodes.h:362
Node * lexpr
Definition parsenodes.h:353
ParseLoc rexpr_list_start
Definition parsenodes.h:361
pg_node_attr(custom_read_write) NodeTag type
List * name
Definition parsenodes.h:352
A_Expr_Kind kind
Definition parsenodes.h:351
Node * rexpr
Definition parsenodes.h:354
bool is_slice
Definition parsenodes.h:485
Node * uidx
Definition parsenodes.h:487
NodeTag type
Definition parsenodes.h:484
Node * lidx
Definition parsenodes.h:486
List * indirection
Definition parsenodes.h:509
NodeTag type
Definition parsenodes.h:473
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:410
ParseLoc location
Definition parsenodes.h:411
bool is_not_null
Definition parsenodes.h:772
CollateClause * collClause
Definition parsenodes.h:782
char identity
Definition parsenodes.h:778
RangeVar * identitySequence
Definition parsenodes.h:779
List * constraints
Definition parsenodes.h:784
Node * cooked_default
Definition parsenodes.h:777
char * storage_name
Definition parsenodes.h:775
char * colname
Definition parsenodes.h:767
TypeName * typeName
Definition parsenodes.h:768
char generated
Definition parsenodes.h:781
NodeTag type
Definition parsenodes.h:766
bool is_from_type
Definition parsenodes.h:773
List * fdwoptions
Definition parsenodes.h:785
Node * raw_default
Definition parsenodes.h:776
char storage
Definition parsenodes.h:774
bool is_local
Definition parsenodes.h:771
int16 inhcount
Definition parsenodes.h:770
char * compression
Definition parsenodes.h:769
ParseLoc location
Definition parsenodes.h:786
ParseLoc location
Definition parsenodes.h:312
List * fields
Definition parsenodes.h:311
NodeTag type
Definition parsenodes.h:310
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:856
NodeTag type
Definition parsenodes.h:855
DefElemAction defaction
Definition parsenodes.h:860
char * defname
Definition parsenodes.h:857
ParseLoc location
Definition parsenodes.h:861
Node * arg
Definition parsenodes.h:858
List * definition
List * defnames
List * args
NodeTag type
ObjectType kind
bool if_not_exists
ReturningClause * returningClause
WithClause * withClause
Node * whereClause
RangeVar * relation
List * usingClause
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
bool agg_within_group
Definition parsenodes.h:457
CoercionForm funcformat
Definition parsenodes.h:461
Node * agg_filter
Definition parsenodes.h:454
List * agg_order
Definition parsenodes.h:453
List * funcname
Definition parsenodes.h:451
List * args
Definition parsenodes.h:452
bool agg_star
Definition parsenodes.h:458
int ignore_nulls
Definition parsenodes.h:456
bool agg_distinct
Definition parsenodes.h:459
NodeTag type
Definition parsenodes.h:450
ParseLoc location
Definition parsenodes.h:462
bool func_variadic
Definition parsenodes.h:460
struct WindowDef * over
Definition parsenodes.h:455
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:825
SortByDir ordering
Definition parsenodes.h:830
List * opclassopts
Definition parsenodes.h:829
NodeTag type
Definition parsenodes.h:823
char * indexcolname
Definition parsenodes.h:826
ParseLoc location
Definition parsenodes.h:832
SortByNulls nulls_ordering
Definition parsenodes.h:831
List * opclass
Definition parsenodes.h:828
char * name
Definition parsenodes.h:824
List * collation
Definition parsenodes.h:827
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:876
LockClauseStrength strength
Definition parsenodes.h:877
LockWaitPolicy waitPolicy
Definition parsenodes.h:878
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:322
NodeTag type
Definition parsenodes.h:320
PartitionBoundSpec * bound
List * partlist
RangeVar * name
List * collation
Definition parsenodes.h:907
ParseLoc location
Definition parsenodes.h:909
PartitionRangeDatumKind kind
Definition parsenodes.h:975
List * partParams
Definition parsenodes.h:928
ParseLoc location
Definition parsenodes.h:929
PartitionStrategy strategy
Definition parsenodes.h:927
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:234
int mergeTargetRelation pg_node_attr(query_jumble_ignore)
bool hasAggs pg_node_attr(query_jumble_ignore)
bool groupDistinct
Definition parsenodes.h:217
bool hasRecursive pg_node_attr(query_jumble_ignore)
Node * mergeJoinCondition
Definition parsenodes.h:196
Node * limitCount
Definition parsenodes.h:231
FromExpr * jointree
Definition parsenodes.h:182
List * returningList
Definition parsenodes.h:214
bool canSetTag pg_node_attr(query_jumble_ignore)
Node * setOperations
Definition parsenodes.h:236
bool hasSubLinks pg_node_attr(query_jumble_ignore)
List * cteList
Definition parsenodes.h:173
OnConflictExpr * onConflict
Definition parsenodes.h:203
char *returningOldAlias pg_node_attr(query_jumble_ignore)
OverridingKind override pg_node_attr(query_jumble_ignore)
List * groupClause
Definition parsenodes.h:216
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:222
List * rtable
Definition parsenodes.h:175
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:230
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:232
Node * utilityStmt
Definition parsenodes.h:141
List * mergeActionList
Definition parsenodes.h:185
bool hasModifyingCTE pg_node_attr(query_jumble_ignore)
NodeTag type
Definition parsenodes.h:119
List * windowClause
Definition parsenodes.h:224
List * targetList
Definition parsenodes.h:198
List * groupingSets
Definition parsenodes.h:220
bool groupByAll
Definition parsenodes.h:218
List * distinctClause
Definition parsenodes.h:226
bool hasForUpdate pg_node_attr(query_jumble_ignore)
List * sortClause
Definition parsenodes.h:228
char *returningNewAlias pg_node_attr(query_jumble_ignore)
ParseLoc stmt_location
Definition parsenodes.h:255
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:672
List * coldeflist
Definition parsenodes.h:673
List * functions
Definition parsenodes.h:671
struct GraphPattern * graph_pattern
Definition parsenodes.h:720
ParseLoc location
Definition parsenodes.h:723
RangeVar * graph_name
Definition parsenodes.h:719
TypeName * typeName
Definition parsenodes.h:705
List * namespaces
Definition parsenodes.h:689
ParseLoc location
Definition parsenodes.h:692
ParseLoc location
Definition parsenodes.h:743
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:547
ParseLoc location
Definition parsenodes.h:548
List * indirection
Definition parsenodes.h:546
char * name
Definition parsenodes.h:545
NodeTag type
Definition parsenodes.h:544
NodeTag type
Node * returnval
ReturningOptionKind option
ParseLoc location
ParseLoc location
Definition parsenodes.h:431
RoleSpecType roletype
Definition parsenodes.h:429
NodeTag type
Definition parsenodes.h:428
char * rolename
Definition parsenodes.h:430
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:991
SortByNulls sortby_nulls
Definition parsenodes.h:576
Node * node
Definition parsenodes.h:574
NodeTag type
Definition parsenodes.h:573
List * useOp
Definition parsenodes.h:577
SortByDir sortby_dir
Definition parsenodes.h:575
ParseLoc location
Definition parsenodes.h:578
bool hashable pg_node_attr(query_jumble_ignore)
NodeTag type
char * name
Node * expr
Definition value.h:64
RangeVar * relation
Definition parsenodes.h:795
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:399
ParseLoc location
Definition parsenodes.h:400
Node * arg
Definition parsenodes.h:398
NodeTag type
Definition parsenodes.h:397
bool setof
Definition parsenodes.h:287
Oid typeOid
Definition parsenodes.h:286
bool pct_type
Definition parsenodes.h:288
List * names
Definition parsenodes.h:285
NodeTag type
Definition parsenodes.h:284
List * arrayBounds
Definition parsenodes.h:291
int32 typemod
Definition parsenodes.h:290
ParseLoc location
Definition parsenodes.h:292
List * typmods
Definition parsenodes.h:289
char * conditionname
List * targetList
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:595
ParseLoc location
Definition parsenodes.h:599
NodeTag type
Definition parsenodes.h:591
List * partitionClause
Definition parsenodes.h:594
Node * startOffset
Definition parsenodes.h:597
char * refname
Definition parsenodes.h:593
Node * endOffset
Definition parsenodes.h:598
int frameOptions
Definition parsenodes.h:596
char * name
Definition parsenodes.h:592
List * ctes
NodeTag type
ParseLoc location
ParseLoc location
Definition parsenodes.h:891
TypeName * typeName
Definition parsenodes.h:889
NodeTag type
Definition parsenodes.h:886
XmlOptionType xmloption
Definition parsenodes.h:887
BitString bsval
Definition parsenodes.h:379
Node node
Definition parsenodes.h:374
Float fval
Definition parsenodes.h:376
String sval
Definition parsenodes.h:378
Boolean boolval
Definition parsenodes.h:377
Integer ival
Definition parsenodes.h:375
const char * type
const char * name