13
13
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
14
14
* Portions Copyright (c) 1994, Regents of the University of California
16
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.393 2009/04/04 21:12:31 tgl Exp $
16
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.395 2009/06/18 01:27:02 tgl Exp $
18
18
*-------------------------------------------------------------------------
67
67
#define ACL_REFERENCES (1<<5)
68
68
#define ACL_TRIGGER (1<<6)
69
69
#define ACL_EXECUTE (1<<7) /* for functions */
70
#define ACL_USAGE (1<<8) /* for languages, namespaces, FDWs, and servers */
70
#define ACL_USAGE (1<<8) /* for languages, namespaces, FDWs, and
71
72
#define ACL_CREATE (1<<9) /* for namespaces and databases */
72
73
#define ACL_CREATE_TEMP (1<<10) /* for databases */
73
74
#define ACL_CONNECT (1<<11) /* for databases */
113
114
IntoClause *intoClause; /* target for SELECT INTO / CREATE TABLE AS */
115
116
bool hasAggs; /* has aggregates in tlist or havingQual */
116
bool hasWindowFuncs; /* has window functions in tlist */
117
bool hasWindowFuncs; /* has window functions in tlist */
117
118
bool hasSubLinks; /* has subquery SubLink */
118
119
bool hasDistinctOn; /* distinctClause is from DISTINCT ON */
119
120
bool hasRecursive; /* WITH RECURSIVE was specified */
185
186
* ColumnRef - specifies a reference to a column, or possibly a whole tuple
187
* The "fields" list must be nonempty. It can contain string Value nodes
188
* The "fields" list must be nonempty. It can contain string Value nodes
188
189
* (representing names) and A_Star nodes (representing occurrence of a '*').
189
190
* Currently, A_Star must appear only as the last list element --- the grammar
190
191
* is responsible for enforcing this!
384
385
typedef struct WindowDef
387
char *name; /* window's own name */
388
char *refname; /* referenced window name, if any */
388
char *name; /* window's own name */
389
char *refname; /* referenced window name, if any */
389
390
List *partitionClause; /* PARTITION BY expression list */
390
List *orderClause; /* ORDER BY (list of SortBy) */
391
int frameOptions; /* frame_clause options, see below */
392
int location; /* parse location, or -1 if none/unknown */
391
List *orderClause; /* ORDER BY (list of SortBy) */
392
int frameOptions; /* frame_clause options, see below */
393
int location; /* parse location, or -1 if none/unknown */
400
401
* the convenience of gram.y, even though some of them are useless/invalid.
401
402
* We will need more bits (and fields) to cover the full SQL:2008 option set.
403
#define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */
404
#define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */
405
#define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */
406
#define FRAMEOPTION_BETWEEN 0x00008 /* BETWEEN given? */
407
#define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00010 /* start is U. P. */
408
#define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00020 /* (disallowed) */
409
#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00040 /* (disallowed) */
410
#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00080 /* end is U. F. */
411
#define FRAMEOPTION_START_CURRENT_ROW 0x00100 /* start is C. R. */
412
#define FRAMEOPTION_END_CURRENT_ROW 0x00200 /* end is C. R. */
404
#define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */
405
#define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */
406
#define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */
407
#define FRAMEOPTION_BETWEEN 0x00008 /* BETWEEN given? */
408
#define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00010 /* start is U. P. */
409
#define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00020 /* (disallowed) */
410
#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00040 /* (disallowed) */
411
#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00080 /* end is U. F. */
412
#define FRAMEOPTION_START_CURRENT_ROW 0x00100 /* start is C. R. */
413
#define FRAMEOPTION_END_CURRENT_ROW 0x00200 /* end is C. R. */
414
415
#define FRAMEOPTION_DEFAULTS \
415
416
(FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \
506
507
* DefElem - a generic "name = value" option definition
508
* In some contexts the name can be qualified. Also, certain SQL commands
509
* In some contexts the name can be qualified. Also, certain SQL commands
509
510
* allow a SET/ADD/DROP action to be attached to option settings, so it's
510
511
* convenient to carry a field for that too. (Note: currently, it is our
511
512
* practice that the grammar allows namespace and action only in statements
700
701
char *ctename; /* name of the WITH list item */
701
702
Index ctelevelsup; /* number of query levels up */
702
bool self_reference; /* is this a recursive self-reference? */
703
bool self_reference; /* is this a recursive self-reference? */
703
704
List *ctecoltypes; /* OID list of column type OIDs */
704
705
List *ctecoltypmods; /* integer list of column typmods */
724
725
* You might think that ORDER BY is only interested in defining ordering,
725
726
* and GROUP/DISTINCT are only interested in defining equality. However,
726
727
* one way to implement grouping is to sort and then apply a "uniq"-like
727
* filter. So it's also interesting to keep track of possible sort operators
728
* filter. So it's also interesting to keep track of possible sort operators
728
729
* for GROUP/DISTINCT, and in particular to try to sort for the grouping
729
730
* in a way that will also yield a requested ORDER BY ordering. So we need
730
731
* to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates
742
743
* here, but it's cheap to get it along with the sortop, and requiring it
743
744
* to be valid eases comparisons to grouping items.)
745
* In a grouping item, eqop must be valid. If the eqop is a btree equality
746
* In a grouping item, eqop must be valid. If the eqop is a btree equality
746
747
* operator, then sortop should be set to a compatible ordering operator.
747
748
* We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that
748
* the query presents for the same tlist item. If there is none, we just
749
* the query presents for the same tlist item. If there is none, we just
749
750
* use the default ordering op for the datatype.
751
752
* If the tlist item's type has a hash opclass but no btree opclass, then
768
769
Index tleSortGroupRef; /* reference into targetlist */
769
Oid eqop; /* the equality operator ('=' op) */
770
Oid sortop; /* the ordering operator ('<' op), or 0 */
771
bool nulls_first; /* do NULLs come before normal values? */
770
Oid eqop; /* the equality operator ('=' op) */
771
Oid sortop; /* the ordering operator ('<' op), or 0 */
772
bool nulls_first; /* do NULLs come before normal values? */
772
773
} SortGroupClause;
788
789
typedef struct WindowClause
791
char *name; /* window name (NULL in an OVER clause) */
792
char *refname; /* referenced window name, if any */
792
char *name; /* window name (NULL in an OVER clause) */
793
char *refname; /* referenced window name, if any */
793
794
List *partitionClause; /* PARTITION BY list */
794
List *orderClause; /* ORDER BY list */
795
int frameOptions; /* frame_clause options, see WindowDef */
796
Index winref; /* ID referenced by window functions */
797
bool copiedOrder; /* did we copy orderClause from refname? */
795
List *orderClause; /* ORDER BY list */
796
int frameOptions; /* frame_clause options, see WindowDef */
797
Index winref; /* ID referenced by window functions */
798
bool copiedOrder; /* did we copy orderClause from refname? */
982
983
* range table. Its setOperations field shows the tree of set operations,
983
984
* with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal
984
985
* nodes replaced by SetOperationStmt nodes. Information about the output
985
* column types is added, too. (Note that the child nodes do not necessarily
986
* column types is added, too. (Note that the child nodes do not necessarily
986
987
* produce these types directly, but we've checked that their output types
987
988
* can be coerced to the output column type.) Also, if it's not UNION ALL,
988
989
* information about the types' sort/group semantics is provided in the form
1242
1243
* Note: because of the parsing ambiguity with the GRANT <privileges>
1243
1244
* statement, granted_roles is a list of AccessPriv; the execution code
1244
* should complain if any column lists appear. grantee_roles is a list
1245
* should complain if any column lists appear. grantee_roles is a list
1245
1246
* of role names, as Value strings.
1246
1247
* ----------------------
1550
1551
List *args; /* list of (T_String) Values or NIL */
1551
1552
bool before; /* BEFORE/AFTER */
1552
1553
bool row; /* ROW/STATEMENT */
1553
char actions[4]; /* 1 to 3 of 'i', 'u', 'd', + trailing \0 */
1554
/* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
1555
int16 events; /* INSERT/UPDATE/DELETE/TRUNCATE */
1555
1557
/* The following are used for referential */
1556
1558
/* integrity constraint triggers */
2177
2179
bool analyze; /* do ANALYZE step */
2178
2180
bool verbose; /* print progress info */
2179
2181
int freeze_min_age; /* min freeze age, or -1 to use default */
2180
int freeze_table_age; /* age at which to scan whole table */
2182
int freeze_table_age; /* age at which to scan whole table */
2181
2183
RangeVar *relation; /* single table to process, or NULL */
2182
2184
List *va_cols; /* list of column names, or NIL for all */