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 * We ignore fields for query jumbling if they are not semantically
113 * significant (such as alias names). We also ignore anything that can
114 * be deduced from other fields or child nodes, else we'd just be
115 * double-hashing that piece of information. In some places query jumbling
116 * deliberately ignores fields that are semantically significant, such as
117 * Const values, because we have made a policy decision to combine queries
118 * that differ only in those respects.
119 */
120typedef struct Query
121{
123
124 CmdType commandType; /* select|insert|update|delete|merge|utility */
125
126 /* where did I come from? */
128
129 /*
130 * query identifier (can be set by plugins); ignored for equal, as it
131 * might not be set; also not stored. This is the output of query
132 * jumbling, hence it must be ignored as an input.
133 *
134 * We store this as a signed value as this is the form it's displayed to
135 * users in places such as EXPLAIN and pg_stat_statements. Primarily this
136 * is done due to lack of an SQL type to represent the full range of
137 * uint64.
138 */
140
141 /* do I set the command result tag? */
143
144 Node *utilityStmt; /* non-null if commandType == CMD_UTILITY */
145
146 /*
147 * rtable index of target relation for INSERT/UPDATE/DELETE/MERGE; 0 for
148 * SELECT.
149 */
151
152 /* FOR PORTION OF clause for UPDATE/DELETE */
154
155 /* has aggregates in tlist or havingQual */
157 /* has window functions in tlist */
159 /* has set-returning functions in tlist */
161 /* has subquery SubLink */
163 /* distinctClause is from DISTINCT ON */
165 /* WITH RECURSIVE was specified */
167 /* has INSERT/UPDATE/DELETE/MERGE in WITH */
168 bool hasModifyingCTE pg_node_attr(query_jumble_ignore);
169 /* FOR [KEY] UPDATE/SHARE was specified */
171 /* rewriter has applied some RLS policy */
172 bool hasRowSecurity pg_node_attr(query_jumble_ignore);
173 /* parser has added an RTE_GROUP RTE */
175 /* is a RETURN statement */
177
178 List *cteList; /* WITH list (of CommonTableExpr's) */
179
180 List *rtable; /* list of range table entries */
181
182 /*
183 * list of RTEPermissionInfo nodes for the rtable entries having
184 * perminfoindex > 0
185 */
187 FromExpr *jointree; /* table join tree (FROM and WHERE clauses);
188 * also USING clause for MERGE */
189
190 List *mergeActionList; /* list of actions for MERGE (only) */
191
192 /*
193 * rtable index of target relation for MERGE to pull data. Initially, this
194 * is the same as resultRelation, but after query rewriting, if the target
195 * relation is a trigger-updatable view, this is the index of the expanded
196 * view subquery, whereas resultRelation is the index of the target view.
197 */
199
200 /* join condition between source and target for MERGE */
202
203 List *targetList; /* target list (of TargetEntry) */
204
205 /* OVERRIDING clause */
207
208 OnConflictExpr *onConflict; /* ON CONFLICT DO NOTHING/SELECT/UPDATE */
209
210 /*
211 * The following three fields describe the contents of the RETURNING list
212 * for INSERT/UPDATE/DELETE/MERGE. returningOldAlias and returningNewAlias
213 * are the alias names for OLD and NEW, which may be user-supplied values,
214 * the defaults "old" and "new", or NULL (if the default "old"/"new" is
215 * already in use as the alias for some other relation).
216 */
217 char *returningOldAlias pg_node_attr(query_jumble_ignore);
218 char *returningNewAlias pg_node_attr(query_jumble_ignore);
219 List *returningList; /* return-values list (of TargetEntry) */
220
221 List *groupClause; /* a list of SortGroupClause's */
222 bool groupDistinct; /* was GROUP BY DISTINCT used? */
223 bool groupByAll; /* was GROUP BY ALL used? */
224
225 List *groupingSets; /* a list of GroupingSet's if present */
226
227 Node *havingQual; /* qualifications applied to groups */
228
229 List *windowClause; /* a list of WindowClause's */
230
231 List *distinctClause; /* a list of SortGroupClause's */
232
233 List *sortClause; /* a list of SortGroupClause's */
234
235 Node *limitOffset; /* # of result tuples to skip (int8 expr) */
236 Node *limitCount; /* # of result tuples to return (int8 expr) */
237 LimitOption limitOption; /* limit type */
238
239 List *rowMarks; /* a list of RowMarkClause's */
240
241 Node *setOperations; /* set-operation tree if this is top level of
242 * a UNION/INTERSECT/EXCEPT query */
243
244 /*
245 * A list of pg_constraint OIDs that the query depends on to be
246 * semantically valid
247 */
249
250 /* a list of WithCheckOption's (added during rewrite) */
252
253 /*
254 * The following two fields identify the portion of the source text string
255 * containing this query. They are typically only populated in top-level
256 * Queries, not in sub-queries. When not set, they might both be zero, or
257 * both be -1 meaning "unknown".
258 */
259 /* start location, or -1 if unknown */
261 /* length in bytes; 0 means "rest of string" */
264
265
266/****************************************************************************
267 * Supporting data structures for Parse Trees
268 *
269 * Most of these node types appear in raw parsetrees output by the grammar,
270 * and get transformed to something else by the analyzer. A few of them
271 * are used as-is in transformed querytrees.
272 ****************************************************************************/
273
274/*
275 * TypeName - specifies a type in definitions
276 *
277 * For TypeName structures generated internally, it is often easier to
278 * specify the type by OID than by name. If "names" is NIL then the
279 * actual type OID is given by typeOid, otherwise typeOid is unused.
280 * Similarly, if "typmods" is NIL then the actual typmod is expected to
281 * be prespecified in typemod, otherwise typemod is unused.
282 *
283 * If pct_type is true, then names is actually a field name and we look up
284 * the type of that field. Otherwise (the normal case), names is a type
285 * name possibly qualified with schema and database name.
286 */
287typedef struct TypeName
288{
290 List *names; /* qualified name (list of String nodes) */
291 Oid typeOid; /* type identified by OID */
292 bool setof; /* is a set? */
293 bool pct_type; /* %TYPE specified? */
294 List *typmods; /* type modifier expression(s) */
295 int32 typemod; /* prespecified type modifier */
296 List *arrayBounds; /* array bounds */
297 ParseLoc location; /* token location, or -1 if unknown */
299
300/*
301 * ColumnRef - specifies a reference to a column, or possibly a whole tuple
302 *
303 * The "fields" list must be nonempty. It can contain String nodes
304 * (representing names) and A_Star nodes (representing occurrence of a '*').
305 * Currently, A_Star must appear only as the last list element --- the grammar
306 * is responsible for enforcing this!
307 *
308 * Note: any container subscripting or selection of fields from composite columns
309 * is represented by an A_Indirection node above the ColumnRef. However,
310 * for simplicity in the normal case, initial field selection from a table
311 * name is represented within ColumnRef and not by adding A_Indirection.
312 */
313typedef struct ColumnRef
314{
316 List *fields; /* field names (String nodes) or A_Star */
317 ParseLoc location; /* token location, or -1 if unknown */
319
320/*
321 * ParamRef - specifies a $n parameter reference
322 */
323typedef struct ParamRef
324{
326 int number; /* the number of the parameter */
327 ParseLoc location; /* token location, or -1 if unknown */
329
330/*
331 * A_Expr - infix, prefix, and postfix expressions
332 */
333typedef enum A_Expr_Kind
334{
335 AEXPR_OP, /* normal operator */
336 AEXPR_OP_ANY, /* scalar op ANY (array) */
337 AEXPR_OP_ALL, /* scalar op ALL (array) */
338 AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */
339 AEXPR_NOT_DISTINCT, /* IS NOT DISTINCT FROM - name must be "=" */
340 AEXPR_NULLIF, /* NULLIF - name must be "=" */
341 AEXPR_IN, /* [NOT] IN - name must be "=" or "<>" */
342 AEXPR_LIKE, /* [NOT] LIKE - name must be "~~" or "!~~" */
343 AEXPR_ILIKE, /* [NOT] ILIKE - name must be "~~*" or "!~~*" */
344 AEXPR_SIMILAR, /* [NOT] SIMILAR - name must be "~" or "!~" */
345 AEXPR_BETWEEN, /* name must be "BETWEEN" */
346 AEXPR_NOT_BETWEEN, /* name must be "NOT BETWEEN" */
347 AEXPR_BETWEEN_SYM, /* name must be "BETWEEN SYMMETRIC" */
348 AEXPR_NOT_BETWEEN_SYM, /* name must be "NOT BETWEEN SYMMETRIC" */
350
351typedef struct A_Expr
352{
354
356 A_Expr_Kind kind; /* see above */
357 List *name; /* possibly-qualified name of operator */
358 Node *lexpr; /* left argument, or NULL if none */
359 Node *rexpr; /* right argument, or NULL if none */
360
361 /*
362 * If rexpr is a list of some kind, we separately track its starting and
363 * ending location; it's not the same as the starting and ending location
364 * of the token itself.
365 */
368 ParseLoc location; /* token location, or -1 if unknown */
370
371/*
372 * A_Const - a literal constant
373 *
374 * Value nodes are inline for performance. You can treat 'val' as a node,
375 * as in IsA(&val, Integer). 'val' is not valid if isnull is true.
376 */
386
387typedef struct A_Const
388{
390
393 bool isnull; /* SQL NULL constant */
394 ParseLoc location; /* token location, or -1 if unknown */
396
397/*
398 * TypeCast - a CAST expression
399 */
400typedef struct TypeCast
401{
403 Node *arg; /* the expression being casted */
404 TypeName *typeName; /* the target type */
405 ParseLoc location; /* token location, or -1 if unknown */
407
408/*
409 * CollateClause - a COLLATE expression
410 */
411typedef struct CollateClause
412{
414 Node *arg; /* input expression */
415 List *collname; /* possibly-qualified collation name */
416 ParseLoc location; /* token location, or -1 if unknown */
418
419/*
420 * RoleSpec - a role name or one of a few special values.
421 */
422typedef enum RoleSpecType
423{
424 ROLESPEC_CSTRING, /* role name is stored as a C string */
425 ROLESPEC_CURRENT_ROLE, /* role spec is CURRENT_ROLE */
426 ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
427 ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
428 ROLESPEC_PUBLIC, /* role name is "public" */
430
431typedef struct RoleSpec
432{
434 RoleSpecType roletype; /* Type of this rolespec */
435 char *rolename; /* filled only for ROLESPEC_CSTRING */
436 ParseLoc location; /* token location, or -1 if unknown */
438
439/*
440 * FuncCall - a function or aggregate invocation
441 *
442 * agg_order (if not NIL) indicates we saw 'foo(... ORDER BY ...)', or if
443 * agg_within_group is true, it was 'foo(...) WITHIN GROUP (ORDER BY ...)'.
444 * agg_star indicates we saw a 'foo(*)' construct, while agg_distinct
445 * indicates we saw 'foo(DISTINCT ...)'. In any of these cases, the
446 * construct *must* be an aggregate call. Otherwise, it might be either an
447 * aggregate or some other kind of function. However, if FILTER or OVER is
448 * present it had better be an aggregate or window function.
449 *
450 * Normally, you'd initialize this via makeFuncCall() and then only change the
451 * parts of the struct its defaults don't match afterwards, as needed.
452 */
453typedef struct FuncCall
454{
456 List *funcname; /* qualified name of function */
457 List *args; /* the arguments (list of exprs) */
458 List *agg_order; /* ORDER BY (list of SortBy) */
459 Node *agg_filter; /* FILTER clause, if any */
460 struct WindowDef *over; /* OVER clause, if any */
461 int ignore_nulls; /* ignore nulls for window function */
462 bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */
463 bool agg_star; /* argument was really '*' */
464 bool agg_distinct; /* arguments were labeled DISTINCT */
465 bool func_variadic; /* last argument was labeled VARIADIC */
466 CoercionForm funcformat; /* how to display this node */
467 ParseLoc location; /* token location, or -1 if unknown */
469
470/*
471 * A_Star - '*' representing all columns of a table or compound field
472 *
473 * This can appear within ColumnRef.fields, A_Indirection.indirection, and
474 * ResTarget.indirection lists.
475 */
476typedef struct A_Star
477{
480
481/*
482 * A_Indices - array subscript or slice bounds ([idx] or [lidx:uidx])
483 *
484 * In slice case, either or both of lidx and uidx can be NULL (omitted).
485 * In non-slice case, uidx holds the single subscript and lidx is always NULL.
486 */
487typedef struct A_Indices
488{
490 bool is_slice; /* true if slice (i.e., colon present) */
491 Node *lidx; /* slice lower bound, if any */
492 Node *uidx; /* subscript, or slice upper bound if any */
494
495/*
496 * A_Indirection - select a field and/or array element from an expression
497 *
498 * The indirection list can contain A_Indices nodes (representing
499 * subscripting), String nodes (representing field selection --- the
500 * string value is the name of the field to select), and A_Star nodes
501 * (representing selection of all fields of a composite type).
502 * For example, a complex selection operation like
503 * (foo).field1[42][7].field2
504 * would be represented with a single A_Indirection node having a 4-element
505 * indirection list.
506 *
507 * Currently, A_Star must appear only as the last list element --- the grammar
508 * is responsible for enforcing this!
509 */
510typedef struct A_Indirection
511{
513 Node *arg; /* the thing being selected from */
514 List *indirection; /* subscripts and/or field names and/or * */
516
517/*
518 * A_ArrayExpr - an ARRAY[] construct
519 */
520typedef struct A_ArrayExpr
521{
523 List *elements; /* array element expressions */
524 ParseLoc list_start; /* start of the element list */
525 ParseLoc list_end; /* end of the elements list */
526 ParseLoc location; /* token location, or -1 if unknown */
528
529/*
530 * ResTarget -
531 * result target (used in target list of pre-transformed parse trees)
532 *
533 * In a SELECT target list, 'name' is the column label from an
534 * 'AS ColumnLabel' clause, or NULL if there was none, and 'val' is the
535 * value expression itself. The 'indirection' field is not used.
536 *
537 * INSERT uses ResTarget in its target-column-names list. Here, 'name' is
538 * the name of the destination column, 'indirection' stores any subscripts
539 * attached to the destination, and 'val' is not used.
540 *
541 * In an UPDATE target list, 'name' is the name of the destination column,
542 * 'indirection' stores any subscripts attached to the destination, and
543 * 'val' is the expression to assign.
544 *
545 * See A_Indirection for more info about what can appear in 'indirection'.
546 */
547typedef struct ResTarget
548{
550 char *name; /* column name or NULL */
551 List *indirection; /* subscripts, field names, and '*', or NIL */
552 Node *val; /* the value expression to compute or assign */
553 ParseLoc location; /* token location, or -1 if unknown */
555
556/*
557 * MultiAssignRef - element of a row source expression for UPDATE
558 *
559 * In an UPDATE target list, when we have SET (a,b,c) = row-valued-expression,
560 * we generate separate ResTarget items for each of a,b,c. Their "val" trees
561 * are MultiAssignRef nodes numbered 1..n, linking to a common copy of the
562 * row-valued-expression (which parse analysis will process only once, when
563 * handling the MultiAssignRef with colno=1).
564 */
565typedef struct MultiAssignRef
566{
568 Node *source; /* the row-valued expression */
569 int colno; /* column number for this target (1..n) */
570 int ncolumns; /* number of targets in the construct */
572
573/*
574 * SortBy - for ORDER BY clause
575 */
576typedef struct SortBy
577{
579 Node *node; /* expression to sort on */
580 SortByDir sortby_dir; /* ASC/DESC/USING/default */
581 SortByNulls sortby_nulls; /* NULLS FIRST/LAST */
582 List *useOp; /* name of op to use, if SORTBY_USING */
583 ParseLoc location; /* operator location, or -1 if none/unknown */
585
586/*
587 * WindowDef - raw representation of WINDOW and OVER clauses
588 *
589 * For entries in a WINDOW list, "name" is the window name being defined.
590 * For OVER clauses, we use "name" for the "OVER window" syntax, or "refname"
591 * for the "OVER (window)" syntax, which is subtly different --- the latter
592 * implies overriding the window frame clause.
593 */
594typedef struct WindowDef
595{
597 char *name; /* window's own name */
598 char *refname; /* referenced window name, if any */
599 List *partitionClause; /* PARTITION BY expression list */
600 List *orderClause; /* ORDER BY (list of SortBy) */
601 int frameOptions; /* frame_clause options, see below */
602 Node *startOffset; /* expression for starting bound, if any */
603 Node *endOffset; /* expression for ending bound, if any */
604 ParseLoc location; /* parse location, or -1 if none/unknown */
606
607/*
608 * frameOptions is an OR of these bits. The NONDEFAULT and BETWEEN bits are
609 * used so that ruleutils.c can tell which properties were specified and
610 * which were defaulted; the correct behavioral bits must be set either way.
611 * The START_foo and END_foo options must come in pairs of adjacent bits for
612 * the convenience of gram.y, even though some of them are useless/invalid.
613 */
614#define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */
615#define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */
616#define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */
617#define FRAMEOPTION_GROUPS 0x00008 /* GROUPS behavior */
618#define FRAMEOPTION_BETWEEN 0x00010 /* BETWEEN given? */
619#define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00020 /* start is U. P. */
620#define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00040 /* (disallowed) */
621#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00080 /* (disallowed) */
622#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00100 /* end is U. F. */
623#define FRAMEOPTION_START_CURRENT_ROW 0x00200 /* start is C. R. */
624#define FRAMEOPTION_END_CURRENT_ROW 0x00400 /* end is C. R. */
625#define FRAMEOPTION_START_OFFSET_PRECEDING 0x00800 /* start is O. P. */
626#define FRAMEOPTION_END_OFFSET_PRECEDING 0x01000 /* end is O. P. */
627#define FRAMEOPTION_START_OFFSET_FOLLOWING 0x02000 /* start is O. F. */
628#define FRAMEOPTION_END_OFFSET_FOLLOWING 0x04000 /* end is O. F. */
629#define FRAMEOPTION_EXCLUDE_CURRENT_ROW 0x08000 /* omit C.R. */
630#define FRAMEOPTION_EXCLUDE_GROUP 0x10000 /* omit C.R. & peers */
631#define FRAMEOPTION_EXCLUDE_TIES 0x20000 /* omit C.R.'s peers */
632
633#define FRAMEOPTION_START_OFFSET \
634 (FRAMEOPTION_START_OFFSET_PRECEDING | FRAMEOPTION_START_OFFSET_FOLLOWING)
635#define FRAMEOPTION_END_OFFSET \
636 (FRAMEOPTION_END_OFFSET_PRECEDING | FRAMEOPTION_END_OFFSET_FOLLOWING)
637#define FRAMEOPTION_EXCLUSION \
638 (FRAMEOPTION_EXCLUDE_CURRENT_ROW | FRAMEOPTION_EXCLUDE_GROUP | \
639 FRAMEOPTION_EXCLUDE_TIES)
640
641#define FRAMEOPTION_DEFAULTS \
642 (FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \
643 FRAMEOPTION_END_CURRENT_ROW)
644
645/*
646 * RangeSubselect - subquery appearing in a FROM clause
647 */
648typedef struct RangeSubselect
649{
651 bool lateral; /* does it have LATERAL prefix? */
652 Node *subquery; /* the untransformed sub-select clause */
653 Alias *alias; /* table alias & optional column aliases */
655
656/*
657 * RangeFunction - function call appearing in a FROM clause
658 *
659 * functions is a List because we use this to represent the construct
660 * ROWS FROM(func1(...), func2(...), ...). Each element of this list is a
661 * two-element sublist, the first element being the untransformed function
662 * call tree, and the second element being a possibly-empty list of ColumnDef
663 * nodes representing any columndef list attached to that function within the
664 * ROWS FROM() syntax.
665 *
666 * alias and coldeflist represent any alias and/or columndef list attached
667 * at the top level. (We disallow coldeflist appearing both here and
668 * per-function, but that's checked in parse analysis, not by the grammar.)
669 */
670typedef struct RangeFunction
671{
673 bool lateral; /* does it have LATERAL prefix? */
674 bool ordinality; /* does it have WITH ORDINALITY suffix? */
675 bool is_rowsfrom; /* is result of ROWS FROM() syntax? */
676 List *functions; /* per-function information, see above */
677 Alias *alias; /* table alias & optional column aliases */
678 List *coldeflist; /* list of ColumnDef nodes to describe result
679 * of function returning RECORD */
681
682/*
683 * RangeTableFunc - raw form of "table functions" such as XMLTABLE
684 *
685 * Note: JSON_TABLE is also a "table function", but it uses JsonTable node,
686 * not RangeTableFunc.
687 */
688typedef struct RangeTableFunc
689{
691 bool lateral; /* does it have LATERAL prefix? */
692 Node *docexpr; /* document expression */
693 Node *rowexpr; /* row generator expression */
694 List *namespaces; /* list of namespaces as ResTarget */
695 List *columns; /* list of RangeTableFuncCol */
696 Alias *alias; /* table alias & optional column aliases */
697 ParseLoc location; /* token location, or -1 if unknown */
699
700/*
701 * RangeTableFuncCol - one column in a RangeTableFunc->columns
702 *
703 * If for_ordinality is true (FOR ORDINALITY), then the column is an int4
704 * column and the rest of the fields are ignored.
705 */
706typedef struct RangeTableFuncCol
707{
709 char *colname; /* name of generated column */
710 TypeName *typeName; /* type of generated column */
711 bool for_ordinality; /* does it have FOR ORDINALITY? */
712 bool is_not_null; /* does it have NOT NULL? */
713 Node *colexpr; /* column filter expression */
714 Node *coldefexpr; /* column default value expression */
715 ParseLoc location; /* token location, or -1 if unknown */
717
718/*
719 * RangeGraphTable - raw form of GRAPH_TABLE clause
720 */
721typedef struct RangeGraphTable
722{
727 Alias *alias; /* table alias & optional column aliases */
728 ParseLoc location; /* token location, or -1 if unknown */
730
731/*
732 * RangeTableSample - TABLESAMPLE appearing in a raw FROM clause
733 *
734 * This node, appearing only in raw parse trees, represents
735 * <relation> TABLESAMPLE <method> (<params>) REPEATABLE (<num>)
736 * Currently, the <relation> can only be a RangeVar, but we might in future
737 * allow RangeSubselect and other options. Note that the RangeTableSample
738 * is wrapped around the node representing the <relation>, rather than being
739 * a subfield of it.
740 */
741typedef struct RangeTableSample
742{
744 Node *relation; /* relation to be sampled */
745 List *method; /* sampling method name (possibly qualified) */
746 List *args; /* argument(s) for sampling method */
747 Node *repeatable; /* REPEATABLE expression, or NULL if none */
748 ParseLoc location; /* method name location, or -1 if unknown */
750
751/*
752 * ColumnDef - column definition (used in various creates)
753 *
754 * If the column has a default value, we may have the value expression
755 * in either "raw" form (an untransformed parse tree) or "cooked" form
756 * (a post-parse-analysis, executable expression tree), depending on
757 * how this ColumnDef node was created (by parsing, or by inheritance
758 * from an existing relation). We should never have both in the same node!
759 *
760 * Similarly, we may have a COLLATE specification in either raw form
761 * (represented as a CollateClause with arg==NULL) or cooked form
762 * (the collation's OID).
763 *
764 * The constraints list may contain a CONSTR_DEFAULT item in a raw
765 * parsetree produced by gram.y, but transformCreateStmt will remove
766 * the item and set raw_default instead. CONSTR_DEFAULT items
767 * should not appear in any subsequent processing.
768 */
769typedef struct ColumnDef
770{
772 char *colname; /* name of column */
773 TypeName *typeName; /* type of column */
774 char *compression; /* compression method for column */
775 int16 inhcount; /* number of times column is inherited */
776 bool is_local; /* column has local (non-inherited) def'n */
777 bool is_not_null; /* NOT NULL constraint specified? */
778 bool is_from_type; /* column definition came from table type */
779 char storage; /* attstorage setting, or 0 for default */
780 char *storage_name; /* attstorage setting name or NULL for default */
781 Node *raw_default; /* default value (untransformed parse tree) */
782 Node *cooked_default; /* default value (transformed expr tree) */
783 char identity; /* attidentity setting */
784 RangeVar *identitySequence; /* to store identity sequence name for
785 * ALTER TABLE ... ADD COLUMN */
786 char generated; /* attgenerated setting */
787 CollateClause *collClause; /* untransformed COLLATE spec, if any */
788 Oid collOid; /* collation OID (InvalidOid if not set) */
789 List *constraints; /* other constraints on column */
790 List *fdwoptions; /* per-column FDW options */
791 ParseLoc location; /* parse location, or -1 if none/unknown */
793
794/*
795 * TableLikeClause - CREATE TABLE ( ... LIKE ... ) clause
796 */
797typedef struct TableLikeClause
798{
801 uint32 options; /* OR of TableLikeOption flags */
802 Oid relationOid; /* If table has been looked up, its OID */
804
818
819/*
820 * IndexElem - index parameters (used in CREATE INDEX, and in ON CONFLICT)
821 *
822 * For a plain index attribute, 'name' is the name of the table column to
823 * index, and 'expr' is NULL. For an index expression, 'name' is NULL and
824 * 'expr' is the expression tree. indexcolname is currently used only to
825 * force column name choices when cloning an index.
826 */
827typedef struct IndexElem
828{
830 char *name; /* name of attribute to index, or NULL */
831 Node *expr; /* expression to index, or NULL */
832 char *indexcolname; /* name for index column; NULL = default */
833 List *collation; /* name of collation; NIL = default */
834 List *opclass; /* name of desired opclass; NIL = default */
835 List *opclassopts; /* opclass-specific options, or NIL */
836 SortByDir ordering; /* ASC/DESC/default */
837 SortByNulls nulls_ordering; /* FIRST/LAST/default */
838 ParseLoc location; /* token location, or -1 if unknown */
840
841/*
842 * DefElem - a generic "name = value" option definition
843 *
844 * In some contexts the name can be qualified. Also, certain SQL commands
845 * allow a SET/ADD/DROP action to be attached to option settings, so it's
846 * convenient to carry a field for that too. (Note: currently, it is our
847 * practice that the grammar allows namespace and action only in statements
848 * where they are relevant; C code can just ignore those fields in other
849 * statements.)
850 */
858
859typedef struct DefElem
860{
862 char *defnamespace; /* NULL if unqualified name */
863 char *defname;
864 Node *arg; /* typically Integer, Float, String, or
865 * TypeName */
866 DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */
867 ParseLoc location; /* token location, or -1 if unknown */
869
870/*
871 * LockingClause - raw representation of FOR [NO KEY] UPDATE/[KEY] SHARE
872 * options
873 *
874 * Note: lockedRels == NIL means "all relations in query". Otherwise it
875 * is a list of RangeVar nodes. (We use RangeVar mainly because it carries
876 * a location field --- currently, parse analysis insists on unqualified
877 * names in LockingClause.)
878 */
879typedef struct LockingClause
880{
882 List *lockedRels; /* FOR [KEY] UPDATE/SHARE relations */
884 LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
886
887/*
888 * XMLSERIALIZE (in raw parse tree only)
889 */
890typedef struct XmlSerialize
891{
893 XmlOptionType xmloption; /* DOCUMENT or CONTENT */
896 bool indent; /* [NO] INDENT */
897 ParseLoc location; /* token location, or -1 if unknown */
899
900/* Partitioning related definitions */
901
902/*
903 * PartitionElem - parse-time representation of a single partition key
904 *
905 * expr can be either a raw expression tree or a parse-analyzed expression.
906 * We don't store these on-disk, though.
907 */
908typedef struct PartitionElem
909{
911 char *name; /* name of column to partition on, or NULL */
912 Node *expr; /* expression to partition on, or NULL */
913 List *collation; /* name of collation; NIL = default */
914 List *opclass; /* name of desired opclass; NIL = default */
915 ParseLoc location; /* token location, or -1 if unknown */
917
924
925/*
926 * PartitionSpec - parse-time representation of a partition key specification
927 *
928 * This represents the key space we will be partitioning on.
929 */
930typedef struct PartitionSpec
931{
934 List *partParams; /* List of PartitionElems */
935 ParseLoc location; /* token location, or -1 if unknown */
937
938/*
939 * PartitionBoundSpec - a partition bound specification
940 *
941 * This represents the portion of the partition key space assigned to a
942 * particular partition. These are stored on disk in pg_class.relpartbound.
943 */
945{
947
948 char strategy; /* see PARTITION_STRATEGY codes above */
949 bool is_default; /* is it a default partition bound? */
950
951 /* Partitioning info for HASH strategy: */
954
955 /* Partitioning info for LIST strategy: */
956 List *listdatums; /* List of Consts (or A_Consts in raw tree) */
957
958 /* Partitioning info for RANGE strategy: */
959 List *lowerdatums; /* List of PartitionRangeDatums */
960 List *upperdatums; /* List of PartitionRangeDatums */
961
962 ParseLoc location; /* token location, or -1 if unknown */
963};
964
965/*
966 * PartitionRangeDatum - one of the values in a range partition bound
967 *
968 * This can be MINVALUE, MAXVALUE or a specific bounded value.
969 */
971{
972 PARTITION_RANGE_DATUM_MINVALUE = -1, /* less than any other value */
973 PARTITION_RANGE_DATUM_VALUE = 0, /* a specific (bounded) value */
974 PARTITION_RANGE_DATUM_MAXVALUE = 1, /* greater than any other value */
976
978{
980
982 Node *value; /* Const (or A_Const in raw tree), if kind is
983 * PARTITION_RANGE_DATUM_VALUE, else NULL */
984
985 ParseLoc location; /* token location, or -1 if unknown */
987
988/*
989 * PartitionDesc - info about a single partition for the ALTER TABLE SPLIT
990 * PARTITION command
991 */
993{
995
996 RangeVar *name; /* name of partition */
997 PartitionBoundSpec *bound; /* FOR VALUES, if attaching */
999
1000/*
1001 * PartitionCmd - info for ALTER TABLE/INDEX ATTACH/DETACH PARTITION and for
1002 * ALTER TABLE SPLIT/MERGE PARTITION(S) commands
1003 */
1004typedef struct PartitionCmd
1005{
1007
1008 /* name of partition to attach/detach/merge/split */
1010
1011 /* FOR VALUES, if attaching */
1013
1014 /*
1015 * list of partitions to be split/merged, used in ALTER TABLE MERGE
1016 * PARTITIONS and ALTER TABLE SPLIT PARTITIONS. For merge partitions,
1017 * partlist is a list of RangeVar; For split partition, it is a list of
1018 * SinglePartitionSpec.
1019 */
1021
1024
1025/*
1026 * Nodes for graph pattern
1027 */
1028
1035
1044
1045#define IS_EDGE_PATTERN(kind) ((kind) == EDGE_PATTERN_ANY || \
1046 (kind) == EDGE_PATTERN_RIGHT || \
1047 (kind) == EDGE_PATTERN_LEFT)
1048
1060
1061/****************************************************************************
1062 * Nodes for a Query tree
1063 ****************************************************************************/
1064
1065/*--------------------
1066 * RangeTblEntry -
1067 * A range table is a List of RangeTblEntry nodes.
1068 *
1069 * A range table entry may represent a plain relation, a sub-select in
1070 * FROM, or the result of a JOIN clause. (Only explicit JOIN syntax
1071 * produces an RTE, not the implicit join resulting from multiple FROM
1072 * items. This is because we only need the RTE to deal with SQL features
1073 * like outer joins and join-output-column aliasing.) Other special
1074 * RTE types also exist, as indicated by RTEKind.
1075 *
1076 * Note that we consider RTE_RELATION to cover anything that has a pg_class
1077 * entry. relkind distinguishes the sub-cases.
1078 *
1079 * alias is an Alias node representing the AS alias-clause attached to the
1080 * FROM expression, or NULL if no clause.
1081 *
1082 * eref is the table reference name and column reference names (either
1083 * real or aliases). Note that system columns (OID etc) are not included
1084 * in the column list.
1085 * eref->aliasname is required to be present, and should generally be used
1086 * to identify the RTE for error messages etc.
1087 *
1088 * In RELATION RTEs, the colnames in both alias and eref are indexed by
1089 * physical attribute number; this means there must be colname entries for
1090 * dropped columns. When building an RTE we insert empty strings ("") for
1091 * dropped columns. Note however that a stored rule may have nonempty
1092 * colnames for columns dropped since the rule was created (and for that
1093 * matter the colnames might be out of date due to column renamings).
1094 * The same comments apply to FUNCTION RTEs when a function's return type
1095 * is a named composite type.
1096 *
1097 * In JOIN RTEs, the colnames in both alias and eref are one-to-one with
1098 * joinaliasvars entries. A JOIN RTE will omit columns of its inputs when
1099 * those columns are known to be dropped at parse time. Again, however,
1100 * a stored rule might contain entries for columns dropped since the rule
1101 * was created. (This is only possible for columns not actually referenced
1102 * in the rule.) When loading a stored rule, we replace the joinaliasvars
1103 * items for any such columns with null pointers. (We can't simply delete
1104 * them from the joinaliasvars list, because that would affect the attnums
1105 * of Vars referencing the rest of the list.)
1106 *
1107 * inFromCl marks those range variables that are listed in the FROM clause.
1108 * It's false for RTEs that are added to a query behind the scenes, such
1109 * as the NEW and OLD variables for a rule, or the subqueries of a UNION.
1110 * This flag is not used during parsing (except in transformLockingClause,
1111 * q.v.); the parser now uses a separate "namespace" data structure to
1112 * control visibility. But it is needed by ruleutils.c to determine
1113 * whether RTEs should be shown in decompiled queries.
1114 *
1115 * securityQuals is a list of security barrier quals (boolean expressions),
1116 * to be tested in the listed order before returning a row from the
1117 * relation. It is always NIL in parser output. Entries are added by the
1118 * rewriter to implement security-barrier views and/or row-level security.
1119 * Note that the planner turns each boolean expression into an implicitly
1120 * AND'ed sublist, as is its usual habit with qualification expressions.
1121 *--------------------
1122 */
1123typedef enum RTEKind
1124{
1125 RTE_RELATION, /* ordinary relation reference */
1126 RTE_SUBQUERY, /* subquery in FROM */
1127 RTE_JOIN, /* join */
1128 RTE_FUNCTION, /* function in FROM */
1129 RTE_TABLEFUNC, /* TableFunc(.., column list) */
1130 RTE_VALUES, /* VALUES (<exprlist>), (<exprlist>), ... */
1131 RTE_CTE, /* common table expr (WITH list element) */
1132 RTE_NAMEDTUPLESTORE, /* tuplestore, e.g. for AFTER triggers */
1133 RTE_GRAPH_TABLE, /* GRAPH_TABLE clause */
1134 RTE_RESULT, /* RTE represents an empty FROM clause; such
1135 * RTEs are added by the planner, they're not
1136 * present during parsing or rewriting */
1137 RTE_GROUP, /* the grouping step */
1139
1140typedef struct RangeTblEntry
1141{
1143
1144 NodeTag type;
1145
1146 /*
1147 * Fields valid in all RTEs:
1148 *
1149 * put alias + eref first to make dump more legible
1150 */
1151 /* user-written alias clause, if any */
1153
1154 /*
1155 * Expanded reference names. This uses a custom query jumble function so
1156 * that the table name is included in the computation, but not its list of
1157 * columns.
1158 */
1160
1161 RTEKind rtekind; /* see above */
1162
1163 /*
1164 * Fields valid for a plain relation RTE (else zero):
1165 *
1166 * inh is true for relation references that should be expanded to include
1167 * inheritance children, if the rel has any. In the parser, this will
1168 * only be true for RTE_RELATION entries. The planner also uses this
1169 * field to mark RTE_SUBQUERY entries that contain UNION ALL queries that
1170 * it has flattened into pulled-up subqueries (creating a structure much
1171 * like the effects of inheritance).
1172 *
1173 * rellockmode is really LOCKMODE, but it's declared int to avoid having
1174 * to include lock-related headers here. It must be RowExclusiveLock if
1175 * the RTE is an INSERT/UPDATE/DELETE/MERGE target, else RowShareLock if
1176 * the RTE is a SELECT FOR UPDATE/FOR SHARE target, else AccessShareLock.
1177 *
1178 * Note: in some cases, rule expansion may result in RTEs that are marked
1179 * with RowExclusiveLock even though they are not the target of the
1180 * current query; this happens if a DO ALSO rule simply scans the original
1181 * target table. We leave such RTEs with their original lockmode so as to
1182 * avoid getting an additional, lesser lock.
1183 *
1184 * perminfoindex is 1-based index of the RTEPermissionInfo belonging to
1185 * this RTE in the containing struct's list of same; 0 if permissions need
1186 * not be checked for this RTE.
1187 *
1188 * As a special case, relid, relkind, rellockmode, and perminfoindex can
1189 * also be set (nonzero) in an RTE_SUBQUERY RTE. This occurs when we
1190 * convert an RTE_RELATION RTE naming a view into an RTE_SUBQUERY
1191 * containing the view's query. We still need to perform run-time locking
1192 * and permission checks on the view, even though it's not directly used
1193 * in the query anymore, and the most expedient way to do that is to
1194 * retain these fields from the old state of the RTE.
1195 *
1196 * As a special case, RTE_NAMEDTUPLESTORE can also set relid to indicate
1197 * that the tuple format of the tuplestore is the same as the referenced
1198 * relation. This allows plans referencing AFTER trigger transition
1199 * tables to be invalidated if the underlying table is altered.
1200 */
1201 /* OID of the relation */
1203 /* inheritance requested? */
1204 bool inh;
1205 /* relation kind (see pg_class.relkind) */
1207 /* lock level that query requires on the rel */
1209 /* index of RTEPermissionInfo entry, or 0 */
1211 /* sampling info, or NULL */
1213
1214 /*
1215 * Fields valid for a subquery RTE (else NULL):
1216 */
1217 /* the sub-query */
1219 /* is from security_barrier view? */
1220 bool security_barrier pg_node_attr(query_jumble_ignore);
1221
1222 /*
1223 * Fields valid for a join RTE (else NULL/zero):
1224 *
1225 * joinaliasvars is a list of (usually) Vars corresponding to the columns
1226 * of the join result. An alias Var referencing column K of the join
1227 * result can be replaced by the K'th element of joinaliasvars --- but to
1228 * simplify the task of reverse-listing aliases correctly, we do not do
1229 * that until planning time. In detail: an element of joinaliasvars can
1230 * be a Var of one of the join's input relations, or such a Var with an
1231 * implicit coercion to the join's output column type, or a COALESCE
1232 * expression containing the two input column Vars (possibly coerced).
1233 * Elements beyond the first joinmergedcols entries are always just Vars,
1234 * and are never referenced from elsewhere in the query (that is, join
1235 * alias Vars are generated only for merged columns). We keep these
1236 * entries only because they're needed in expandRTE() and similar code.
1237 *
1238 * Vars appearing within joinaliasvars are marked with varnullingrels sets
1239 * that describe the nulling effects of this join and lower ones. This is
1240 * essential for FULL JOIN cases, because the COALESCE expression only
1241 * describes the semantics correctly if its inputs have been nulled by the
1242 * join. For other cases, it allows expandRTE() to generate a valid
1243 * representation of the join's output without consulting additional
1244 * parser state.
1245 *
1246 * Within a Query loaded from a stored rule, it is possible for non-merged
1247 * joinaliasvars items to be null pointers, which are placeholders for
1248 * (necessarily unreferenced) columns dropped since the rule was made.
1249 * Also, once planning begins, joinaliasvars items can be almost anything,
1250 * as a result of subquery-flattening substitutions.
1251 *
1252 * joinleftcols is an integer list of physical column numbers of the left
1253 * join input rel that are included in the join; likewise joinrighttcols
1254 * for the right join input rel. (Which rels those are can be determined
1255 * from the associated JoinExpr.) If the join is USING/NATURAL, then the
1256 * first joinmergedcols entries in each list identify the merged columns.
1257 * The merged columns come first in the join output, then remaining
1258 * columns of the left input, then remaining columns of the right.
1259 *
1260 * Note that input columns could have been dropped after creation of a
1261 * stored rule, if they are not referenced in the query (in particular,
1262 * merged columns could not be dropped); this is not accounted for in
1263 * joinleftcols/joinrighttcols.
1264 */
1266 /* number of merged (JOIN USING) columns */
1268 /* list of alias-var expansions */
1270 /* left-side input column numbers */
1272 /* right-side input column numbers */
1274
1275 /*
1276 * join_using_alias is an alias clause attached directly to JOIN/USING. It
1277 * is different from the alias field (above) in that it does not hide the
1278 * range variables of the tables being joined.
1279 */
1281
1282 /*
1283 * Fields valid for a function RTE (else NIL/zero):
1284 *
1285 * When funcordinality is true, the eref->colnames list includes an alias
1286 * for the ordinality column. The ordinality column is otherwise
1287 * implicit, and must be accounted for "by hand" in places such as
1288 * expandRTE().
1289 */
1290 /* list of RangeTblFunction nodes */
1292 /* is this called WITH ORDINALITY? */
1294
1295 /*
1296 * Fields valid for a TableFunc RTE (else NULL):
1297 */
1299
1300 /*
1301 * Fields valid for a graph table RTE (else NULL):
1302 */
1305
1306 /*
1307 * Fields valid for a values RTE (else NIL):
1308 */
1309 /* list of expression lists */
1311
1312 /*
1313 * Fields valid for a CTE RTE (else NULL/zero):
1314 */
1315 /* name of the WITH list item */
1316 char *ctename;
1317 /* number of query levels up */
1319 /* is this a recursive self-reference? */
1321
1322 /*
1323 * Fields valid for CTE, VALUES, ENR, and TableFunc RTEs (else NIL):
1324 *
1325 * We need these for CTE RTEs so that the types of self-referential
1326 * columns are well-defined. For VALUES RTEs, storing these explicitly
1327 * saves having to re-determine the info by scanning the values_lists. For
1328 * ENRs, we store the types explicitly here (we could get the information
1329 * from the catalogs if 'relid' was supplied, but we'd still need these
1330 * for TupleDesc-based ENRs, so we might as well always store the type
1331 * info here). For TableFuncs, these fields are redundant with data in
1332 * the TableFunc node, but keeping them here allows some code sharing with
1333 * the other cases.
1334 *
1335 * For ENRs only, we have to consider the possibility of dropped columns.
1336 * A dropped column is included in these lists, but it will have zeroes in
1337 * all three lists (as well as an empty-string entry in eref). Testing
1338 * for zero coltype is the standard way to detect a dropped column.
1339 */
1340 /* OID list of column type OIDs */
1342 /* integer list of column typmods */
1344 /* OID list of column collation OIDs */
1346
1347 /*
1348 * Fields valid for ENR RTEs (else NULL/zero):
1349 */
1350 /* name of ephemeral named relation */
1351 char *enrname;
1352 /* estimated or actual from caller */
1354
1355 /*
1356 * Fields valid for a GROUP RTE (else NIL):
1357 */
1358 /* list of grouping expressions */
1360
1361 /*
1362 * Fields valid in all RTEs:
1363 */
1364 /* was LATERAL specified? */
1366 /* present in FROM clause? */
1368 /* security barrier quals to apply, if any */
1371
1372/*
1373 * RTEPermissionInfo
1374 * Per-relation information for permission checking. Added to the Query
1375 * node by the parser when adding the corresponding RTE to the query
1376 * range table and subsequently editorialized on by the rewriter if
1377 * needed after rule expansion.
1378 *
1379 * Only the relations directly mentioned in the query are checked for
1380 * access permissions by the core executor, so only their RTEPermissionInfos
1381 * are present in the Query. However, extensions may want to check inheritance
1382 * children too, depending on the value of rte->inh, so it's copied in 'inh'
1383 * for their perusal.
1384 *
1385 * requiredPerms and checkAsUser specify run-time access permissions checks
1386 * to be performed at query startup. The user must have *all* of the
1387 * permissions that are OR'd together in requiredPerms (never 0!). If
1388 * checkAsUser is not zero, then do the permissions checks using the access
1389 * rights of that user, not the current effective user ID. (This allows rules
1390 * to act as setuid gateways.)
1391 *
1392 * For SELECT/INSERT/UPDATE permissions, if the user doesn't have table-wide
1393 * permissions then it is sufficient to have the permissions on all columns
1394 * identified in selectedCols (for SELECT) and/or insertedCols and/or
1395 * updatedCols (INSERT with ON CONFLICT DO UPDATE may have all 3).
1396 * selectedCols, insertedCols and updatedCols are bitmapsets, which cannot have
1397 * negative integer members, so we subtract FirstLowInvalidHeapAttributeNumber
1398 * from column numbers before storing them in these fields. A whole-row Var
1399 * reference is represented by setting the bit for InvalidAttrNumber.
1400 *
1401 * updatedCols is also used in some other places, for example, to determine
1402 * which triggers to fire and in FDWs to know which changed columns they need
1403 * to ship off.
1404 */
1405typedef struct RTEPermissionInfo
1406{
1408
1409 Oid relid; /* relation OID */
1410 bool inh; /* separately check inheritance children? */
1411 AclMode requiredPerms; /* bitmask of required access permissions */
1412 Oid checkAsUser; /* if valid, check access as this role */
1413 Bitmapset *selectedCols; /* columns needing SELECT permission */
1414 Bitmapset *insertedCols; /* columns needing INSERT permission */
1415 Bitmapset *updatedCols; /* columns needing UPDATE permission */
1417
1418/*
1419 * RangeTblFunction -
1420 * RangeTblEntry subsidiary data for one function in a FUNCTION RTE.
1421 *
1422 * If the function had a column definition list (required for an
1423 * otherwise-unspecified RECORD result), funccolnames lists the names given
1424 * in the definition list, funccoltypes lists their declared column types,
1425 * funccoltypmods lists their typmods, funccolcollations their collations.
1426 * Otherwise, those fields are NIL.
1427 *
1428 * Notice we don't attempt to store info about the results of functions
1429 * returning named composite types, because those can change from time to
1430 * time. We do however remember how many columns we thought the type had
1431 * (including dropped columns!), so that we can successfully ignore any
1432 * columns added after the query was parsed.
1433 */
1434typedef struct RangeTblFunction
1435{
1437
1438 Node *funcexpr; /* expression tree for func call */
1439 /* number of columns it contributes to RTE */
1441 /* These fields record the contents of a column definition list, if any: */
1442 /* column names (list of String) */
1444 /* OID list of column type OIDs */
1446 /* integer list of column typmods */
1448 /* OID list of column collation OIDs */
1450
1451 /* This is set during planning for use by the executor: */
1452 /* PARAM_EXEC Param IDs affecting this func */
1455
1456/*
1457 * TableSampleClause - TABLESAMPLE appearing in a transformed FROM clause
1458 *
1459 * Unlike RangeTableSample, this is a subnode of the relevant RangeTblEntry.
1460 */
1461typedef struct TableSampleClause
1462{
1464 Oid tsmhandler; /* OID of the tablesample handler function */
1465 List *args; /* tablesample argument expression(s) */
1466 Expr *repeatable; /* REPEATABLE expression, or NULL if none */
1468
1469/*
1470 * WithCheckOption -
1471 * representation of WITH CHECK OPTION checks to be applied to new tuples
1472 * when inserting/updating an auto-updatable view, or RLS WITH CHECK
1473 * policies to be applied when inserting/updating a relation with RLS.
1474 */
1475typedef enum WCOKind
1476{
1477 WCO_VIEW_CHECK, /* WCO on an auto-updatable view */
1478 WCO_RLS_INSERT_CHECK, /* RLS INSERT WITH CHECK policy */
1479 WCO_RLS_UPDATE_CHECK, /* RLS UPDATE WITH CHECK policy */
1480 WCO_RLS_CONFLICT_CHECK, /* RLS ON CONFLICT DO SELECT/UPDATE USING
1481 * policy */
1482 WCO_RLS_MERGE_UPDATE_CHECK, /* RLS MERGE UPDATE USING policy */
1483 WCO_RLS_MERGE_DELETE_CHECK, /* RLS MERGE DELETE USING policy */
1485
1486typedef struct WithCheckOption
1487{
1489 WCOKind kind; /* kind of WCO */
1490 char *relname; /* name of relation that specified the WCO */
1491 char *polname; /* name of RLS policy being checked */
1492 Node *qual; /* constraint qual to check */
1493 bool cascaded; /* true for a cascaded WCO on a view */
1495
1496/*
1497 * SortGroupClause -
1498 * representation of ORDER BY, GROUP BY, PARTITION BY,
1499 * DISTINCT, DISTINCT ON items
1500 *
1501 * You might think that ORDER BY is only interested in defining ordering,
1502 * and GROUP/DISTINCT are only interested in defining equality. However,
1503 * one way to implement grouping is to sort and then apply a "uniq"-like
1504 * filter. So it's also interesting to keep track of possible sort operators
1505 * for GROUP/DISTINCT, and in particular to try to sort for the grouping
1506 * in a way that will also yield a requested ORDER BY ordering. So we need
1507 * to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates
1508 * the decision to give them the same representation.
1509 *
1510 * tleSortGroupRef must match ressortgroupref of exactly one entry of the
1511 * query's targetlist; that is the expression to be sorted or grouped by.
1512 * eqop is the OID of the equality operator.
1513 * sortop is the OID of the ordering operator (a "<" or ">" operator),
1514 * or InvalidOid if not available.
1515 * nulls_first means about what you'd expect. If sortop is InvalidOid
1516 * then nulls_first is meaningless and should be set to false.
1517 * hashable is true if eqop is hashable (note this condition also depends
1518 * on the datatype of the input expression).
1519 *
1520 * In an ORDER BY item, all fields must be valid. (The eqop isn't essential
1521 * here, but it's cheap to get it along with the sortop, and requiring it
1522 * to be valid eases comparisons to grouping items.) Note that this isn't
1523 * actually enough information to determine an ordering: if the sortop is
1524 * collation-sensitive, a collation OID is needed too. We don't store the
1525 * collation in SortGroupClause because it's not available at the time the
1526 * parser builds the SortGroupClause; instead, consult the exposed collation
1527 * of the referenced targetlist expression to find out what it is.
1528 *
1529 * In a grouping item, eqop must be valid. If the eqop is a btree equality
1530 * operator, then sortop should be set to a compatible ordering operator.
1531 * We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that
1532 * the query presents for the same tlist item. If there is none, we just
1533 * use the default ordering op for the datatype.
1534 *
1535 * If the tlist item's type has a hash opclass but no btree opclass, then
1536 * we will set eqop to the hash equality operator, sortop to InvalidOid,
1537 * and nulls_first to false. A grouping item of this kind can only be
1538 * implemented by hashing, and of course it'll never match an ORDER BY item.
1539 *
1540 * The hashable flag is provided since we generally have the requisite
1541 * information readily available when the SortGroupClause is constructed,
1542 * and it's relatively expensive to get it again later. Note there is no
1543 * need for a "sortable" flag since OidIsValid(sortop) serves the purpose.
1544 *
1545 * A query might have both ORDER BY and DISTINCT (or DISTINCT ON) clauses.
1546 * In SELECT DISTINCT, the distinctClause list is as long or longer than the
1547 * sortClause list, while in SELECT DISTINCT ON it's typically shorter.
1548 * The two lists must match up to the end of the shorter one --- the parser
1549 * rearranges the distinctClause if necessary to make this true. (This
1550 * restriction ensures that only one sort step is needed to both satisfy the
1551 * ORDER BY and set up for the Unique step. This is semantically necessary
1552 * for DISTINCT ON, and presents no real drawback for DISTINCT.)
1553 */
1554typedef struct SortGroupClause
1555{
1557 Index tleSortGroupRef; /* reference into targetlist */
1558 Oid eqop; /* the equality operator ('=' op) */
1559 Oid sortop; /* the ordering operator ('<' op), or 0 */
1560 bool reverse_sort; /* is sortop a "greater than" operator? */
1561 bool nulls_first; /* do NULLs come before normal values? */
1562 /* can eqop be implemented by hashing? */
1565
1566/*
1567 * GroupingSet -
1568 * representation of CUBE, ROLLUP and GROUPING SETS clauses
1569 *
1570 * In a Query with grouping sets, the groupClause contains a flat list of
1571 * SortGroupClause nodes for each distinct expression used. The actual
1572 * structure of the GROUP BY clause is given by the groupingSets tree.
1573 *
1574 * In the raw parser output, GroupingSet nodes (of all types except SIMPLE
1575 * which is not used) are potentially mixed in with the expressions in the
1576 * groupClause of the SelectStmt. (An expression can't contain a GroupingSet,
1577 * but a list may mix GroupingSet and expression nodes.) At this stage, the
1578 * content of each node is a list of expressions, some of which may be RowExprs
1579 * which represent sublists rather than actual row constructors, and nested
1580 * GroupingSet nodes where legal in the grammar. The structure directly
1581 * reflects the query syntax.
1582 *
1583 * In parse analysis, the transformed expressions are used to build the tlist
1584 * and groupClause list (of SortGroupClause nodes), and the groupingSets tree
1585 * is eventually reduced to a fixed format:
1586 *
1587 * EMPTY nodes represent (), and obviously have no content
1588 *
1589 * SIMPLE nodes represent a list of one or more expressions to be treated as an
1590 * atom by the enclosing structure; the content is an integer list of
1591 * ressortgroupref values (see SortGroupClause)
1592 *
1593 * CUBE and ROLLUP nodes contain a list of one or more SIMPLE nodes.
1594 *
1595 * SETS nodes contain a list of EMPTY, SIMPLE, CUBE or ROLLUP nodes, but after
1596 * parse analysis they cannot contain more SETS nodes; enough of the syntactic
1597 * transforms of the spec have been applied that we no longer have arbitrarily
1598 * deep nesting (though we still preserve the use of cube/rollup).
1599 *
1600 * Note that if the groupingSets tree contains no SIMPLE nodes (only EMPTY
1601 * nodes at the leaves), then the groupClause will be empty, but this is still
1602 * an aggregation query (similar to using aggs or HAVING without GROUP BY).
1603 *
1604 * As an example, the following clause:
1605 *
1606 * GROUP BY GROUPING SETS ((a,b), CUBE(c,(d,e)))
1607 *
1608 * looks like this after raw parsing:
1609 *
1610 * SETS( RowExpr(a,b) , CUBE( c, RowExpr(d,e) ) )
1611 *
1612 * and parse analysis converts it to:
1613 *
1614 * SETS( SIMPLE(1,2), CUBE( SIMPLE(3), SIMPLE(4,5) ) )
1615 */
1624
1632
1633/*
1634 * WindowClause -
1635 * transformed representation of WINDOW and OVER clauses
1636 *
1637 * A parsed Query's windowClause list contains these structs. "name" is set
1638 * if the clause originally came from WINDOW, and is NULL if it originally
1639 * was an OVER clause (but note that we collapse out duplicate OVERs).
1640 * partitionClause and orderClause are lists of SortGroupClause structs.
1641 * partitionClause is sanitized by the query planner to remove any columns or
1642 * expressions belonging to redundant PathKeys.
1643 * If we have RANGE with offset PRECEDING/FOLLOWING, the semantics of that are
1644 * specified by startInRangeFunc/inRangeColl/inRangeAsc/inRangeNullsFirst
1645 * for the start offset, or endInRangeFunc/inRange* for the end offset.
1646 * winref is an ID number referenced by WindowFunc nodes; it must be unique
1647 * among the members of a Query's windowClause list.
1648 * When refname isn't null, the partitionClause is always copied from there;
1649 * the orderClause might or might not be copied (see copiedOrder); the framing
1650 * options are never copied, per spec.
1651 */
1652typedef struct WindowClause
1653{
1655 /* window name (NULL in an OVER clause) */
1657 /* referenced window name, if any */
1659 List *partitionClause; /* PARTITION BY list */
1660 /* ORDER BY list */
1662 int frameOptions; /* frame_clause options, see WindowDef */
1663 Node *startOffset; /* expression for starting bound, if any */
1664 Node *endOffset; /* expression for ending bound, if any */
1665 /* in_range function for startOffset */
1667 /* in_range function for endOffset */
1669 /* collation for in_range tests */
1671 /* use ASC sort order for in_range tests? */
1673 /* nulls sort first for in_range tests? */
1674 bool inRangeNullsFirst pg_node_attr(query_jumble_ignore);
1675 Index winref; /* ID referenced by window functions */
1676 /* did we copy orderClause from refname? */
1679
1680/*
1681 * RowMarkClause -
1682 * parser output representation of FOR [KEY] UPDATE/SHARE clauses
1683 *
1684 * Query.rowMarks contains a separate RowMarkClause node for each relation
1685 * identified as a FOR [KEY] UPDATE/SHARE target. If one of these clauses
1686 * is applied to a subquery, we generate RowMarkClauses for all normal and
1687 * subquery rels in the subquery, but they are marked pushedDown = true to
1688 * distinguish them from clauses that were explicitly written at this query
1689 * level. Also, Query.hasForUpdate tells whether there were explicit FOR
1690 * UPDATE/SHARE/KEY SHARE clauses in the current query level.
1691 */
1692typedef struct RowMarkClause
1693{
1695 Index rti; /* range table index of target relation */
1697 LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */
1698 bool pushedDown; /* pushed down from higher query level? */
1700
1701/*
1702 * ForPortionOfClause
1703 * representation of FOR PORTION OF <range-name> FROM <target-start> TO
1704 * <target-end> or FOR PORTION OF <range-name> (<target>)
1705 */
1707{
1709 char *range_name; /* column name of the range/multirange */
1710 ParseLoc location; /* token location, or -1 if unknown */
1711 ParseLoc target_location; /* token location, or -1 if unknown */
1712 Node *target; /* Expr from FOR PORTION OF col (...) syntax */
1713 Node *target_start; /* Expr from FROM ... TO ... syntax */
1714 Node *target_end; /* Expr from FROM ... TO ... syntax */
1716
1717/*
1718 * WithClause -
1719 * representation of WITH clause
1720 *
1721 * Note: WithClause does not propagate into the Query representation;
1722 * but CommonTableExpr does.
1723 */
1724typedef struct WithClause
1725{
1727 List *ctes; /* list of CommonTableExprs */
1728 bool recursive; /* true = WITH RECURSIVE */
1729 ParseLoc location; /* token location, or -1 if unknown */
1731
1732/*
1733 * InferClause -
1734 * ON CONFLICT unique index inference clause
1735 *
1736 * Note: InferClause does not propagate into the Query representation.
1737 */
1738typedef struct InferClause
1739{
1741 List *indexElems; /* IndexElems to infer unique index */
1742 Node *whereClause; /* qualification (partial-index predicate) */
1743 char *conname; /* Constraint name, or NULL if unnamed */
1744 ParseLoc location; /* token location, or -1 if unknown */
1746
1747/*
1748 * OnConflictClause -
1749 * representation of ON CONFLICT clause
1750 *
1751 * Note: OnConflictClause does not propagate into the Query representation.
1752 */
1753typedef struct OnConflictClause
1754{
1756 OnConflictAction action; /* DO NOTHING, SELECT, or UPDATE */
1757 InferClause *infer; /* Optional index inference clause */
1758 LockClauseStrength lockStrength; /* lock strength for DO SELECT */
1759 List *targetList; /* target list (of ResTarget) for DO UPDATE */
1760 Node *whereClause; /* qualifications */
1761 ParseLoc location; /* token location, or -1 if unknown */
1763
1764/*
1765 * CommonTableExpr -
1766 * representation of WITH list element
1767 */
1768
1769typedef enum CTEMaterialize
1770{
1771 CTEMaterializeDefault, /* no option specified */
1772 CTEMaterializeAlways, /* MATERIALIZED */
1773 CTEMaterializeNever, /* NOT MATERIALIZED */
1775
1784
1785typedef struct CTECycleClause
1786{
1794 /* These fields are set during parse analysis: */
1795 Oid cycle_mark_type; /* common type of _value and _default */
1798 Oid cycle_mark_neop; /* <> operator for type */
1800
1801typedef struct CommonTableExpr
1802{
1804
1805 /*
1806 * Query name (never qualified). The string name is included in the query
1807 * jumbling because RTE_CTE RTEs need it.
1808 */
1809 char *ctename;
1810 /* optional list of column names */
1812 CTEMaterialize ctematerialized; /* is this an optimization fence? */
1813 /* SelectStmt/InsertStmt/etc before parse analysis, Query afterwards: */
1814 Node *ctequery; /* the CTE's subquery */
1817 ParseLoc location; /* token location, or -1 if unknown */
1818 /* These fields are set during parse analysis: */
1819 /* is this CTE actually recursive? */
1821
1822 /*
1823 * Number of RTEs referencing this CTE (excluding internal
1824 * self-references).
1825 */
1827 /* list of output column names */
1829 /* OID list of output column type OIDs */
1831 /* integer list of output column typmods */
1833 /* OID list of column collation OIDs */
1836
1837/* Convenience macro to get the output tlist of a CTE's query */
1838#define GetCTETargetList(cte) \
1839 (AssertMacro(IsA((cte)->ctequery, Query)), \
1840 ((Query *) (cte)->ctequery)->commandType == CMD_SELECT ? \
1841 ((Query *) (cte)->ctequery)->targetList : \
1842 ((Query *) (cte)->ctequery)->returningList)
1843
1844/*
1845 * MergeWhenClause -
1846 * raw parser representation of a WHEN clause in a MERGE statement
1847 *
1848 * This is transformed into MergeAction by parse analysis
1849 */
1850typedef struct MergeWhenClause
1851{
1853 MergeMatchKind matchKind; /* MATCHED/NOT MATCHED BY SOURCE/TARGET */
1854 CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
1855 OverridingKind override; /* OVERRIDING clause */
1856 Node *condition; /* WHEN conditions (raw parser) */
1857 List *targetList; /* INSERT/UPDATE targetlist */
1858 /* the following members are only used in INSERT actions */
1859 List *values; /* VALUES to INSERT, or NULL */
1861
1862/*
1863 * ReturningOptionKind -
1864 * Possible kinds of option in RETURNING WITH(...) list
1865 *
1866 * Currently, this is used only for specifying OLD/NEW aliases.
1867 */
1869{
1870 RETURNING_OPTION_OLD, /* specify alias for OLD in RETURNING */
1871 RETURNING_OPTION_NEW, /* specify alias for NEW in RETURNING */
1873
1874/*
1875 * ReturningOption -
1876 * An individual option in the RETURNING WITH(...) list
1877 */
1878typedef struct ReturningOption
1879{
1881 ReturningOptionKind option; /* specified option */
1882 char *value; /* option's value */
1883 ParseLoc location; /* token location, or -1 if unknown */
1885
1886/*
1887 * ReturningClause -
1888 * List of RETURNING expressions, together with any WITH(...) options
1889 */
1890typedef struct ReturningClause
1891{
1893 List *options; /* list of ReturningOption elements */
1894 List *exprs; /* list of expressions to return */
1896
1897/*
1898 * TriggerTransition -
1899 * representation of transition row or table naming clause
1900 *
1901 * Only transition tables are initially supported in the syntax, and only for
1902 * AFTER triggers, but other permutations are accepted by the parser so we can
1903 * give a meaningful message from C code.
1904 */
1912
1913/* Nodes for SQL/JSON support */
1914
1915/*
1916 * JsonOutput -
1917 * representation of JSON output clause (RETURNING type [FORMAT format])
1918 */
1919typedef struct JsonOutput
1920{
1922 TypeName *typeName; /* RETURNING type name, if specified */
1923 JsonReturning *returning; /* RETURNING FORMAT clause and type Oids */
1925
1926/*
1927 * JsonArgument -
1928 * representation of argument from JSON PASSING clause
1929 */
1930typedef struct JsonArgument
1931{
1933 JsonValueExpr *val; /* argument value expression */
1934 char *name; /* argument name */
1936
1937/*
1938 * JsonQuotes -
1939 * representation of [KEEP|OMIT] QUOTES clause for JSON_QUERY()
1940 */
1941typedef enum JsonQuotes
1942{
1943 JS_QUOTES_UNSPEC, /* unspecified */
1944 JS_QUOTES_KEEP, /* KEEP QUOTES */
1945 JS_QUOTES_OMIT, /* OMIT QUOTES */
1947
1948/*
1949 * JsonFuncExpr -
1950 * untransformed representation of function expressions for
1951 * SQL/JSON query functions
1952 */
1953typedef struct JsonFuncExpr
1954{
1956 JsonExprOp op; /* expression type */
1957 char *column_name; /* JSON_TABLE() column name or NULL if this is
1958 * not for a JSON_TABLE() */
1959 JsonValueExpr *context_item; /* context item expression */
1960 Node *pathspec; /* JSON path specification expression */
1961 List *passing; /* list of PASSING clause arguments, if any */
1962 JsonOutput *output; /* output clause, if specified */
1963 JsonBehavior *on_empty; /* ON EMPTY behavior */
1964 JsonBehavior *on_error; /* ON ERROR behavior */
1965 JsonWrapper wrapper; /* array wrapper behavior (JSON_QUERY only) */
1966 JsonQuotes quotes; /* omit or keep quotes? (JSON_QUERY only) */
1967 ParseLoc location; /* token location, or -1 if unknown */
1969
1970/*
1971 * JsonTablePathSpec
1972 * untransformed specification of JSON path expression with an optional
1973 * name
1974 */
1984
1985/*
1986 * JsonTablePlanType -
1987 * flags for JSON_TABLE plan node types representation
1988 */
1995
1996/*
1997 * JsonTablePlanJoinType -
1998 * JSON_TABLE join types for JSTP_JOINED plans
1999 */
2007
2008/*
2009 * JsonTablePlanSpec -
2010 * untransformed representation of JSON_TABLE's PLAN clause
2011 */
2012typedef struct JsonTablePlanSpec
2013{
2015
2017 JsonTablePlanJoinType join_type; /* join type (for joined plan only) */
2018 char *pathname; /* path name (for simple plan only) */
2019
2020 /* For joined plans */
2021 struct JsonTablePlanSpec *plan1; /* first joined plan */
2022 struct JsonTablePlanSpec *plan2; /* second joined plan */
2023
2024 ParseLoc location; /* token location, or -1 if unknown */
2026
2027/*
2028 * JsonTable -
2029 * untransformed representation of JSON_TABLE
2030 */
2031typedef struct JsonTable
2032{
2034 JsonValueExpr *context_item; /* context item expression */
2035 JsonTablePathSpec *pathspec; /* JSON path specification */
2036 List *passing; /* list of PASSING clause arguments, if any */
2037 List *columns; /* list of JsonTableColumn */
2038 JsonTablePlanSpec *planspec; /* join plan, if specified */
2039 JsonBehavior *on_error; /* ON ERROR behavior */
2040 Alias *alias; /* table alias in FROM clause */
2041 bool lateral; /* does it have LATERAL prefix? */
2042 ParseLoc location; /* token location, or -1 if unknown */
2044
2045/*
2046 * JsonTableColumnType -
2047 * enumeration of JSON_TABLE column types
2048 */
2057
2058/*
2059 * JsonTableColumn -
2060 * untransformed representation of JSON_TABLE column
2061 */
2062typedef struct JsonTableColumn
2063{
2065 JsonTableColumnType coltype; /* column type */
2066 char *name; /* column name */
2067 TypeName *typeName; /* column type name */
2068 JsonTablePathSpec *pathspec; /* JSON path specification */
2069 JsonFormat *format; /* JSON format clause, if specified */
2070 JsonWrapper wrapper; /* WRAPPER behavior for formatted columns */
2071 JsonQuotes quotes; /* omit or keep quotes on scalar strings? */
2072 List *columns; /* nested columns */
2073 JsonBehavior *on_empty; /* ON EMPTY behavior */
2074 JsonBehavior *on_error; /* ON ERROR behavior */
2075 ParseLoc location; /* token location, or -1 if unknown */
2077
2078/*
2079 * JsonKeyValue -
2080 * untransformed representation of JSON object key-value pair for
2081 * JSON_OBJECT() and JSON_OBJECTAGG()
2082 */
2083typedef struct JsonKeyValue
2084{
2086 Expr *key; /* key expression */
2087 JsonValueExpr *value; /* JSON value expression */
2089
2090/*
2091 * JsonParseExpr -
2092 * untransformed representation of JSON()
2093 */
2094typedef struct JsonParseExpr
2095{
2097 JsonValueExpr *expr; /* string expression */
2098 JsonOutput *output; /* RETURNING clause, if specified */
2099 bool unique_keys; /* WITH UNIQUE KEYS? */
2100 ParseLoc location; /* token location, or -1 if unknown */
2102
2103/*
2104 * JsonScalarExpr -
2105 * untransformed representation of JSON_SCALAR()
2106 */
2107typedef struct JsonScalarExpr
2108{
2110 Expr *expr; /* scalar expression */
2111 JsonOutput *output; /* RETURNING clause, if specified */
2112 ParseLoc location; /* token location, or -1 if unknown */
2114
2115/*
2116 * JsonSerializeExpr -
2117 * untransformed representation of JSON_SERIALIZE() function
2118 */
2119typedef struct JsonSerializeExpr
2120{
2122 JsonValueExpr *expr; /* json value expression */
2123 JsonOutput *output; /* RETURNING clause, if specified */
2124 ParseLoc location; /* token location, or -1 if unknown */
2126
2127/*
2128 * JsonObjectConstructor -
2129 * untransformed representation of JSON_OBJECT() constructor
2130 */
2132{
2134 List *exprs; /* list of JsonKeyValue pairs */
2135 JsonOutput *output; /* RETURNING clause, if specified */
2136 bool absent_on_null; /* skip NULL values? */
2137 bool unique; /* check key uniqueness? */
2138 ParseLoc location; /* token location, or -1 if unknown */
2140
2141/*
2142 * JsonArrayConstructor -
2143 * untransformed representation of JSON_ARRAY(element,...) constructor
2144 */
2146{
2148 List *exprs; /* list of JsonValueExpr elements */
2149 JsonOutput *output; /* RETURNING clause, if specified */
2150 bool absent_on_null; /* skip NULL elements? */
2151 ParseLoc location; /* token location, or -1 if unknown */
2153
2154/*
2155 * JsonArrayQueryConstructor -
2156 * untransformed representation of JSON_ARRAY(subquery) constructor
2157 */
2159{
2161 Node *query; /* subquery */
2162 JsonOutput *output; /* RETURNING clause, if specified */
2163 JsonFormat *format; /* FORMAT clause for subquery, if specified */
2164 bool absent_on_null; /* skip NULL elements? */
2165 ParseLoc location; /* token location, or -1 if unknown */
2167
2168/*
2169 * JsonAggConstructor -
2170 * common fields of untransformed representation of
2171 * JSON_ARRAYAGG() and JSON_OBJECTAGG()
2172 */
2174{
2176 JsonOutput *output; /* RETURNING clause, if any */
2177 Node *agg_filter; /* FILTER clause, if any */
2178 List *agg_order; /* ORDER BY clause, if any */
2179 struct WindowDef *over; /* OVER clause, if any */
2180 ParseLoc location; /* token location, or -1 if unknown */
2182
2183/*
2184 * JsonObjectAgg -
2185 * untransformed representation of JSON_OBJECTAGG()
2186 */
2187typedef struct JsonObjectAgg
2188{
2190 JsonAggConstructor *constructor; /* common fields */
2191 JsonKeyValue *arg; /* object key-value pair */
2192 bool absent_on_null; /* skip NULL values? */
2193 bool unique; /* check key uniqueness? */
2195
2196/*
2197 * JsonArrayAgg -
2198 * untransformed representation of JSON_ARRAYAGG()
2199 */
2200typedef struct JsonArrayAgg
2201{
2203 JsonAggConstructor *constructor; /* common fields */
2204 JsonValueExpr *arg; /* array element expression */
2205 bool absent_on_null; /* skip NULL elements? */
2207
2208
2209/*****************************************************************************
2210 * Raw Grammar Output Statements
2211 *****************************************************************************/
2212
2213/*
2214 * RawStmt --- container for any one statement's raw parse tree
2215 *
2216 * Parse analysis converts a raw parse tree headed by a RawStmt node into
2217 * an analyzed statement headed by a Query node. For optimizable statements,
2218 * the conversion is complex. For utility statements, the parser usually just
2219 * transfers the raw parse tree (sans RawStmt) into the utilityStmt field of
2220 * the Query node, and all the useful work happens at execution time.
2221 *
2222 * stmt_location/stmt_len identify the portion of the source text string
2223 * containing this raw statement (useful for multi-statement strings).
2224 *
2225 * This is irrelevant for query jumbling, as this is not used in parsed
2226 * queries.
2227 */
2228typedef struct RawStmt
2229{
2231
2232 NodeTag type;
2233 Node *stmt; /* raw parse tree */
2234 ParseLoc stmt_location; /* start location, or -1 if unknown */
2235 ParseLoc stmt_len; /* length in bytes; 0 means "rest of string" */
2237
2238/*****************************************************************************
2239 * Optimizable Statements
2240 *****************************************************************************/
2241
2242/* ----------------------
2243 * Insert Statement
2244 *
2245 * The source expression is represented by SelectStmt for both the
2246 * SELECT and VALUES cases. If selectStmt is NULL, then the query
2247 * is INSERT ... DEFAULT VALUES.
2248 * ----------------------
2249 */
2250typedef struct InsertStmt
2251{
2253 RangeVar *relation; /* relation to insert into */
2254 List *cols; /* optional: names of the target columns */
2255 Node *selectStmt; /* the source SELECT/VALUES, or NULL */
2256 OnConflictClause *onConflictClause; /* ON CONFLICT clause */
2257 ReturningClause *returningClause; /* RETURNING clause */
2258 WithClause *withClause; /* WITH clause */
2259 OverridingKind override; /* OVERRIDING clause */
2261
2262/* ----------------------
2263 * Delete Statement
2264 * ----------------------
2265 */
2266typedef struct DeleteStmt
2267{
2269 RangeVar *relation; /* relation to delete from */
2270 List *usingClause; /* optional using clause for more tables */
2271 Node *whereClause; /* qualifications */
2272 ReturningClause *returningClause; /* RETURNING clause */
2273 WithClause *withClause; /* WITH clause */
2274 ForPortionOfClause *forPortionOf; /* FOR PORTION OF clause */
2276
2277/* ----------------------
2278 * Update Statement
2279 * ----------------------
2280 */
2281typedef struct UpdateStmt
2282{
2284 RangeVar *relation; /* relation to update */
2285 List *targetList; /* the target list (of ResTarget) */
2286 Node *whereClause; /* qualifications */
2287 List *fromClause; /* optional from clause for more tables */
2288 ReturningClause *returningClause; /* RETURNING clause */
2289 WithClause *withClause; /* WITH clause */
2290 ForPortionOfClause *forPortionOf; /* FOR PORTION OF clause */
2292
2293/* ----------------------
2294 * Merge Statement
2295 * ----------------------
2296 */
2297typedef struct MergeStmt
2298{
2300 RangeVar *relation; /* target relation to merge into */
2301 Node *sourceRelation; /* source relation */
2302 Node *joinCondition; /* join condition between source and target */
2303 List *mergeWhenClauses; /* list of MergeWhenClause(es) */
2304 ReturningClause *returningClause; /* RETURNING clause */
2305 WithClause *withClause; /* WITH clause */
2307
2308/* ----------------------
2309 * Select Statement
2310 *
2311 * A "simple" SELECT is represented in the output of gram.y by a single
2312 * SelectStmt node; so is a VALUES construct. A query containing set
2313 * operators (UNION, INTERSECT, EXCEPT) is represented by a tree of SelectStmt
2314 * nodes, in which the leaf nodes are component SELECTs and the internal nodes
2315 * represent UNION, INTERSECT, or EXCEPT operators. Using the same node
2316 * type for both leaf and internal nodes allows gram.y to stick ORDER BY,
2317 * LIMIT, etc, clause values into a SELECT statement without worrying
2318 * whether it is a simple or compound SELECT.
2319 * ----------------------
2320 */
2328
2329typedef struct SelectStmt
2330{
2332
2333 /*
2334 * These fields are used only in "leaf" SelectStmts.
2335 */
2336 List *distinctClause; /* NULL, list of DISTINCT ON exprs, or
2337 * lcons(NIL,NIL) for all (SELECT DISTINCT) */
2338 IntoClause *intoClause; /* target for SELECT INTO */
2339 List *targetList; /* the target list (of ResTarget) */
2340 List *fromClause; /* the FROM clause */
2341 Node *whereClause; /* WHERE qualification */
2342 List *groupClause; /* GROUP BY clauses */
2343 bool groupDistinct; /* Is this GROUP BY DISTINCT? */
2344 bool groupByAll; /* Is this GROUP BY ALL? */
2345 Node *havingClause; /* HAVING conditional-expression */
2346 List *windowClause; /* WINDOW window_name AS (...), ... */
2347
2348 /*
2349 * In a "leaf" node representing a VALUES list, the above fields are all
2350 * null, and instead this field is set. Note that the elements of the
2351 * sublists are just expressions, without ResTarget decoration. Also note
2352 * that a list element can be DEFAULT (represented as a SetToDefault
2353 * node), regardless of the context of the VALUES list. It's up to parse
2354 * analysis to reject that where not valid.
2355 */
2356 List *valuesLists; /* untransformed list of expression lists */
2357
2358 /*
2359 * These fields are used in both "leaf" SelectStmts and upper-level
2360 * SelectStmts.
2361 */
2362 List *sortClause; /* sort clause (a list of SortBy's) */
2363 Node *limitOffset; /* # of result tuples to skip */
2364 Node *limitCount; /* # of result tuples to return */
2365 LimitOption limitOption; /* limit type */
2366 List *lockingClause; /* FOR UPDATE (list of LockingClause's) */
2367 WithClause *withClause; /* WITH clause */
2368
2369 /*
2370 * These fields are used only in upper-level SelectStmts.
2371 */
2372 SetOperation op; /* type of set op */
2373 bool all; /* ALL specified? */
2374 struct SelectStmt *larg; /* left child */
2375 struct SelectStmt *rarg; /* right child */
2376 /* Eventually add fields for CORRESPONDING spec here */
2378
2379
2380/* ----------------------
2381 * Set Operation node for post-analysis query trees
2382 *
2383 * After parse analysis, a SELECT with set operations is represented by a
2384 * top-level Query node containing the leaf SELECTs as subqueries in its
2385 * range table. Its setOperations field shows the tree of set operations,
2386 * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal
2387 * nodes replaced by SetOperationStmt nodes. Information about the output
2388 * column types is added, too. (Note that the child nodes do not necessarily
2389 * produce these types directly, but we've checked that their output types
2390 * can be coerced to the output column type.) Also, if it's not UNION ALL,
2391 * information about the types' sort/group semantics is provided in the form
2392 * of a SortGroupClause list (same representation as, eg, DISTINCT).
2393 * The resolved common column collations are provided too; but note that if
2394 * it's not UNION ALL, it's okay for a column to not have a common collation,
2395 * so a member of the colCollations list could be InvalidOid even though the
2396 * column has a collatable type.
2397 * ----------------------
2398 */
2399typedef struct SetOperationStmt
2400{
2402 SetOperation op; /* type of set op */
2403 bool all; /* ALL specified? */
2404 Node *larg; /* left child */
2405 Node *rarg; /* right child */
2406 /* Eventually add fields for CORRESPONDING spec here */
2407
2408 /* Fields derived during parse analysis: */
2409 /* OID list of output column type OIDs */
2411 /* integer list of output column typmods */
2413 /* OID list of output column collation OIDs */
2415 /* a list of SortGroupClause's */
2417 /* groupClauses is NIL if UNION ALL, but must be set otherwise */
2419
2420
2421/*
2422 * RETURN statement (inside SQL function body)
2423 */
2429
2430
2431/* ----------------------
2432 * PL/pgSQL Assignment Statement
2433 *
2434 * Like SelectStmt, this is transformed into a SELECT Query.
2435 * However, the targetlist of the result looks more like an UPDATE.
2436 * ----------------------
2437 */
2438typedef struct PLAssignStmt
2439{
2441
2442 char *name; /* initial column name */
2443 List *indirection; /* subscripts and field names, if any */
2444 int nnames; /* number of names to use in ColumnRef */
2445 SelectStmt *val; /* the PL/pgSQL expression to assign */
2446 ParseLoc location; /* name's token location, or -1 if unknown */
2448
2449
2450/*****************************************************************************
2451 * Other Statements (no optimizations required)
2452 *
2453 * These are not touched by parser/analyze.c except to put them into
2454 * the utilityStmt field of a Query. This is eventually passed to
2455 * ProcessUtility (by-passing rewriting and planning). Some of the
2456 * statements do need attention from parse analysis, and this is
2457 * done by routines in parser/parse_utilcmd.c after ProcessUtility
2458 * receives the command for execution.
2459 * DECLARE CURSOR, EXPLAIN, and CREATE TABLE AS are special cases:
2460 * they contain optimizable statements, which get processed normally
2461 * by parser/analyze.c.
2462 *****************************************************************************/
2463
2464/*
2465 * When a command can act on several kinds of objects with only one
2466 * parse structure required, use these constants to designate the
2467 * object type. Note that commands typically don't support all the types.
2468 */
2469
2526
2527/* ----------------------
2528 * Create Schema Statement
2529 *
2530 * NOTE: the schemaElts list contains raw parsetrees for component statements
2531 * of the schema, such as CREATE TABLE, GRANT, etc. These are analyzed and
2532 * executed after the schema itself is created.
2533 * ----------------------
2534 */
2535typedef struct CreateSchemaStmt
2536{
2538 char *schemaname; /* the name of the schema to create */
2539 RoleSpec *authrole; /* the owner of the created schema */
2540 List *schemaElts; /* schema components (list of parsenodes) */
2541 bool if_not_exists; /* just do nothing if schema already exists? */
2543
2544typedef enum DropBehavior
2545{
2546 DROP_RESTRICT, /* drop fails if any dependent objects */
2547 DROP_CASCADE, /* remove dependent objects too */
2549
2550/* ----------------------
2551 * Alter Table
2552 * ----------------------
2553 */
2554typedef struct AlterTableStmt
2555{
2557 RangeVar *relation; /* table to work on */
2558 List *cmds; /* list of subcommands */
2559 ObjectType objtype; /* type of object */
2560 bool missing_ok; /* skip error if table missing */
2562
2563typedef enum AlterTableType
2564{
2565 AT_AddColumn, /* add column */
2566 AT_AddColumnToView, /* implicitly via CREATE OR REPLACE VIEW */
2567 AT_ColumnDefault, /* alter column default */
2568 AT_CookedColumnDefault, /* add a pre-cooked column default */
2569 AT_DropNotNull, /* alter column drop not null */
2570 AT_SetNotNull, /* alter column set not null */
2571 AT_SetExpression, /* alter column set expression */
2572 AT_DropExpression, /* alter column drop expression */
2573 AT_SetStatistics, /* alter column set statistics */
2574 AT_SetOptions, /* alter column set ( options ) */
2575 AT_ResetOptions, /* alter column reset ( options ) */
2576 AT_SetStorage, /* alter column set storage */
2577 AT_SetCompression, /* alter column set compression */
2578 AT_DropColumn, /* drop column */
2579 AT_AddIndex, /* add index */
2580 AT_ReAddIndex, /* internal to commands/tablecmds.c */
2581 AT_AddConstraint, /* add constraint */
2582 AT_ReAddConstraint, /* internal to commands/tablecmds.c */
2583 AT_ReAddDomainConstraint, /* internal to commands/tablecmds.c */
2584 AT_AlterConstraint, /* alter constraint */
2585 AT_ValidateConstraint, /* validate constraint */
2586 AT_AddIndexConstraint, /* add constraint using existing index */
2587 AT_DropConstraint, /* drop constraint */
2588 AT_ReAddComment, /* internal to commands/tablecmds.c */
2589 AT_AlterColumnType, /* alter column type */
2590 AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */
2591 AT_ChangeOwner, /* change owner */
2592 AT_ClusterOn, /* CLUSTER ON */
2593 AT_DropCluster, /* SET WITHOUT CLUSTER */
2594 AT_SetLogged, /* SET LOGGED */
2595 AT_SetUnLogged, /* SET UNLOGGED */
2596 AT_DropOids, /* SET WITHOUT OIDS */
2597 AT_SetAccessMethod, /* SET ACCESS METHOD */
2598 AT_SetTableSpace, /* SET TABLESPACE */
2599 AT_SetRelOptions, /* SET (...) -- AM specific parameters */
2600 AT_ResetRelOptions, /* RESET (...) -- AM specific parameters */
2601 AT_ReplaceRelOptions, /* replace reloption list in its entirety */
2602 AT_EnableTrig, /* ENABLE TRIGGER name */
2603 AT_EnableAlwaysTrig, /* ENABLE ALWAYS TRIGGER name */
2604 AT_EnableReplicaTrig, /* ENABLE REPLICA TRIGGER name */
2605 AT_DisableTrig, /* DISABLE TRIGGER name */
2606 AT_EnableTrigAll, /* ENABLE TRIGGER ALL */
2607 AT_DisableTrigAll, /* DISABLE TRIGGER ALL */
2608 AT_EnableTrigUser, /* ENABLE TRIGGER USER */
2609 AT_DisableTrigUser, /* DISABLE TRIGGER USER */
2610 AT_EnableRule, /* ENABLE RULE name */
2611 AT_EnableAlwaysRule, /* ENABLE ALWAYS RULE name */
2612 AT_EnableReplicaRule, /* ENABLE REPLICA RULE name */
2613 AT_DisableRule, /* DISABLE RULE name */
2614 AT_AddInherit, /* INHERIT parent */
2615 AT_DropInherit, /* NO INHERIT parent */
2616 AT_AddOf, /* OF <type_name> */
2617 AT_DropOf, /* NOT OF */
2618 AT_ReplicaIdentity, /* REPLICA IDENTITY */
2619 AT_EnableRowSecurity, /* ENABLE ROW SECURITY */
2620 AT_DisableRowSecurity, /* DISABLE ROW SECURITY */
2621 AT_ForceRowSecurity, /* FORCE ROW SECURITY */
2622 AT_NoForceRowSecurity, /* NO FORCE ROW SECURITY */
2623 AT_GenericOptions, /* OPTIONS (...) */
2624 AT_AttachPartition, /* ATTACH PARTITION */
2625 AT_DetachPartition, /* DETACH PARTITION */
2626 AT_DetachPartitionFinalize, /* DETACH PARTITION FINALIZE */
2627 AT_SplitPartition, /* SPLIT PARTITION */
2628 AT_MergePartitions, /* MERGE PARTITIONS */
2629 AT_AddIdentity, /* ADD IDENTITY */
2630 AT_SetIdentity, /* SET identity column options */
2631 AT_DropIdentity, /* DROP IDENTITY */
2632 AT_ReAddStatistics, /* internal to commands/tablecmds.c */
2634
2635typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
2636{
2638 AlterTableType subtype; /* Type of table alteration to apply */
2639 char *name; /* column, constraint, or trigger to act on,
2640 * or tablespace, access method */
2641 int16 num; /* attribute number for columns referenced by
2642 * number */
2644 Node *def; /* definition of new column, index,
2645 * constraint, or parent table */
2646 DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
2647 bool missing_ok; /* skip error if missing? */
2648 bool recurse; /* exec-time recursion */
2650
2651/* Ad-hoc node for AT_AlterConstraint */
2652typedef struct ATAlterConstraint
2653{
2655 char *conname; /* Constraint name */
2656 bool alterEnforceability; /* changing enforceability properties? */
2657 bool is_enforced; /* ENFORCED? */
2658 bool alterDeferrability; /* changing deferrability properties? */
2659 bool deferrable; /* DEFERRABLE? */
2660 bool initdeferred; /* INITIALLY DEFERRED? */
2661 bool alterInheritability; /* changing inheritability properties */
2664
2665/* Ad-hoc node for AT_ReplicaIdentity */
2672
2673
2674/* ----------------------
2675 * Alter Collation
2676 * ----------------------
2677 */
2683
2684
2685/* ----------------------
2686 * Alter Domain
2687 *
2688 * The fields are used in different ways by the different variants of
2689 * this command.
2690 * ----------------------
2691 */
2693{
2694 AD_AlterDefault = 'T', /* SET|DROP DEFAULT */
2695 AD_DropNotNull = 'N', /* DROP NOT NULL */
2696 AD_SetNotNull = 'O', /* SET NOT NULL */
2697 AD_AddConstraint = 'C', /* ADD CONSTRAINT */
2698 AD_DropConstraint = 'X', /* DROP CONSTRAINT */
2699 AD_ValidateConstraint = 'V', /* VALIDATE CONSTRAINT */
2701
2702typedef struct AlterDomainStmt
2703{
2705 AlterDomainType subtype; /* subtype of command */
2706 List *typeName; /* domain to work on */
2707 char *name; /* column or constraint name to act on */
2708 Node *def; /* definition of default or constraint */
2709 DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
2710 bool missing_ok; /* skip error if missing? */
2712
2713
2714/* ----------------------
2715 * Grant|Revoke Statement
2716 * ----------------------
2717 */
2719{
2720 ACL_TARGET_OBJECT, /* grant on specific named object(s) */
2721 ACL_TARGET_ALL_IN_SCHEMA, /* grant on all objects in given schema(s) */
2722 ACL_TARGET_DEFAULTS, /* ALTER DEFAULT PRIVILEGES */
2724
2725typedef struct GrantStmt
2726{
2728 bool is_grant; /* true = GRANT, false = REVOKE */
2729 GrantTargetType targtype; /* type of the grant target */
2730 ObjectType objtype; /* kind of object being operated on */
2731 List *objects; /* list of RangeVar nodes, ObjectWithArgs
2732 * nodes, or plain names (as String values) */
2733 List *privileges; /* list of AccessPriv nodes */
2734 /* privileges == NIL denotes ALL PRIVILEGES */
2735 List *grantees; /* list of RoleSpec nodes */
2736 bool grant_option; /* grant or revoke grant option */
2737 RoleSpec *grantor; /* GRANTED BY clause, or NULL if none */
2738 DropBehavior behavior; /* drop behavior (for REVOKE) */
2740
2741/*
2742 * ObjectWithArgs represents a function/procedure/operator name plus parameter
2743 * identification.
2744 *
2745 * objargs includes only the types of the input parameters of the object.
2746 * In some contexts, that will be all we have, and it's enough to look up
2747 * objects according to the traditional Postgres rules (i.e., when only input
2748 * arguments matter).
2749 *
2750 * objfuncargs, if not NIL, carries the full specification of the parameter
2751 * list, including parameter mode annotations.
2752 *
2753 * Some grammar productions can set args_unspecified = true instead of
2754 * providing parameter info. In this case, lookup will succeed only if
2755 * the object name is unique. Note that otherwise, NIL parameter lists
2756 * mean zero arguments.
2757 */
2758typedef struct ObjectWithArgs
2759{
2761 List *objname; /* qualified name of function/operator */
2762 List *objargs; /* list of Typename nodes (input args only) */
2763 List *objfuncargs; /* list of FunctionParameter nodes */
2764 bool args_unspecified; /* argument list was omitted? */
2766
2767/*
2768 * An access privilege, with optional list of column names
2769 * priv_name == NULL denotes ALL PRIVILEGES (only used with a column list)
2770 * cols == NIL denotes "all columns"
2771 * Note that simple "ALL PRIVILEGES" is represented as a NIL list, not
2772 * an AccessPriv with both fields null.
2773 */
2774typedef struct AccessPriv
2775{
2777 char *priv_name; /* string name of privilege */
2778 List *cols; /* list of String */
2780
2781/* ----------------------
2782 * Grant/Revoke Role Statement
2783 *
2784 * Note: because of the parsing ambiguity with the GRANT <privileges>
2785 * statement, granted_roles is a list of AccessPriv; the execution code
2786 * should complain if any column lists appear. grantee_roles is a list
2787 * of role names, as RoleSpec values.
2788 * ----------------------
2789 */
2790typedef struct GrantRoleStmt
2791{
2793 List *granted_roles; /* list of roles to be granted/revoked */
2794 List *grantee_roles; /* list of member roles to add/delete */
2795 bool is_grant; /* true = GRANT, false = REVOKE */
2796 List *opt; /* options e.g. WITH GRANT OPTION */
2797 RoleSpec *grantor; /* set grantor to other than current role */
2798 DropBehavior behavior; /* drop behavior (for REVOKE) */
2800
2801/* ----------------------
2802 * Alter Default Privileges Statement
2803 * ----------------------
2804 */
2806{
2808 List *options; /* list of DefElem */
2809 GrantStmt *action; /* GRANT/REVOKE action (with objects=NIL) */
2811
2812/* ----------------------
2813 * Copy Statement
2814 *
2815 * We support "COPY relation FROM file", "COPY relation TO file", and
2816 * "COPY (query) TO file". In any given CopyStmt, exactly one of "relation"
2817 * and "query" must be non-NULL.
2818 * ----------------------
2819 */
2820typedef struct CopyStmt
2821{
2823 RangeVar *relation; /* the relation to copy */
2824 Node *query; /* the query (SELECT or DML statement with
2825 * RETURNING) to copy, as a raw parse tree */
2826 List *attlist; /* List of column names (as Strings), or NIL
2827 * for all columns */
2828 bool is_from; /* TO or FROM */
2829 bool is_program; /* is 'filename' a program to popen? */
2830 char *filename; /* filename, or NULL for STDIN/STDOUT */
2831 List *options; /* List of DefElem nodes */
2832 Node *whereClause; /* WHERE condition (or NULL) */
2834
2835/* ----------------------
2836 * SET Statement (includes RESET)
2837 *
2838 * "SET var TO DEFAULT" and "RESET var" are semantically equivalent, but we
2839 * preserve the distinction in VariableSetKind for CreateCommandTag().
2840 * ----------------------
2841 */
2843{
2844 VAR_SET_VALUE, /* SET var = value */
2845 VAR_SET_DEFAULT, /* SET var TO DEFAULT */
2846 VAR_SET_CURRENT, /* SET var FROM CURRENT */
2847 VAR_SET_MULTI, /* special case for SET TRANSACTION ... */
2848 VAR_RESET, /* RESET var */
2849 VAR_RESET_ALL, /* RESET ALL */
2851
2852typedef struct VariableSetStmt
2853{
2855
2856 NodeTag type;
2858 /* variable to be set */
2859 char *name;
2860 /* List of A_Const nodes */
2862
2863 /*
2864 * True if arguments should be accounted for in query jumbling. We use a
2865 * separate flag rather than query_jumble_ignore on "args" as several
2866 * grammar flavors of SET rely on a list of values that are parsed
2867 * directly from the grammar's keywords.
2868 */
2870 /* SET LOCAL? */
2872 /* token location, or -1 if unknown */
2875
2876/* ----------------------
2877 * Show Statement
2878 * ----------------------
2879 */
2885
2886/* ----------------------
2887 * Create Table Statement
2888 *
2889 * NOTE: in the raw gram.y output, ColumnDef and Constraint nodes are
2890 * intermixed in tableElts, and constraints and nnconstraints are NIL. After
2891 * parse analysis, tableElts contains just ColumnDefs, nnconstraints contains
2892 * Constraint nodes of CONSTR_NOTNULL type from various sources, and
2893 * constraints contains just CONSTR_CHECK Constraint nodes.
2894 * ----------------------
2895 */
2896
2897typedef struct CreateStmt
2898{
2900 RangeVar *relation; /* relation to create */
2901 List *tableElts; /* column definitions (list of ColumnDef) */
2902 List *inhRelations; /* relations to inherit from (list of
2903 * RangeVar) */
2904 PartitionBoundSpec *partbound; /* FOR VALUES clause */
2905 PartitionSpec *partspec; /* PARTITION BY clause */
2906 TypeName *ofTypename; /* OF typename */
2907 List *constraints; /* constraints (list of Constraint nodes) */
2908 List *nnconstraints; /* NOT NULL constraints (ditto) */
2909 List *options; /* options from WITH clause */
2910 OnCommitAction oncommit; /* what do we do at COMMIT? */
2911 char *tablespacename; /* table space to use, or NULL */
2912 char *accessMethod; /* table access method */
2913 bool if_not_exists; /* just do nothing if it already exists? */
2915
2916/* ----------
2917 * Definitions for constraints in CreateStmt
2918 *
2919 * Note that column defaults are treated as a type of constraint,
2920 * even though that's a bit odd semantically.
2921 *
2922 * For constraints that use expressions (CONSTR_CHECK, CONSTR_DEFAULT)
2923 * we may have the expression in either "raw" form (an untransformed
2924 * parse tree) or "cooked" form (the nodeToString representation of
2925 * an executable expression tree), depending on how this Constraint
2926 * node was created (by parsing, or by inheritance from an existing
2927 * relation). We should never have both in the same node!
2928 *
2929 * FKCONSTR_ACTION_xxx values are stored into pg_constraint.confupdtype
2930 * and pg_constraint.confdeltype columns; FKCONSTR_MATCH_xxx values are
2931 * stored into pg_constraint.confmatchtype. Changing the code values may
2932 * require an initdb!
2933 *
2934 * If skip_validation is true then we skip checking that the existing rows
2935 * in the table satisfy the constraint, and just install the catalog entries
2936 * for the constraint. A new FK constraint is marked as valid iff
2937 * initially_valid is true. (Usually skip_validation and initially_valid
2938 * are inverses, but we can set both true if the table is known empty.)
2939 *
2940 * Constraint attributes (DEFERRABLE etc) are initially represented as
2941 * separate Constraint nodes for simplicity of parsing. parse_utilcmd.c makes
2942 * a pass through the constraints list to insert the info into the appropriate
2943 * Constraint node.
2944 * ----------
2945 */
2946
2967
2968/* Foreign key action codes */
2969#define FKCONSTR_ACTION_NOACTION 'a'
2970#define FKCONSTR_ACTION_RESTRICT 'r'
2971#define FKCONSTR_ACTION_CASCADE 'c'
2972#define FKCONSTR_ACTION_SETNULL 'n'
2973#define FKCONSTR_ACTION_SETDEFAULT 'd'
2974
2975/* Foreign key matchtype codes */
2976#define FKCONSTR_MATCH_FULL 'f'
2977#define FKCONSTR_MATCH_PARTIAL 'p'
2978#define FKCONSTR_MATCH_SIMPLE 's'
2979
2980typedef struct Constraint
2981{
2983 ConstrType contype; /* see above */
2984 char *conname; /* Constraint name, or NULL if unnamed */
2985 bool deferrable; /* DEFERRABLE? */
2986 bool initdeferred; /* INITIALLY DEFERRED? */
2987 bool is_enforced; /* enforced constraint? */
2988 bool skip_validation; /* skip validation of existing rows? */
2989 bool initially_valid; /* mark the new constraint as valid? */
2990 bool is_no_inherit; /* is constraint non-inheritable? */
2991 Node *raw_expr; /* CHECK or DEFAULT expression, as
2992 * untransformed parse tree */
2993 char *cooked_expr; /* CHECK or DEFAULT expression, as
2994 * nodeToString representation */
2995 char generated_when; /* ALWAYS or BY DEFAULT */
2996 char generated_kind; /* STORED or VIRTUAL */
2997 bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
2998 List *keys; /* String nodes naming referenced key
2999 * column(s); for UNIQUE/PK/NOT NULL */
3000 bool without_overlaps; /* WITHOUT OVERLAPS specified */
3001 List *including; /* String nodes naming referenced nonkey
3002 * column(s); for UNIQUE/PK */
3003 List *exclusions; /* list of (IndexElem, operator name) pairs;
3004 * for exclusion constraints */
3005 List *options; /* options from WITH clause */
3006 char *indexname; /* existing index to use; otherwise NULL */
3007 char *indexspace; /* index tablespace; NULL for default */
3008 bool reset_default_tblspc; /* reset default_tablespace prior to
3009 * creating the index */
3010 char *access_method; /* index access method; NULL for default */
3011 Node *where_clause; /* partial index predicate */
3012
3013 /* Fields used for FOREIGN KEY constraints: */
3014 RangeVar *pktable; /* Primary key table */
3015 List *fk_attrs; /* Attributes of foreign key */
3016 List *pk_attrs; /* Corresponding attrs in PK table */
3017 bool fk_with_period; /* Last attribute of FK uses PERIOD */
3018 bool pk_with_period; /* Last attribute of PK uses PERIOD */
3019 char fk_matchtype; /* FULL, PARTIAL, SIMPLE */
3020 char fk_upd_action; /* ON UPDATE action */
3021 char fk_del_action; /* ON DELETE action */
3022 List *fk_del_set_cols; /* ON DELETE SET NULL/DEFAULT (col1, col2) */
3023 List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */
3024 Oid old_pktable_oid; /* pg_constraint.confrelid of my former
3025 * self */
3026
3027 ParseLoc location; /* token location, or -1 if unknown */
3029
3030/* ----------------------
3031 * Create/Drop Table Space Statements
3032 * ----------------------
3033 */
3034
3043
3045{
3048 bool missing_ok; /* skip error if missing? */
3050
3058
3060{
3063 ObjectType objtype; /* Object type to move */
3064 List *roles; /* List of roles to move objects of */
3068
3069/* ----------------------
3070 * Create/Alter Extension Statements
3071 * ----------------------
3072 */
3073
3075{
3077 char *extname;
3078 bool if_not_exists; /* just do nothing if it already exists? */
3079 List *options; /* List of DefElem nodes */
3081
3082/* Only used for ALTER EXTENSION UPDATE; later might need an action field */
3084{
3086 char *extname;
3087 List *options; /* List of DefElem nodes */
3089
3091{
3093 char *extname; /* Extension's name */
3094 int action; /* +1 = add object, -1 = drop object */
3095 ObjectType objtype; /* Object's type */
3096 Node *object; /* Qualified name of the object */
3098
3099/* ----------------------
3100 * Create/Alter FOREIGN DATA WRAPPER Statements
3101 * ----------------------
3102 */
3103
3104typedef struct CreateFdwStmt
3105{
3107 char *fdwname; /* foreign-data wrapper name */
3108 List *func_options; /* HANDLER/VALIDATOR options */
3109 List *options; /* generic options to FDW */
3111
3112typedef struct AlterFdwStmt
3113{
3115 char *fdwname; /* foreign-data wrapper name */
3116 List *func_options; /* HANDLER/VALIDATOR options */
3117 List *options; /* generic options to FDW */
3119
3120/* ----------------------
3121 * Create/Alter FOREIGN SERVER Statements
3122 * ----------------------
3123 */
3124
3126{
3128 char *servername; /* server name */
3129 char *servertype; /* optional server type */
3130 char *version; /* optional server version */
3131 char *fdwname; /* FDW name */
3132 bool if_not_exists; /* just do nothing if it already exists? */
3133 List *options; /* generic options to server */
3135
3137{
3139 char *servername; /* server name */
3140 char *version; /* optional server version */
3141 List *options; /* generic options to server */
3142 bool has_version; /* version specified */
3144
3145/* ----------------------
3146 * Create FOREIGN TABLE Statement
3147 * ----------------------
3148 */
3149
3156
3157/* ----------------------
3158 * Create/Drop USER MAPPING Statements
3159 * ----------------------
3160 */
3161
3163{
3165 RoleSpec *user; /* user role */
3166 char *servername; /* server name */
3167 bool if_not_exists; /* just do nothing if it already exists? */
3168 List *options; /* generic options to server */
3170
3172{
3174 RoleSpec *user; /* user role */
3175 char *servername; /* server name */
3176 List *options; /* generic options to server */
3178
3180{
3182 RoleSpec *user; /* user role */
3183 char *servername; /* server name */
3184 bool missing_ok; /* ignore missing mappings */
3186
3187/* ----------------------
3188 * Import Foreign Schema Statement
3189 * ----------------------
3190 */
3191
3193{
3194 FDW_IMPORT_SCHEMA_ALL, /* all relations wanted */
3195 FDW_IMPORT_SCHEMA_LIMIT_TO, /* include only listed tables in import */
3196 FDW_IMPORT_SCHEMA_EXCEPT, /* exclude listed tables from import */
3198
3200{
3202 char *server_name; /* FDW server name */
3203 char *remote_schema; /* remote schema name to query */
3204 char *local_schema; /* local schema to create objects in */
3205 ImportForeignSchemaType list_type; /* type of table list */
3206 List *table_list; /* List of RangeVar */
3207 List *options; /* list of options to pass to FDW */
3209
3210/*----------------------
3211 * Create POLICY Statement
3212 *----------------------
3213 */
3214typedef struct CreatePolicyStmt
3215{
3217 char *policy_name; /* Policy's name */
3218 RangeVar *table; /* the table name the policy applies to */
3219 char *cmd_name; /* the command name the policy applies to */
3220 bool permissive; /* restrictive or permissive policy */
3221 List *roles; /* the roles associated with the policy */
3222 Node *qual; /* the policy's condition */
3223 Node *with_check; /* the policy's WITH CHECK condition. */
3225
3226/*----------------------
3227 * Alter POLICY Statement
3228 *----------------------
3229 */
3230typedef struct AlterPolicyStmt
3231{
3233 char *policy_name; /* Policy's name */
3234 RangeVar *table; /* the table name the policy applies to */
3235 List *roles; /* the roles associated with the policy */
3236 Node *qual; /* the policy's condition */
3237 Node *with_check; /* the policy's WITH CHECK condition. */
3239
3240/*----------------------
3241 * Create ACCESS METHOD Statement
3242 *----------------------
3243 */
3244typedef struct CreateAmStmt
3245{
3247 char *amname; /* access method name */
3248 List *handler_name; /* handler function name */
3249 char amtype; /* type of access method */
3251
3252/* ----------------------
3253 * Create TRIGGER Statement
3254 * ----------------------
3255 */
3256typedef struct CreateTrigStmt
3257{
3259 bool replace; /* replace trigger if already exists */
3260 bool isconstraint; /* This is a constraint trigger */
3261 char *trigname; /* TRIGGER's name */
3262 RangeVar *relation; /* relation trigger is on */
3263 List *funcname; /* qual. name of function to call */
3264 List *args; /* list of String or NIL */
3265 bool row; /* ROW/STATEMENT */
3266 /* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
3267 int16 timing; /* BEFORE, AFTER, or INSTEAD */
3268 /* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
3269 int16 events; /* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */
3270 List *columns; /* column names, or NIL for all columns */
3271 Node *whenClause; /* qual expression, or NULL if none */
3272 /* explicitly named transition data */
3273 List *transitionRels; /* TriggerTransition nodes, or NIL if none */
3274 /* The remaining fields are only used for constraint triggers */
3275 bool deferrable; /* [NOT] DEFERRABLE */
3276 bool initdeferred; /* INITIALLY {DEFERRED|IMMEDIATE} */
3277 RangeVar *constrrel; /* opposite relation, if RI trigger */
3279
3280/* ----------------------
3281 * Create EVENT TRIGGER Statement
3282 * ----------------------
3283 */
3285{
3287 char *trigname; /* TRIGGER's name */
3288 char *eventname; /* event's identifier */
3289 List *whenclause; /* list of DefElems indicating filtering */
3290 List *funcname; /* qual. name of function to call */
3292
3293/* ----------------------
3294 * Alter EVENT TRIGGER Statement
3295 * ----------------------
3296 */
3298{
3300 char *trigname; /* TRIGGER's name */
3301 char tgenabled; /* trigger's firing configuration WRT
3302 * session_replication_role */
3304
3305/* ----------------------
3306 * Create LANGUAGE Statements
3307 * ----------------------
3308 */
3309typedef struct CreatePLangStmt
3310{
3312 bool replace; /* T => replace if already exists */
3313 char *plname; /* PL name */
3314 List *plhandler; /* PL call handler function (qual. name) */
3315 List *plinline; /* optional inline function (qual. name) */
3316 List *plvalidator; /* optional validator function (qual. name) */
3317 bool pltrusted; /* PL is trusted */
3319
3320/* ----------------------
3321 * Create/Alter/Drop Role Statements
3322 *
3323 * Note: these node types are also used for the backwards-compatible
3324 * Create/Alter/Drop User/Group statements. In the ALTER and DROP cases
3325 * there's really no need to distinguish what the original spelling was,
3326 * but for CREATE we mark the type because the defaults vary.
3327 * ----------------------
3328 */
3335
3336typedef struct CreateRoleStmt
3337{
3339 RoleStmtType stmt_type; /* ROLE/USER/GROUP */
3340 char *role; /* role name */
3341 List *options; /* List of DefElem nodes */
3343
3344typedef struct AlterRoleStmt
3345{
3347 RoleSpec *role; /* role */
3348 List *options; /* List of DefElem nodes */
3349 int action; /* +1 = add members, -1 = drop members */
3351
3352typedef struct AlterRoleSetStmt
3353{
3355 RoleSpec *role; /* role */
3356 char *database; /* database name, or NULL */
3357 VariableSetStmt *setstmt; /* SET or RESET subcommand */
3359
3360typedef struct DropRoleStmt
3361{
3363 List *roles; /* List of roles to remove */
3364 bool missing_ok; /* skip error if a role is missing? */
3366
3367/* ----------------------
3368 * {Create|Alter} SEQUENCE Statement
3369 * ----------------------
3370 */
3371
3372typedef struct CreateSeqStmt
3373{
3375 RangeVar *sequence; /* the sequence to create */
3377 Oid ownerId; /* ID of owner, or InvalidOid for default */
3379 bool if_not_exists; /* just do nothing if it already exists? */
3381
3382typedef struct AlterSeqStmt
3383{
3385 RangeVar *sequence; /* the sequence to alter */
3388 bool missing_ok; /* skip error if a role is missing? */
3390
3391/* ----------------------
3392 * Create {Aggregate|Operator|Type} Statement
3393 * ----------------------
3394 */
3395typedef struct DefineStmt
3396{
3398 ObjectType kind; /* aggregate, operator, type */
3399 bool oldstyle; /* hack to signal old CREATE AGG syntax */
3400 List *defnames; /* qualified name (list of String) */
3401 List *args; /* a list of TypeName (if needed) */
3402 List *definition; /* a list of DefElem */
3403 bool if_not_exists; /* just do nothing if it already exists? */
3404 bool replace; /* replace if already exists? */
3406
3407/* ----------------------
3408 * Create Domain Statement
3409 * ----------------------
3410 */
3411typedef struct CreateDomainStmt
3412{
3414 List *domainname; /* qualified name (list of String) */
3415 TypeName *typeName; /* the base type */
3416 CollateClause *collClause; /* untransformed COLLATE spec, if any */
3417 List *constraints; /* constraints (list of Constraint nodes) */
3419
3420/* ----------------------
3421 * Create Operator Class Statement
3422 * ----------------------
3423 */
3424typedef struct CreateOpClassStmt
3425{
3427 List *opclassname; /* qualified name (list of String) */
3428 List *opfamilyname; /* qualified name (ditto); NIL if omitted */
3429 char *amname; /* name of index AM opclass is for */
3430 TypeName *datatype; /* datatype of indexed column */
3431 List *items; /* List of CreateOpClassItem nodes */
3432 bool isDefault; /* Should be marked as default for type? */
3434
3435#define OPCLASS_ITEM_OPERATOR 1
3436#define OPCLASS_ITEM_FUNCTION 2
3437#define OPCLASS_ITEM_STORAGETYPE 3
3438
3439typedef struct CreateOpClassItem
3440{
3442 int itemtype; /* see codes above */
3443 ObjectWithArgs *name; /* operator or function name and args */
3444 int number; /* strategy num or support proc num */
3445 List *order_family; /* only used for ordering operators */
3446 List *class_args; /* amproclefttype/amprocrighttype or
3447 * amoplefttype/amoprighttype */
3448 /* fields used for a storagetype item: */
3449 TypeName *storedtype; /* datatype stored in index */
3451
3452/* ----------------------
3453 * Create Operator Family Statement
3454 * ----------------------
3455 */
3457{
3459 List *opfamilyname; /* qualified name (list of String) */
3460 char *amname; /* name of index AM opfamily is for */
3462
3463/* ----------------------
3464 * Alter Operator Family Statement
3465 * ----------------------
3466 */
3467typedef struct AlterOpFamilyStmt
3468{
3470 List *opfamilyname; /* qualified name (list of String) */
3471 char *amname; /* name of index AM opfamily is for */
3472 bool isDrop; /* ADD or DROP the items? */
3473 List *items; /* List of CreateOpClassItem nodes */
3475
3476/* ----------------------
3477 * Drop Table|Sequence|View|Index|Type|Domain|Conversion|Schema Statement
3478 * ----------------------
3479 */
3480
3481typedef struct DropStmt
3482{
3484 List *objects; /* list of names */
3485 ObjectType removeType; /* object type */
3486 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3487 bool missing_ok; /* skip error if object is missing? */
3488 bool concurrent; /* drop index concurrently? */
3490
3491/* ----------------------
3492 * Truncate Table Statement
3493 * ----------------------
3494 */
3495typedef struct TruncateStmt
3496{
3498 List *relations; /* relations (RangeVars) to be truncated */
3499 bool restart_seqs; /* restart owned sequences? */
3500 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3502
3503/* ----------------------
3504 * Comment On Statement
3505 * ----------------------
3506 */
3507typedef struct CommentStmt
3508{
3510 ObjectType objtype; /* Object's type */
3511 Node *object; /* Qualified name of the object */
3512 char *comment; /* Comment to insert, or NULL to remove */
3514
3515/* ----------------------
3516 * SECURITY LABEL Statement
3517 * ----------------------
3518 */
3519typedef struct SecLabelStmt
3520{
3522 ObjectType objtype; /* Object's type */
3523 Node *object; /* Qualified name of the object */
3524 char *provider; /* Label provider (or NULL) */
3525 char *label; /* New security label to be assigned */
3527
3528/* ----------------------
3529 * Declare Cursor Statement
3530 *
3531 * The "query" field is initially a raw parse tree, and is converted to a
3532 * Query node during parse analysis. Note that rewriting and planning
3533 * of the query are always postponed until execution.
3534 * ----------------------
3535 */
3536#define CURSOR_OPT_BINARY 0x0001 /* BINARY */
3537#define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */
3538#define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */
3539#define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */
3540#define CURSOR_OPT_ASENSITIVE 0x0010 /* ASENSITIVE */
3541#define CURSOR_OPT_HOLD 0x0020 /* WITH HOLD */
3542/* these planner-control flags do not correspond to any SQL grammar: */
3543#define CURSOR_OPT_FAST_PLAN 0x0100 /* prefer fast-start plan */
3544#define CURSOR_OPT_GENERIC_PLAN 0x0200 /* force use of generic plan */
3545#define CURSOR_OPT_CUSTOM_PLAN 0x0400 /* force use of custom plan */
3546#define CURSOR_OPT_PARALLEL_OK 0x0800 /* parallel mode OK */
3547
3548typedef struct DeclareCursorStmt
3549{
3551 char *portalname; /* name of the portal (cursor) */
3552 int options; /* bitmask of options (see above) */
3553 Node *query; /* the query (see comments above) */
3555
3556/* ----------------------
3557 * Close Portal Statement
3558 * ----------------------
3559 */
3560typedef struct ClosePortalStmt
3561{
3563 char *portalname; /* name of the portal (cursor) */
3564 /* NULL means CLOSE ALL */
3566
3567/* ----------------------
3568 * Fetch Statement (also Move)
3569 * ----------------------
3570 */
3571typedef enum FetchDirection
3572{
3573 /* for these, howMany is how many rows to fetch; FETCH_ALL means ALL */
3576 /* for these, howMany indicates a position; only one row is fetched */
3580
3596
3597#define FETCH_ALL LONG_MAX
3598
3599typedef struct FetchStmt
3600{
3602 FetchDirection direction; /* see above */
3603 /* number of rows, or position argument */
3605 /* name of portal (cursor) */
3607 /* true if MOVE */
3609
3610 /*
3611 * Set when a direction_keyword (e.g., FETCH FORWARD) is used, to
3612 * distinguish it from a numeric variant (e.g., FETCH 1) for the purpose
3613 * of query jumbling.
3614 */
3616
3617 /* token location, or -1 if unknown */
3620
3621/* ----------------------
3622 * Create Index Statement
3623 *
3624 * This represents creation of an index and/or an associated constraint.
3625 * If isconstraint is true, we should create a pg_constraint entry along
3626 * with the index. But if indexOid isn't InvalidOid, we are not creating an
3627 * index, just a UNIQUE/PKEY constraint using an existing index. isconstraint
3628 * must always be true in this case, and the fields describing the index
3629 * properties are empty.
3630 * ----------------------
3631 */
3632typedef struct IndexStmt
3633{
3635 char *idxname; /* name of new index, or NULL for default */
3636 RangeVar *relation; /* relation to build index on */
3637 char *accessMethod; /* name of access method (eg. btree) */
3638 char *tableSpace; /* tablespace, or NULL for default */
3639 List *indexParams; /* columns to index: a list of IndexElem */
3640 List *indexIncludingParams; /* additional columns to index: a list
3641 * of IndexElem */
3642 List *options; /* WITH clause options: a list of DefElem */
3643 Node *whereClause; /* qualification (partial-index predicate) */
3644 List *excludeOpNames; /* exclusion operator names, or NIL if none */
3645 char *idxcomment; /* comment to apply to index, or NULL */
3646 Oid indexOid; /* OID of an existing index, if any */
3647 RelFileNumber oldNumber; /* relfilenumber of existing storage, if any */
3648 SubTransactionId oldCreateSubid; /* rd_createSubid of oldNumber */
3649 SubTransactionId oldFirstRelfilelocatorSubid; /* rd_firstRelfilelocatorSubid
3650 * of oldNumber */
3651 bool unique; /* is index unique? */
3652 bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
3653 bool primary; /* is index a primary key? */
3654 bool isconstraint; /* is it for a pkey/unique constraint? */
3655 bool iswithoutoverlaps; /* is the constraint WITHOUT OVERLAPS? */
3656 bool deferrable; /* is the constraint DEFERRABLE? */
3657 bool initdeferred; /* is the constraint INITIALLY DEFERRED? */
3658 bool transformed; /* true when transformIndexStmt is finished */
3659 bool concurrent; /* should this be a concurrent index build? */
3660 bool if_not_exists; /* just do nothing if index already exists? */
3661 bool reset_default_tblspc; /* reset default_tablespace prior to
3662 * executing */
3664
3665/* ----------------------
3666 * Create Statistics Statement
3667 * ----------------------
3668 */
3669typedef struct CreateStatsStmt
3670{
3672 List *defnames; /* qualified name (list of String) */
3673 List *stat_types; /* stat types (list of String) */
3674 List *exprs; /* expressions to build statistics on */
3675 List *relations; /* rels to build stats on (list of RangeVar) */
3676 char *stxcomment; /* comment to apply to stats, or NULL */
3677 bool transformed; /* true when transformStatsStmt is finished */
3678 bool if_not_exists; /* do nothing if stats name already exists */
3680
3681/*
3682 * StatsElem - statistics parameters (used in CREATE STATISTICS)
3683 *
3684 * For a plain attribute, 'name' is the name of the referenced table column
3685 * and 'expr' is NULL. For an expression, 'name' is NULL and 'expr' is the
3686 * expression tree.
3687 */
3688typedef struct StatsElem
3689{
3691 char *name; /* name of attribute to index, or NULL */
3692 Node *expr; /* expression to index, or NULL */
3694
3695
3696/* ----------------------
3697 * Alter Statistics Statement
3698 * ----------------------
3699 */
3700typedef struct AlterStatsStmt
3701{
3703 List *defnames; /* qualified name (list of String) */
3704 Node *stxstattarget; /* statistics target */
3705 bool missing_ok; /* skip error if statistics object is missing */
3707
3708/* ----------------------
3709 * Create Function Statement
3710 * ----------------------
3711 */
3713{
3715 bool is_procedure; /* it's really CREATE PROCEDURE */
3716 bool replace; /* T => replace if already exists */
3717 List *funcname; /* qualified name of function to create */
3718 List *parameters; /* a list of FunctionParameter */
3719 TypeName *returnType; /* the return type */
3720 List *options; /* a list of DefElem */
3723
3725{
3726 /* the assigned enum values appear in pg_proc, don't change 'em! */
3727 FUNC_PARAM_IN = 'i', /* input only */
3728 FUNC_PARAM_OUT = 'o', /* output only */
3729 FUNC_PARAM_INOUT = 'b', /* both */
3730 FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */
3731 FUNC_PARAM_TABLE = 't', /* table function output column */
3732 /* this is not used in pg_proc: */
3733 FUNC_PARAM_DEFAULT = 'd', /* default; effectively same as IN */
3735
3736typedef struct FunctionParameter
3737{
3739 char *name; /* parameter name, or NULL if not given */
3740 TypeName *argType; /* TypeName for parameter type */
3741 FunctionParameterMode mode; /* IN/OUT/etc */
3742 Node *defexpr; /* raw default expr, or NULL if not given */
3743 ParseLoc location; /* token location, or -1 if unknown */
3745
3746typedef struct AlterFunctionStmt
3747{
3750 ObjectWithArgs *func; /* name and args of function */
3751 List *actions; /* list of DefElem */
3753
3754/* ----------------------
3755 * DO Statement
3756 *
3757 * DoStmt is the raw parser output, InlineCodeBlock is the execution-time API
3758 * ----------------------
3759 */
3760typedef struct DoStmt
3761{
3763 List *args; /* List of DefElem nodes */
3765
3766typedef struct InlineCodeBlock
3767{
3768 pg_node_attr(nodetag_only) /* this is not a member of parse trees */
3769
3770 NodeTag type;
3771 char *source_text; /* source text of anonymous code block */
3772 Oid langOid; /* OID of selected language */
3773 bool langIsTrusted; /* trusted property of the language */
3774 bool atomic; /* atomic execution context */
3776
3777/* ----------------------
3778 * CALL statement
3779 *
3780 * OUT-mode arguments are removed from the transformed funcexpr. The outargs
3781 * list contains copies of the expressions for all output arguments, in the
3782 * order of the procedure's declared arguments. (outargs is never evaluated,
3783 * but is useful to the caller as a reference for what to assign to.)
3784 * ----------------------
3785 */
3786typedef struct CallStmt
3787{
3789 /* from the parser */
3791 /* transformed call, with only input args */
3793 /* transformed output-argument expressions */
3796
3797typedef struct CallContext
3798{
3799 pg_node_attr(nodetag_only) /* this is not a member of parse trees */
3800
3801 NodeTag type;
3804
3805/* ----------------------
3806 * Alter Object Rename Statement
3807 * ----------------------
3808 */
3809typedef struct RenameStmt
3810{
3812 ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */
3813 ObjectType relationType; /* if column name, associated relation type */
3814 RangeVar *relation; /* in case it's a table */
3815 Node *object; /* in case it's some other object */
3816 char *subname; /* name of contained object (column, rule,
3817 * trigger, etc) */
3818 char *newname; /* the new name */
3819 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
3820 bool missing_ok; /* skip error if missing? */
3822
3823/* ----------------------
3824 * ALTER object DEPENDS ON EXTENSION extname
3825 * ----------------------
3826 */
3828{
3830 ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */
3831 RangeVar *relation; /* in case a table is involved */
3832 Node *object; /* name of the object */
3833 String *extname; /* extension name */
3834 bool remove; /* set true to remove dep rather than add */
3836
3837/* ----------------------
3838 * ALTER object SET SCHEMA Statement
3839 * ----------------------
3840 */
3842{
3844 ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
3845 RangeVar *relation; /* in case it's a table */
3846 Node *object; /* in case it's some other object */
3847 char *newschema; /* the new schema */
3848 bool missing_ok; /* skip error if missing? */
3850
3851/* ----------------------
3852 * Alter Object Owner Statement
3853 * ----------------------
3854 */
3855typedef struct AlterOwnerStmt
3856{
3858 ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
3859 RangeVar *relation; /* in case it's a table */
3860 Node *object; /* in case it's some other object */
3861 RoleSpec *newowner; /* the new owner */
3863
3864/* ----------------------
3865 * Alter Operator Set ( this-n-that )
3866 * ----------------------
3867 */
3868typedef struct AlterOperatorStmt
3869{
3871 ObjectWithArgs *opername; /* operator name and argument types */
3872 List *options; /* List of DefElem nodes */
3874
3875/* ------------------------
3876 * Alter Type Set ( this-n-that )
3877 * ------------------------
3878 */
3879typedef struct AlterTypeStmt
3880{
3882 List *typeName; /* type name (possibly qualified) */
3883 List *options; /* List of DefElem nodes */
3885
3886/* ----------------------
3887 * Create Rule Statement
3888 * ----------------------
3889 */
3890typedef struct RuleStmt
3891{
3893 RangeVar *relation; /* relation the rule is for */
3894 char *rulename; /* name of the rule */
3895 Node *whereClause; /* qualifications */
3896 CmdType event; /* SELECT, INSERT, etc */
3897 bool instead; /* is a 'do instead'? */
3898 List *actions; /* the action statements */
3899 bool replace; /* OR REPLACE */
3901
3902/* ----------------------
3903 * Notify Statement
3904 * ----------------------
3905 */
3906typedef struct NotifyStmt
3907{
3909 char *conditionname; /* condition name to notify */
3910 char *payload; /* the payload string, or NULL if none */
3912
3913/* ----------------------
3914 * Listen Statement
3915 * ----------------------
3916 */
3917typedef struct ListenStmt
3918{
3920 char *conditionname; /* condition name to listen on */
3922
3923/* ----------------------
3924 * Unlisten Statement
3925 * ----------------------
3926 */
3927typedef struct UnlistenStmt
3928{
3930 char *conditionname; /* name to unlisten on, or NULL for all */
3932
3933/* ----------------------
3934 * {Begin|Commit|Rollback} Transaction Statement
3935 * ----------------------
3936 */
3950
3951typedef struct TransactionStmt
3952{
3954 TransactionStmtKind kind; /* see above */
3955 List *options; /* for BEGIN/START commands */
3956 /* for savepoint commands */
3958 /* for two-phase-commit related commands */
3960 bool chain; /* AND CHAIN option */
3961 /* token location, or -1 if unknown */
3964
3965/* ----------------------
3966 * Create Type Statement, composite types
3967 * ----------------------
3968 */
3969typedef struct CompositeTypeStmt
3970{
3972 RangeVar *typevar; /* the composite type to be created */
3973 List *coldeflist; /* list of ColumnDef nodes */
3975
3976/* ----------------------
3977 * Create Type Statement, enum types
3978 * ----------------------
3979 */
3980typedef struct CreateEnumStmt
3981{
3983 List *typeName; /* qualified name (list of String) */
3984 List *vals; /* enum values (list of String) */
3986
3987/* ----------------------
3988 * Create Type Statement, range types
3989 * ----------------------
3990 */
3991typedef struct CreateRangeStmt
3992{
3994 List *typeName; /* qualified name (list of String) */
3995 List *params; /* range parameters (list of DefElem) */
3997
3998/* ----------------------
3999 * Alter Type Statement, enum types
4000 * ----------------------
4001 */
4002typedef struct AlterEnumStmt
4003{
4005 List *typeName; /* qualified name (list of String) */
4006 char *oldVal; /* old enum value's name, if renaming */
4007 char *newVal; /* new enum value's name */
4008 char *newValNeighbor; /* neighboring enum value, if specified */
4009 bool newValIsAfter; /* place new enum value after neighbor? */
4010 bool skipIfNewValExists; /* no error if new already exists? */
4012
4013/* ----------------------
4014 * Create View Statement
4015 * ----------------------
4016 */
4023
4024typedef struct ViewStmt
4025{
4027 RangeVar *view; /* the view to be created */
4028 List *aliases; /* target column names */
4029 Node *query; /* the SELECT query (as a raw parse tree) */
4030 bool replace; /* replace an existing view? */
4031 List *options; /* options from WITH clause */
4032 ViewCheckOption withCheckOption; /* WITH CHECK OPTION */
4034
4035/* ----------------------
4036 * Load Statement
4037 * ----------------------
4038 */
4039typedef struct LoadStmt
4040{
4042 char *filename; /* file to load */
4044
4045/* ----------------------
4046 * Createdb Statement
4047 * ----------------------
4048 */
4049typedef struct CreatedbStmt
4050{
4052 char *dbname; /* name of database to create */
4053 List *options; /* List of DefElem nodes */
4055
4056/* ----------------------
4057 * Alter Database
4058 * ----------------------
4059 */
4060typedef struct AlterDatabaseStmt
4061{
4063 char *dbname; /* name of database to alter */
4064 List *options; /* List of DefElem nodes */
4066
4072
4074{
4076 char *dbname; /* database name */
4077 VariableSetStmt *setstmt; /* SET or RESET subcommand */
4079
4080/* ----------------------
4081 * Dropdb Statement
4082 * ----------------------
4083 */
4084typedef struct DropdbStmt
4085{
4087 char *dbname; /* database to drop */
4088 bool missing_ok; /* skip error if db is missing? */
4089 List *options; /* currently only FORCE is supported */
4091
4092/* ----------------------
4093 * Alter System Statement
4094 * ----------------------
4095 */
4101
4102/* ----------------------
4103 * Vacuum and Analyze Statements
4104 *
4105 * Even though these are nominally two statements, it's convenient to use
4106 * just one node type for both.
4107 * ----------------------
4108 */
4109typedef struct VacuumStmt
4110{
4112 List *options; /* list of DefElem nodes */
4113 List *rels; /* list of VacuumRelation, or NIL for all */
4114 bool is_vacuumcmd; /* true for VACUUM, false otherwise */
4116
4117/*
4118 * Info about a single target table of VACUUM/ANALYZE.
4119 *
4120 * If the OID field is set, it always identifies the table to process.
4121 * Then the relation field can be NULL; if it isn't, it's used only to report
4122 * failure to open/lock the relation.
4123 */
4124typedef struct VacuumRelation
4125{
4127 RangeVar *relation; /* table name to process, or NULL */
4128 Oid oid; /* table's OID; InvalidOid if not looked up */
4129 List *va_cols; /* list of column names, or NIL for all */
4131
4132/* ----------------------
4133 * Repack Statement
4134 * ----------------------
4135 */
4142
4143typedef struct RepackStmt
4144{
4146 RepackCommand command; /* type of command being run */
4147 VacuumRelation *relation; /* relation being repacked */
4148 char *indexname; /* order tuples by this index */
4149 bool usingindex; /* whether USING INDEX is specified */
4150 List *params; /* list of DefElem nodes */
4152
4153/* ----------------------
4154 * Explain Statement
4155 *
4156 * The "query" field is initially a raw parse tree, and is converted to a
4157 * Query node during parse analysis. Note that rewriting and planning
4158 * of the query are always postponed until execution.
4159 * ----------------------
4160 */
4161typedef struct ExplainStmt
4162{
4164 Node *query; /* the query (see comments above) */
4165 List *options; /* list of DefElem nodes */
4167
4168/* ----------------------
4169 * CREATE TABLE AS Statement (a/k/a SELECT INTO)
4170 *
4171 * A query written as CREATE TABLE AS will produce this node type natively.
4172 * A query written as SELECT ... INTO will be transformed to this form during
4173 * parse analysis.
4174 * A query written as CREATE MATERIALIZED view will produce this node type,
4175 * during parse analysis, since it needs all the same data.
4176 *
4177 * The "query" field is handled similarly to EXPLAIN, though note that it
4178 * can be a SELECT or an EXECUTE, but not other DML statements.
4179 * ----------------------
4180 */
4181typedef struct CreateTableAsStmt
4182{
4184 Node *query; /* the query (see comments above) */
4185 IntoClause *into; /* destination table */
4186 ObjectType objtype; /* OBJECT_TABLE or OBJECT_MATVIEW */
4187 bool is_select_into; /* it was written as SELECT INTO */
4188 bool if_not_exists; /* just do nothing if it already exists? */
4190
4191/* ----------------------
4192 * REFRESH MATERIALIZED VIEW Statement
4193 * ----------------------
4194 */
4196{
4198 bool concurrent; /* allow concurrent access? */
4199 bool skipData; /* true for WITH NO DATA */
4200 RangeVar *relation; /* relation to insert into */
4202
4203/* ----------------------
4204 * Checkpoint Statement
4205 * ----------------------
4206 */
4207typedef struct CheckPointStmt
4208{
4210 List *options; /* list of DefElem nodes */
4212
4213/* ----------------------
4214 * Discard Statement
4215 * ----------------------
4216 */
4217
4225
4231
4232/* ----------------------
4233 * LOCK Statement
4234 * ----------------------
4235 */
4236typedef struct LockStmt
4237{
4239 List *relations; /* relations to lock */
4240 int mode; /* lock mode */
4241 bool nowait; /* no wait mode */
4243
4244/* ----------------------
4245 * SET CONSTRAINTS Statement
4246 * ----------------------
4247 */
4249{
4251 List *constraints; /* List of names as RangeVars */
4254
4255/* ----------------------
4256 * REINDEX Statement
4257 * ----------------------
4258 */
4260{
4262 REINDEX_OBJECT_TABLE, /* table or materialized view */
4264 REINDEX_OBJECT_SYSTEM, /* system catalogs */
4267
4268typedef struct ReindexStmt
4269{
4271 ReindexObjectType kind; /* REINDEX_OBJECT_INDEX, REINDEX_OBJECT_TABLE,
4272 * etc. */
4273 RangeVar *relation; /* Table or index to reindex */
4274 const char *name; /* name of database to reindex */
4275 List *params; /* list of DefElem nodes */
4277
4278/* ----------------------
4279 * CREATE CONVERSION Statement
4280 * ----------------------
4281 */
4283{
4285 List *conversion_name; /* Name of the conversion */
4286 char *for_encoding_name; /* source encoding name */
4287 char *to_encoding_name; /* destination encoding name */
4288 List *func_name; /* qualified conversion function name */
4289 bool def; /* is this a default conversion? */
4291
4292/* ----------------------
4293 * CREATE CAST Statement
4294 * ----------------------
4295 */
4305
4306/* ----------------------
4307 * CREATE PROPERTY GRAPH Statement
4308 * ----------------------
4309 */
4317
4326
4341
4349
4357
4358/* ----------------------
4359 * ALTER PROPERTY GRAPH Statement
4360 * ----------------------
4361 */
4362
4368
4387
4388/* ----------------------
4389 * CREATE TRANSFORM Statement
4390 * ----------------------
4391 */
4401
4402/* ----------------------
4403 * PREPARE Statement
4404 * ----------------------
4405 */
4406typedef struct PrepareStmt
4407{
4409 char *name; /* Name of plan, arbitrary */
4410 List *argtypes; /* Types of parameters (List of TypeName) */
4411 Node *query; /* The query itself (as a raw parsetree) */
4413
4414
4415/* ----------------------
4416 * EXECUTE Statement
4417 * ----------------------
4418 */
4419
4420typedef struct ExecuteStmt
4421{
4423 char *name; /* The name of the plan to execute */
4424 List *params; /* Values to assign to parameters */
4426
4427
4428/* ----------------------
4429 * DEALLOCATE Statement
4430 * ----------------------
4431 */
4432typedef struct DeallocateStmt
4433{
4435 /* The name of the plan to remove, NULL if DEALLOCATE ALL */
4437
4438 /*
4439 * True if DEALLOCATE ALL. This is redundant with "name == NULL", but we
4440 * make it a separate field so that exactly this condition (and not the
4441 * precise name) will be accounted for in query jumbling.
4442 */
4443 bool isall;
4444 /* token location, or -1 if unknown */
4447
4448/*
4449 * DROP OWNED statement
4450 */
4457
4458/*
4459 * REASSIGN OWNED statement
4460 */
4467
4468/*
4469 * TS Dictionary stmts: DefineStmt, RenameStmt and DropStmt are default
4470 */
4472{
4474 List *dictname; /* qualified name (list of String) */
4475 List *options; /* List of DefElem nodes */
4477
4478/*
4479 * TS Configuration stmts: DefineStmt, RenameStmt and DropStmt are default
4480 */
4489
4491{
4493 AlterTSConfigType kind; /* ALTER_TSCONFIG_ADD_MAPPING, etc */
4494 List *cfgname; /* qualified name (list of String) */
4495
4496 /*
4497 * dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is
4498 * NIL, but tokentype isn't, DROP MAPPING was specified.
4499 */
4500 List *tokentype; /* list of String */
4501 List *dicts; /* list of list of String */
4502 bool override; /* if true - remove old variant */
4503 bool replace; /* if true - replace dictionary by another */
4504 bool missing_ok; /* for DROP - skip error if missing? */
4506
4507typedef struct PublicationTable
4508{
4510 RangeVar *relation; /* publication relation */
4511 Node *whereClause; /* qualifications */
4512 List *columns; /* List of columns in a publication table */
4513 bool except; /* True if listed in the EXCEPT clause */
4515
4516/*
4517 * Publication object type
4518 */
4520{
4522 PUBLICATIONOBJ_EXCEPT_TABLE, /* A table in the EXCEPT clause */
4523 PUBLICATIONOBJ_TABLES_IN_SCHEMA, /* All tables in schema */
4524 PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA, /* All tables in first element of
4525 * search_path */
4526 PUBLICATIONOBJ_CONTINUATION, /* Continuation of previous type */
4528
4530{
4532 PublicationObjSpecType pubobjtype; /* type of this publication object */
4533 char *name;
4535 ParseLoc location; /* token location, or -1 if unknown */
4537
4538/*
4539 * Types of objects supported by FOR ALL publications
4540 */
4546
4548{
4550 PublicationAllObjType pubobjtype; /* type of this publication object */
4551 List *except_tables; /* tables specified in the EXCEPT clause */
4552 ParseLoc location; /* token location, or -1 if unknown */
4554
4556{
4558 char *pubname; /* Name of the publication */
4559 List *options; /* List of DefElem nodes */
4560 List *pubobjects; /* Optional list of publication objects */
4561 bool for_all_tables; /* Special publication for all tables in db */
4562 bool for_all_sequences; /* Special publication for all sequences
4563 * in db */
4565
4567{
4568 AP_AddObjects, /* add objects to publication */
4569 AP_DropObjects, /* remove objects from publication */
4570 AP_SetObjects, /* set list of objects */
4572
4574{
4576 char *pubname; /* Name of the publication */
4577
4578 /* parameters used for ALTER PUBLICATION ... WITH */
4579 List *options; /* List of DefElem nodes */
4580
4581 /*
4582 * Parameters used for ALTER PUBLICATION ... ADD/DROP/SET publication
4583 * objects.
4584 */
4585 List *pubobjects; /* Optional list of publication objects */
4586 AlterPublicationAction action; /* What action to perform with the given
4587 * objects */
4588 bool for_all_tables; /* True if ALL TABLES is specified */
4589 bool for_all_sequences; /* True if ALL SEQUENCES is specified */
4591
4593{
4595 char *subname; /* Name of the subscription */
4596 char *servername; /* Server name of publisher */
4597 char *conninfo; /* Connection string to publisher */
4598 List *publication; /* One or more publication to subscribe to */
4599 List *options; /* List of DefElem nodes */
4601
4615
4617{
4619 AlterSubscriptionType kind; /* ALTER_SUBSCRIPTION_OPTIONS, etc */
4620 char *subname; /* Name of the subscription */
4621 char *servername; /* Server name of publisher */
4622 char *conninfo; /* Connection string to publisher */
4623 List *publication; /* One or more publication to subscribe to */
4624 List *options; /* List of DefElem nodes */
4626
4628{
4630 char *subname; /* Name of the subscription */
4631 bool missing_ok; /* Skip error if missing? */
4632 DropBehavior behavior; /* RESTRICT or CASCADE behavior */
4634
4635typedef struct WaitStmt
4636{
4638 char *lsn_literal; /* LSN string from grammar */
4639 List *options; /* List of DefElem nodes */
4641
4642
4643#endif /* PARSENODES_H */
#define PG_INT32_MAX
Definition c.h:732
uint32 SubTransactionId
Definition c.h:799
int64_t int64
Definition c.h:680
int16_t int16
Definition c.h:678
int32_t int32
Definition c.h:679
uint64_t uint64
Definition c.h:684
uint32_t uint32
Definition c.h:683
unsigned int Index
Definition c.h:757
LockWaitPolicy
Definition lockoptions.h:38
LockClauseStrength
Definition lockoptions.h:22
OnConflictAction
Definition nodes.h:425
double Cardinality
Definition nodes.h:260
CmdType
Definition nodes.h:271
NodeTag
Definition nodes.h:27
LimitOption
Definition nodes.h:439
int ParseLoc
Definition nodes.h:248
JoinType
Definition nodes.h:296
RoleSpecType
Definition parsenodes.h:423
@ ROLESPEC_CURRENT_USER
Definition parsenodes.h:426
@ ROLESPEC_CSTRING
Definition parsenodes.h:424
@ ROLESPEC_SESSION_USER
Definition parsenodes.h:427
@ ROLESPEC_CURRENT_ROLE
Definition parsenodes.h:425
@ ROLESPEC_PUBLIC
Definition parsenodes.h:428
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:334
@ AEXPR_BETWEEN
Definition parsenodes.h:345
@ AEXPR_NULLIF
Definition parsenodes.h:340
@ AEXPR_NOT_DISTINCT
Definition parsenodes.h:339
@ AEXPR_BETWEEN_SYM
Definition parsenodes.h:347
@ AEXPR_NOT_BETWEEN_SYM
Definition parsenodes.h:348
@ AEXPR_ILIKE
Definition parsenodes.h:343
@ AEXPR_IN
Definition parsenodes.h:341
@ AEXPR_NOT_BETWEEN
Definition parsenodes.h:346
@ AEXPR_DISTINCT
Definition parsenodes.h:338
@ AEXPR_SIMILAR
Definition parsenodes.h:344
@ AEXPR_LIKE
Definition parsenodes.h:342
@ AEXPR_OP
Definition parsenodes.h:335
@ AEXPR_OP_ANY
Definition parsenodes.h:336
@ AEXPR_OP_ALL
Definition parsenodes.h:337
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:919
@ PARTITION_STRATEGY_HASH
Definition parsenodes.h:922
@ PARTITION_STRATEGY_LIST
Definition parsenodes.h:920
@ PARTITION_STRATEGY_RANGE
Definition parsenodes.h:921
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:852
@ DEFELEM_UNSPEC
Definition parsenodes.h:853
@ DEFELEM_DROP
Definition parsenodes.h:856
@ DEFELEM_SET
Definition parsenodes.h:854
@ DEFELEM_ADD
Definition parsenodes.h:855
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:971
@ PARTITION_RANGE_DATUM_MAXVALUE
Definition parsenodes.h:974
@ PARTITION_RANGE_DATUM_VALUE
Definition parsenodes.h:973
@ PARTITION_RANGE_DATUM_MINVALUE
Definition parsenodes.h:972
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
JsonTablePlanType
@ JSTP_JOINED
@ JSTP_DEFAULT
@ JSTP_SIMPLE
ReturningOptionKind
@ RETURNING_OPTION_NEW
@ RETURNING_OPTION_OLD
JsonTablePlanJoinType
@ JSTP_JOIN_CROSS
@ JSTP_JOIN_INNER
@ JSTP_JOIN_OUTER
@ JSTP_JOIN_UNION
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:806
@ CREATE_TABLE_LIKE_COMMENTS
Definition parsenodes.h:807
@ CREATE_TABLE_LIKE_GENERATED
Definition parsenodes.h:811
@ CREATE_TABLE_LIKE_IDENTITY
Definition parsenodes.h:812
@ CREATE_TABLE_LIKE_COMPRESSION
Definition parsenodes.h:808
@ CREATE_TABLE_LIKE_STORAGE
Definition parsenodes.h:815
@ CREATE_TABLE_LIKE_ALL
Definition parsenodes.h:816
@ CREATE_TABLE_LIKE_INDEXES
Definition parsenodes.h:813
@ CREATE_TABLE_LIKE_DEFAULTS
Definition parsenodes.h:810
@ CREATE_TABLE_LIKE_STATISTICS
Definition parsenodes.h:814
@ CREATE_TABLE_LIKE_CONSTRAINTS
Definition parsenodes.h:809
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:1599
JsonWrapper
Definition primnodes.h:1770
OnCommitAction
Definition primnodes.h:58
JsonExprOp
Definition primnodes.h:1822
CoercionForm
Definition primnodes.h:756
OverridingKind
Definition primnodes.h:28
MergeMatchKind
Definition primnodes.h:2018
CoercionContext
Definition primnodes.h:736
Oid RelFileNumber
Definition relpath.h:25
NodeTag type
Definition parsenodes.h:522
List * elements
Definition parsenodes.h:523
ParseLoc list_start
Definition parsenodes.h:524
ParseLoc list_end
Definition parsenodes.h:525
ParseLoc location
Definition parsenodes.h:526
bool isnull
Definition parsenodes.h:393
union ValUnion val
Definition parsenodes.h:392
ParseLoc location
Definition parsenodes.h:394
pg_node_attr(custom_copy_equal, custom_read_write, custom_query_jumble) NodeTag type
ParseLoc location
Definition parsenodes.h:368
ParseLoc rexpr_list_end
Definition parsenodes.h:367
Node * lexpr
Definition parsenodes.h:358
ParseLoc rexpr_list_start
Definition parsenodes.h:366
pg_node_attr(custom_read_write) NodeTag type
List * name
Definition parsenodes.h:357
A_Expr_Kind kind
Definition parsenodes.h:356
Node * rexpr
Definition parsenodes.h:359
bool is_slice
Definition parsenodes.h:490
Node * uidx
Definition parsenodes.h:492
NodeTag type
Definition parsenodes.h:489
Node * lidx
Definition parsenodes.h:491
List * indirection
Definition parsenodes.h:514
NodeTag type
Definition parsenodes.h:478
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:415
ParseLoc location
Definition parsenodes.h:416
bool is_not_null
Definition parsenodes.h:777
CollateClause * collClause
Definition parsenodes.h:787
char identity
Definition parsenodes.h:783
RangeVar * identitySequence
Definition parsenodes.h:784
List * constraints
Definition parsenodes.h:789
Node * cooked_default
Definition parsenodes.h:782
char * storage_name
Definition parsenodes.h:780
char * colname
Definition parsenodes.h:772
TypeName * typeName
Definition parsenodes.h:773
char generated
Definition parsenodes.h:786
NodeTag type
Definition parsenodes.h:771
bool is_from_type
Definition parsenodes.h:778
List * fdwoptions
Definition parsenodes.h:790
Node * raw_default
Definition parsenodes.h:781
char storage
Definition parsenodes.h:779
bool is_local
Definition parsenodes.h:776
int16 inhcount
Definition parsenodes.h:775
char * compression
Definition parsenodes.h:774
ParseLoc location
Definition parsenodes.h:791
ParseLoc location
Definition parsenodes.h:317
List * fields
Definition parsenodes.h:316
NodeTag type
Definition parsenodes.h:315
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:862
NodeTag type
Definition parsenodes.h:861
DefElemAction defaction
Definition parsenodes.h:866
char * defname
Definition parsenodes.h:863
ParseLoc location
Definition parsenodes.h:867
Node * arg
Definition parsenodes.h:864
List * definition
List * defnames
List * args
NodeTag type
ObjectType kind
bool if_not_exists
ReturningClause * returningClause
WithClause * withClause
Node * whereClause
RangeVar * relation
List * usingClause
ForPortionOfClause * forPortionOf
NodeTag type
NodeTag type
DiscardMode target
NodeTag type
List * args
DropBehavior behavior
bool missing_ok
List * objects
ObjectType removeType
bool concurrent
DropBehavior behavior
NodeTag type
DropBehavior behavior
List * options
char * dbname
bool missing_ok
NodeTag type
List * params
NodeTag type
NodeTag type
List * options
long howMany pg_node_attr(query_jumble_ignore)
ParseLoc location pg_node_attr(query_jumble_location)
FetchDirection direction
char * portalname
FetchDirectionKeywords direction_keyword
NodeTag type
Definition value.h:48
ParseLoc target_location
bool agg_within_group
Definition parsenodes.h:462
CoercionForm funcformat
Definition parsenodes.h:466
Node * agg_filter
Definition parsenodes.h:459
List * agg_order
Definition parsenodes.h:458
List * funcname
Definition parsenodes.h:456
List * args
Definition parsenodes.h:457
bool agg_star
Definition parsenodes.h:463
int ignore_nulls
Definition parsenodes.h:461
bool agg_distinct
Definition parsenodes.h:464
NodeTag type
Definition parsenodes.h:455
ParseLoc location
Definition parsenodes.h:467
bool func_variadic
Definition parsenodes.h:465
struct WindowDef * over
Definition parsenodes.h:460
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:831
SortByDir ordering
Definition parsenodes.h:836
List * opclassopts
Definition parsenodes.h:835
NodeTag type
Definition parsenodes.h:829
char * indexcolname
Definition parsenodes.h:832
ParseLoc location
Definition parsenodes.h:838
SortByNulls nulls_ordering
Definition parsenodes.h:837
List * opclass
Definition parsenodes.h:834
char * name
Definition parsenodes.h:830
List * collation
Definition parsenodes.h:833
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
JsonTablePlanJoinType join_type
JsonTablePlanType plan_type
struct JsonTablePlanSpec * plan2
struct JsonTablePlanSpec * plan1
JsonBehavior * on_error
List * columns
JsonTablePathSpec * pathspec
Alias * alias
NodeTag type
List * passing
JsonTablePlanSpec * planspec
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:882
LockClauseStrength strength
Definition parsenodes.h:883
LockWaitPolicy waitPolicy
Definition parsenodes.h:884
ReturningClause * returningClause
Node * sourceRelation
List * mergeWhenClauses
RangeVar * relation
Node * joinCondition
WithClause * withClause
NodeTag type
CmdType commandType
MergeMatchKind matchKind
Definition nodes.h:133
char * payload
char * conditionname
NodeTag type
InferClause * infer
OnConflictAction action
LockClauseStrength lockStrength
SelectStmt * val
ParseLoc location
List * indirection
ParseLoc location
Definition parsenodes.h:327
NodeTag type
Definition parsenodes.h:325
PartitionBoundSpec * bound
List * partlist
RangeVar * name
List * collation
Definition parsenodes.h:913
ParseLoc location
Definition parsenodes.h:915
PartitionRangeDatumKind kind
Definition parsenodes.h:981
List * partParams
Definition parsenodes.h:934
ParseLoc location
Definition parsenodes.h:935
PartitionStrategy strategy
Definition parsenodes.h:933
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:239
int mergeTargetRelation pg_node_attr(query_jumble_ignore)
bool hasAggs pg_node_attr(query_jumble_ignore)
bool groupDistinct
Definition parsenodes.h:222
bool hasRecursive pg_node_attr(query_jumble_ignore)
Node * mergeJoinCondition
Definition parsenodes.h:201
Node * limitCount
Definition parsenodes.h:236
FromExpr * jointree
Definition parsenodes.h:187
List * returningList
Definition parsenodes.h:219
bool canSetTag pg_node_attr(query_jumble_ignore)
Node * setOperations
Definition parsenodes.h:241
bool hasSubLinks pg_node_attr(query_jumble_ignore)
List * cteList
Definition parsenodes.h:178
OnConflictExpr * onConflict
Definition parsenodes.h:208
char *returningOldAlias pg_node_attr(query_jumble_ignore)
OverridingKind override pg_node_attr(query_jumble_ignore)
ForPortionOfExpr * forPortionOf
Definition parsenodes.h:153
List * groupClause
Definition parsenodes.h:221
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:227
List * rtable
Definition parsenodes.h:180
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:235
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:124
LimitOption limitOption
Definition parsenodes.h:237
Node * utilityStmt
Definition parsenodes.h:144
List * mergeActionList
Definition parsenodes.h:190
bool hasModifyingCTE pg_node_attr(query_jumble_ignore)
NodeTag type
Definition parsenodes.h:122
List * windowClause
Definition parsenodes.h:229
List * targetList
Definition parsenodes.h:203
List * groupingSets
Definition parsenodes.h:225
bool groupByAll
Definition parsenodes.h:223
List * distinctClause
Definition parsenodes.h:231
bool hasForUpdate pg_node_attr(query_jumble_ignore)
List * sortClause
Definition parsenodes.h:233
char *returningNewAlias pg_node_attr(query_jumble_ignore)
ParseLoc stmt_location
Definition parsenodes.h:260
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:677
List * coldeflist
Definition parsenodes.h:678
List * functions
Definition parsenodes.h:676
struct GraphPattern * graph_pattern
Definition parsenodes.h:725
ParseLoc location
Definition parsenodes.h:728
RangeVar * graph_name
Definition parsenodes.h:724
TypeName * typeName
Definition parsenodes.h:710
List * namespaces
Definition parsenodes.h:694
ParseLoc location
Definition parsenodes.h:697
ParseLoc location
Definition parsenodes.h:748
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:552
ParseLoc location
Definition parsenodes.h:553
List * indirection
Definition parsenodes.h:551
char * name
Definition parsenodes.h:550
NodeTag type
Definition parsenodes.h:549
NodeTag type
Node * returnval
ReturningOptionKind option
ParseLoc location
ParseLoc location
Definition parsenodes.h:436
RoleSpecType roletype
Definition parsenodes.h:434
NodeTag type
Definition parsenodes.h:433
char * rolename
Definition parsenodes.h:435
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:997
SortByNulls sortby_nulls
Definition parsenodes.h:581
Node * node
Definition parsenodes.h:579
NodeTag type
Definition parsenodes.h:578
List * useOp
Definition parsenodes.h:582
SortByDir sortby_dir
Definition parsenodes.h:580
ParseLoc location
Definition parsenodes.h:583
bool hashable pg_node_attr(query_jumble_ignore)
NodeTag type
char * name
Node * expr
Definition value.h:64
RangeVar * relation
Definition parsenodes.h:800
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:404
ParseLoc location
Definition parsenodes.h:405
Node * arg
Definition parsenodes.h:403
NodeTag type
Definition parsenodes.h:402
bool setof
Definition parsenodes.h:292
Oid typeOid
Definition parsenodes.h:291
bool pct_type
Definition parsenodes.h:293
List * names
Definition parsenodes.h:290
NodeTag type
Definition parsenodes.h:289
List * arrayBounds
Definition parsenodes.h:296
int32 typemod
Definition parsenodes.h:295
ParseLoc location
Definition parsenodes.h:297
List * typmods
Definition parsenodes.h:294
char * conditionname
List * targetList
ForPortionOfClause * forPortionOf
List * fromClause
NodeTag type
Node * whereClause
ReturningClause * returningClause
RangeVar * relation
WithClause * withClause
RangeVar * relation
NodeTag type
List * options
bool is_vacuumcmd
List * rels
ParseLoc location pg_node_attr(query_jumble_location)
VariableSetKind kind
pg_node_attr(custom_query_jumble) NodeTag type
bool replace
List * options
Node * query
List * aliases
RangeVar * view
NodeTag type
ViewCheckOption withCheckOption
NodeTag type
List * options
char * lsn_literal
bool inRangeNullsFirst pg_node_attr(query_jumble_ignore)
bool inRangeAsc pg_node_attr(query_jumble_ignore)
Node * startOffset
Oid inRangeColl pg_node_attr(query_jumble_ignore)
List * partitionClause
bool copiedOrder pg_node_attr(query_jumble_ignore)
char *refname pg_node_attr(query_jumble_ignore)
Oid startInRangeFunc pg_node_attr(query_jumble_ignore)
Oid endInRangeFunc pg_node_attr(query_jumble_ignore)
char *name pg_node_attr(query_jumble_ignore)
Node * endOffset
List * orderClause
List * orderClause
Definition parsenodes.h:600
ParseLoc location
Definition parsenodes.h:604
NodeTag type
Definition parsenodes.h:596
List * partitionClause
Definition parsenodes.h:599
Node * startOffset
Definition parsenodes.h:602
char * refname
Definition parsenodes.h:598
Node * endOffset
Definition parsenodes.h:603
int frameOptions
Definition parsenodes.h:601
char * name
Definition parsenodes.h:597
List * ctes
NodeTag type
ParseLoc location
ParseLoc location
Definition parsenodes.h:897
TypeName * typeName
Definition parsenodes.h:895
NodeTag type
Definition parsenodes.h:892
XmlOptionType xmloption
Definition parsenodes.h:893
BitString bsval
Definition parsenodes.h:384
Node node
Definition parsenodes.h:379
Float fval
Definition parsenodes.h:381
String sval
Definition parsenodes.h:383
Boolean boolval
Definition parsenodes.h:382
Integer ival
Definition parsenodes.h:380
const char * type
const char * name