~ubuntu-branches/ubuntu/precise/pgpool2/precise

« back to all changes in this revision

Viewing changes to parser/parsenodes.h

  • Committer: Bazaar Package Importer
  • Author(s): Marc Gariepy
  • Date: 2010-02-17 13:58:08 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100217135808-vqxtfe80r5z8toje
Tags: 2.3.2.1-0ubuntu1
* New upstream release (2.3.2.1)
 * Lots of bug fixes
 * Add SSL support
 * Add support for large object replication
 * Enhanced replication (TIMESTAMP, DATES)
 * Save node status on restart
 * Some other minor changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 * parsenodes.h
4
4
 *        definitions for parse tree nodes
5
5
 *
6
 
 *
7
 
 * Portions Copyright (c) 2003-2008, PgPool Global Development Group
8
 
 * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
 
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.
 
11
 *
 
12
 *
 
13
 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
 
14
 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
9
15
 * Portions Copyright (c) 1994, Regents of the University of California
10
16
 *
11
 
 * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.353 2007/09/03 18:46:30 tgl Exp $
 
17
 * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.393 2009/04/04 21:12:31 tgl Exp $
12
18
 *
13
19
 *-------------------------------------------------------------------------
14
20
 */
15
21
#ifndef PARSENODES_H
16
22
#define PARSENODES_H
17
23
 
 
24
#include "../pool_type.h"
18
25
#include "primnodes.h"
19
26
#include "value.h"
20
27
 
 
28
/* include/nodes/bitmapset.h start */
 
29
typedef uint32 bitmapword;              /* must be an unsigned type */
 
30
 
 
31
typedef struct Bitmapset
 
32
{
 
33
        int                     nwords;                 /* number of words in array */
 
34
        bitmapword      words[1];               /* really [nwords] */
 
35
} Bitmapset;                                    /* VARIABLE LENGTH STRUCT */
 
36
 
 
37
extern Bitmapset *bms_copy(const Bitmapset *a);
 
38
/* include/nodes/bitmapset.h end */
 
39
 
 
40
 
21
41
/* Possible sources of a Query */
22
42
typedef enum QuerySource
23
43
{
44
64
        SORTBY_NULLS_LAST
45
65
} SortByNulls;
46
66
 
47
 
 
48
67
/*
49
68
 * Grantable rights are encoded so that we can OR them together in a bitmask.
50
69
 * The present representation of AclItem limits us to 16 distinct rights,
52
71
 *
53
72
 * Caution: changing these codes breaks stored ACLs, hence forces initdb.
54
73
 */
55
 
typedef unsigned int AclMode;                   /* a bitmask of privilege bits */
 
74
typedef uint32 AclMode;                 /* a bitmask of privilege bits */
56
75
 
57
76
#define ACL_INSERT              (1<<0)  /* for relations */
58
77
#define ACL_SELECT              (1<<1)
59
78
#define ACL_UPDATE              (1<<2)
60
79
#define ACL_DELETE              (1<<3)
61
 
/* #define ACL_RULE             (1<<4)  unused, available */
 
80
#define ACL_TRUNCATE    (1<<4)
62
81
#define ACL_REFERENCES  (1<<5)
63
82
#define ACL_TRIGGER             (1<<6)
64
83
#define ACL_EXECUTE             (1<<7)  /* for functions */
65
 
#define ACL_USAGE               (1<<8)  /* for languages and namespaces */
 
84
#define ACL_USAGE               (1<<8)  /* for languages, namespaces, FDWs, and
 
85
                                                                 * servers */
66
86
#define ACL_CREATE              (1<<9)  /* for namespaces and databases */
67
87
#define ACL_CREATE_TEMP (1<<10) /* for databases */
68
88
#define ACL_CONNECT             (1<<11) /* for databases */
108
128
        IntoClause *intoClause;         /* target for SELECT INTO / CREATE TABLE AS */
109
129
 
110
130
        bool            hasAggs;                /* has aggregates in tlist or havingQual */
 
131
        bool            hasWindowFuncs; /* has window functions in tlist */
111
132
        bool            hasSubLinks;    /* has subquery SubLink */
 
133
        bool            hasDistinctOn;  /* distinctClause is from DISTINCT ON */
 
134
        bool            hasRecursive;   /* WITH RECURSIVE was specified */
 
135
 
 
136
        List       *cteList;            /* WITH list (of CommonTableExpr's) */
112
137
 
113
138
        List       *rtable;                     /* list of range table entries */
114
139
        FromExpr   *jointree;           /* table join tree (FROM and WHERE clauses) */
117
142
 
118
143
        List       *returningList;      /* return-values list (of TargetEntry) */
119
144
 
120
 
        List       *groupClause;        /* a list of GroupClause's */
 
145
        List       *groupClause;        /* a list of SortGroupClause's */
121
146
 
122
147
        Node       *havingQual;         /* qualifications applied to groups */
123
148
 
124
 
        List       *distinctClause; /* a list of SortClause's */
125
 
 
126
 
        List       *sortClause;         /* a list of SortClause's */
 
149
        List       *windowClause;       /* a list of WindowClause's */
 
150
 
 
151
        List       *distinctClause; /* a list of SortGroupClause's */
 
152
 
 
153
        List       *sortClause;         /* a list of SortGroupClause's */
127
154
 
128
155
        Node       *limitOffset;        /* # of result tuples to skip (int8 expr) */
129
156
        Node       *limitCount;         /* # of result tuples to return (int8 expr) */
141
168
 *      Most of these node types appear in raw parsetrees output by the grammar,
142
169
 *      and get transformed to something else by the analyzer.  A few of them
143
170
 *      are used as-is in transformed querytrees.
144
 
 *
145
 
 *      Many of the node types used in raw parsetrees include a "location" field.
146
 
 *      This is a byte (not character) offset in the original source text, to be
147
 
 *      used for positioning an error cursor when there is an analysis-time
148
 
 *      error related to the node.
149
171
 ****************************************************************************/
150
172
 
151
173
/*
166
188
        NodeTag         type;
167
189
        List       *names;                      /* qualified name (list of Value strings) */
168
190
        Oid                     typeid;                 /* type identified by OID */
169
 
        bool            timezone;               /* timezone specified? */
170
191
        bool            setof;                  /* is a set? */
171
192
        bool            pct_type;               /* %TYPE specified? */
172
193
        List       *typmods;            /* type modifier expression(s) */
178
199
/*
179
200
 * ColumnRef - specifies a reference to a column, or possibly a whole tuple
180
201
 *
181
 
 *              The "fields" list must be nonempty; its last component may be "*"
182
 
 *              instead of a regular field name.
 
202
 * The "fields" list must be nonempty.  It can contain string Value nodes
 
203
 * (representing names) and A_Star nodes (representing occurrence of a '*').
 
204
 * Currently, A_Star must appear only as the last list element --- the grammar
 
205
 * is responsible for enforcing this!
183
206
 *
184
207
 * Note: any array subscripting or selection of fields from composite columns
185
208
 * is represented by an A_Indirection node above the ColumnRef.  However,
189
212
typedef struct ColumnRef
190
213
{
191
214
        NodeTag         type;
192
 
        List       *fields;                     /* field names (list of Value strings) */
 
215
        List       *fields;                     /* field names (Value strings) or A_Star */
193
216
        int                     location;               /* token location, or -1 if unknown */
194
217
} ColumnRef;
195
218
 
200
223
{
201
224
        NodeTag         type;
202
225
        int                     number;                 /* the number of the parameter */
 
226
        int                     location;               /* token location, or -1 if unknown */
203
227
} ParamRef;
204
228
 
205
229
/*
230
254
} A_Expr;
231
255
 
232
256
/*
233
 
 * A_Const - a constant expression
 
257
 * A_Const - a literal constant
234
258
 */
235
259
typedef struct A_Const
236
260
{
237
261
        NodeTag         type;
238
 
        Value           val;                    /* the value (with the tag) */
239
 
        TypeName   *typename;           /* typecast, or NULL if none */
 
262
        Value           val;                    /* value (includes type info, see value.h) */
 
263
        int                     location;               /* token location, or -1 if unknown */
240
264
} A_Const;
241
265
 
242
266
/*
243
267
 * TypeCast - a CAST expression
244
 
 *
245
 
 * NOTE: for mostly historical reasons, A_Const parsenodes contain
246
 
 * room for a TypeName; we only generate a separate TypeCast node if the
247
 
 * argument to be casted is not a constant.  In theory either representation
248
 
 * would work, but the combined representation saves a bit of code in many
249
 
 * productions in gram.y.
250
268
 */
251
269
typedef struct TypeCast
252
270
{
253
271
        NodeTag         type;
254
272
        Node       *arg;                        /* the expression being casted */
255
273
        TypeName   *typename;           /* the target type */
 
274
        int                     location;               /* token location, or -1 if unknown */
256
275
} TypeCast;
257
276
 
258
277
/*
261
280
 * agg_star indicates we saw a 'foo(*)' construct, while agg_distinct
262
281
 * indicates we saw 'foo(DISTINCT ...)'.  In either case, the construct
263
282
 * *must* be an aggregate call.  Otherwise, it might be either an
264
 
 * aggregate or some other kind of function.
 
283
 * aggregate or some other kind of function.  However, if OVER is present
 
284
 * it had better be an aggregate or window function.
265
285
 */
266
286
typedef struct FuncCall
267
287
{
270
290
        List       *args;                       /* the arguments (list of exprs) */
271
291
        bool            agg_star;               /* argument was really '*' */
272
292
        bool            agg_distinct;   /* arguments were labeled DISTINCT */
 
293
        bool            func_variadic;  /* last argument was labeled VARIADIC */
 
294
        struct WindowDef *over;         /* OVER clause, if any */
273
295
        int                     location;               /* token location, or -1 if unknown */
274
296
} FuncCall;
275
297
 
276
298
/*
277
 
 * A_Indices - array reference or bounds ([lidx:uidx] or [uidx])
 
299
 * A_Star - '*' representing all columns of a table or compound field
 
300
 *
 
301
 * This can appear within ColumnRef.fields, A_Indirection.indirection, and
 
302
 * ResTarget.indirection lists.
 
303
 */
 
304
typedef struct A_Star
 
305
{
 
306
        NodeTag         type;
 
307
} A_Star;
 
308
 
 
309
/*
 
310
 * A_Indices - array subscript or slice bounds ([lidx:uidx] or [uidx])
278
311
 */
279
312
typedef struct A_Indices
280
313
{
281
314
        NodeTag         type;
282
 
        Node       *lidx;                       /* could be NULL */
 
315
        Node       *lidx;                       /* NULL if it's a single subscript */
283
316
        Node       *uidx;
284
317
} A_Indices;
285
318
 
286
319
/*
287
320
 * A_Indirection - select a field and/or array element from an expression
288
321
 *
289
 
 * The indirection list can contain both A_Indices nodes (representing
290
 
 * subscripting) and string Value nodes (representing field selection
291
 
 * --- the string value is the name of the field to select).  For example,
292
 
 * a complex selection operation like
 
322
 * The indirection list can contain A_Indices nodes (representing
 
323
 * subscripting), string Value nodes (representing field selection --- the
 
324
 * string value is the name of the field to select), and A_Star nodes
 
325
 * (representing selection of all fields of a composite type).
 
326
 * For example, a complex selection operation like
293
327
 *                              (foo).field1[42][7].field2
294
328
 * would be represented with a single A_Indirection node having a 4-element
295
329
 * indirection list.
296
330
 *
297
 
 * Note: as of Postgres 8.0, we don't support arrays of composite values,
298
 
 * so cases in which a field select follows a subscript aren't actually
299
 
 * semantically legal.  However the parser is prepared to handle such.
 
331
 * Currently, A_Star must appear only as the last list element --- the grammar
 
332
 * is responsible for enforcing this!
300
333
 */
301
334
typedef struct A_Indirection
302
335
{
303
336
        NodeTag         type;
304
337
        Node       *arg;                        /* the thing being selected from */
305
 
        List       *indirection;        /* subscripts and/or field names */
 
338
        List       *indirection;        /* subscripts and/or field names and/or * */
306
339
} A_Indirection;
307
340
 
308
341
/*
 
342
 * A_ArrayExpr - an ARRAY[] construct
 
343
 */
 
344
typedef struct A_ArrayExpr
 
345
{
 
346
        NodeTag         type;
 
347
        List       *elements;           /* array element expressions */
 
348
        int                     location;               /* token location, or -1 if unknown */
 
349
} A_ArrayExpr;
 
350
 
 
351
/*
309
352
 * ResTarget -
310
353
 *        result target (used in target list of pre-transformed parse trees)
311
354
 *
327
370
{
328
371
        NodeTag         type;
329
372
        char       *name;                       /* column name or NULL */
330
 
        List       *indirection;        /* subscripts and field names, or NIL */
 
373
        List       *indirection;        /* subscripts, field names, and '*', or NIL */
331
374
        Node       *val;                        /* the value expression to compute or assign */
332
375
        int                     location;               /* token location, or -1 if unknown */
333
376
} ResTarget;
338
381
typedef struct SortBy
339
382
{
340
383
        NodeTag         type;
341
 
        SortByDir       sortby_dir;             /* ASC/DESC/USING */
342
 
        SortByNulls     sortby_nulls;   /* NULLS FIRST/LAST */
 
384
        Node       *node;                       /* expression to sort on */
 
385
        SortByDir       sortby_dir;             /* ASC/DESC/USING/default */
 
386
        SortByNulls sortby_nulls;       /* NULLS FIRST/LAST */
343
387
        List       *useOp;                      /* name of op to use, if SORTBY_USING */
344
 
        Node       *node;                       /* expression to sort on */
 
388
        int                     location;               /* operator location, or -1 if none/unknown */
345
389
} SortBy;
346
390
 
347
391
/*
 
392
 * WindowDef - raw representation of WINDOW and OVER clauses
 
393
 *
 
394
 * For entries in a WINDOW list, "name" is the window name being defined.
 
395
 * For OVER clauses, we use "name" for the "OVER window" syntax, or "refname"
 
396
 * for the "OVER (window)" syntax, which is subtly different --- the latter
 
397
 * implies overriding the window frame clause.
 
398
 */
 
399
typedef struct WindowDef
 
400
{
 
401
        NodeTag         type;
 
402
        char       *name;                       /* window's own name */
 
403
        char       *refname;            /* referenced window name, if any */
 
404
        List       *partitionClause;    /* PARTITION BY expression list */
 
405
        List       *orderClause;        /* ORDER BY (list of SortBy) */
 
406
        int                     frameOptions;   /* frame_clause options, see below */
 
407
        int                     location;               /* parse location, or -1 if none/unknown */
 
408
} WindowDef;
 
409
 
 
410
/*
 
411
 * frameOptions is an OR of these bits.  The NONDEFAULT and BETWEEN bits are
 
412
 * used so that ruleutils.c can tell which properties were specified and
 
413
 * which were defaulted; the correct behavioral bits must be set either way.
 
414
 * The START_foo and END_foo options must come in pairs of adjacent bits for
 
415
 * the convenience of gram.y, even though some of them are useless/invalid.
 
416
 * We will need more bits (and fields) to cover the full SQL:2008 option set.
 
417
 */
 
418
#define FRAMEOPTION_NONDEFAULT                                  0x00001 /* any specified? */
 
419
#define FRAMEOPTION_RANGE                                               0x00002 /* RANGE behavior */
 
420
#define FRAMEOPTION_ROWS                                                0x00004 /* ROWS behavior */
 
421
#define FRAMEOPTION_BETWEEN                                             0x00008 /* BETWEEN given? */
 
422
#define FRAMEOPTION_START_UNBOUNDED_PRECEDING   0x00010 /* start is U. P. */
 
423
#define FRAMEOPTION_END_UNBOUNDED_PRECEDING             0x00020 /* (disallowed) */
 
424
#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING   0x00040 /* (disallowed) */
 
425
#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING             0x00080 /* end is U. F. */
 
426
#define FRAMEOPTION_START_CURRENT_ROW                   0x00100 /* start is C. R. */
 
427
#define FRAMEOPTION_END_CURRENT_ROW                             0x00200 /* end is C. R. */
 
428
 
 
429
#define FRAMEOPTION_DEFAULTS \
 
430
        (FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \
 
431
         FRAMEOPTION_END_CURRENT_ROW)
 
432
 
 
433
/*
348
434
 * RangeSubselect - subquery appearing in a FROM clause
349
435
 */
350
436
typedef struct RangeSubselect
428
514
        Node       *expr;                       /* expression to index, or NULL */
429
515
        List       *opclass;            /* name of desired opclass; NIL = default */
430
516
        SortByDir       ordering;               /* ASC/DESC/default */
431
 
        SortByNulls     nulls_ordering; /* FIRST/LAST/default */
 
517
        SortByNulls nulls_ordering; /* FIRST/LAST/default */
432
518
} IndexElem;
433
519
 
434
520
/*
435
 
 * DefElem -
436
 
 *        a definition (used in definition lists in the form of defname = arg)
 
521
 * DefElem - a generic "name = value" option definition
 
522
 *
 
523
 * In some contexts the name can be qualified.  Also, certain SQL commands
 
524
 * allow a SET/ADD/DROP action to be attached to option settings, so it's
 
525
 * convenient to carry a field for that too.  (Note: currently, it is our
 
526
 * practice that the grammar allows namespace and action only in statements
 
527
 * where they are relevant; C code can just ignore those fields in other
 
528
 * statements.)
437
529
 */
 
530
typedef enum DefElemAction
 
531
{
 
532
        DEFELEM_UNSPEC,                         /* no action given */
 
533
        DEFELEM_SET,
 
534
        DEFELEM_ADD,
 
535
        DEFELEM_DROP
 
536
} DefElemAction;
 
537
 
438
538
typedef struct DefElem
439
539
{
440
540
        NodeTag         type;
 
541
        char       *defnamespace;       /* NULL if unqualified name */
441
542
        char       *defname;
442
543
        Node       *arg;                        /* a (Value *) or a (TypeName *) */
 
544
        DefElemAction defaction;        /* unspecified action, or SET/ADD/DROP */
443
545
} DefElem;
444
546
 
445
547
/*
446
548
 * LockingClause - raw representation of FOR UPDATE/SHARE options
447
549
 *
448
550
 * Note: lockedRels == NIL means "all relations in query".      Otherwise it
449
 
 * is a list of String nodes giving relation eref names.
 
551
 * is a list of RangeVar nodes.  (We use RangeVar mainly because it carries
 
552
 * a location field --- currently, parse analysis insists on unqualified
 
553
 * names in LockingClause.)
450
554
 */
451
555
typedef struct LockingClause
452
556
{
457
561
} LockingClause;
458
562
 
459
563
/*
460
 
 * XMLSERIALIZE
 
564
 * XMLSERIALIZE (in raw parse tree only)
461
565
 */
462
566
typedef struct XmlSerialize
463
567
{
464
568
        NodeTag         type;
465
 
        XmlOptionType xmloption;
 
569
        XmlOptionType xmloption;        /* DOCUMENT or CONTENT */
466
570
        Node       *expr;
467
571
        TypeName   *typename;
 
572
        int                     location;               /* token location, or -1 if unknown */
468
573
} XmlSerialize;
469
574
 
470
575
 
530
635
 *        then do the permissions checks using the access rights of that user,
531
636
 *        not the current effective user ID.  (This allows rules to act as
532
637
 *        setuid gateways.)
 
638
 *
 
639
 *        For SELECT/INSERT/UPDATE permissions, if the user doesn't have
 
640
 *        table-wide permissions then it is sufficient to have the permissions
 
641
 *        on all columns identified in selectedCols (for SELECT) and/or
 
642
 *        modifiedCols (for INSERT/UPDATE; we can tell which from the query type).
 
643
 *        selectedCols and modifiedCols are bitmapsets, which cannot have negative
 
644
 *        integer members, so we subtract FirstLowInvalidHeapAttributeNumber from
 
645
 *        column numbers before storing them in these fields.  A whole-row Var
 
646
 *        reference is represented by setting the bit for InvalidAttrNumber.
533
647
 *--------------------
534
648
 */
535
649
typedef enum RTEKind
539
653
        RTE_JOIN,                                       /* join */
540
654
        RTE_SPECIAL,                            /* special rule relation (NEW or OLD) */
541
655
        RTE_FUNCTION,                           /* function in FROM */
542
 
        RTE_VALUES                                      /* VALUES (<exprlist>), (<exprlist>), ... */
 
656
        RTE_VALUES,                                     /* VALUES (<exprlist>), (<exprlist>), ... */
 
657
        RTE_CTE                                         /* common table expr (WITH list element) */
543
658
} RTEKind;
544
659
 
545
660
typedef struct RangeTblEntry
551
666
        /*
552
667
         * XXX the fields applicable to only some rte kinds should be merged into
553
668
         * a union.  I didn't do this yet because the diffs would impact a lot of
554
 
         * code that is being actively worked on.  FIXME later.
 
669
         * code that is being actively worked on.  FIXME someday.
555
670
         */
556
671
 
557
672
        /*
565
680
        Query      *subquery;           /* the sub-query */
566
681
 
567
682
        /*
568
 
         * Fields valid for a function RTE (else NULL):
569
 
         *
570
 
         * If the function returns RECORD, funccoltypes lists the column types
571
 
         * declared in the RTE's column type specification, and funccoltypmods
572
 
         * lists their declared typmods.  Otherwise, both fields are NIL.
573
 
         */
574
 
        Node       *funcexpr;           /* expression tree for func call */
575
 
        List       *funccoltypes;       /* OID list of column type OIDs */
576
 
        List       *funccoltypmods; /* integer list of column typmods */
577
 
 
578
 
        /*
579
 
         * Fields valid for a values RTE (else NIL):
580
 
         */
581
 
        List       *values_lists;       /* list of expression lists */
582
 
 
583
 
        /*
584
683
         * Fields valid for a join RTE (else NULL/zero):
585
684
         *
586
685
         * joinaliasvars is a list of Vars or COALESCE expressions corresponding
595
694
        List       *joinaliasvars;      /* list of alias-var expansions */
596
695
 
597
696
        /*
 
697
         * Fields valid for a function RTE (else NULL):
 
698
         *
 
699
         * If the function returns RECORD, funccoltypes lists the column types
 
700
         * declared in the RTE's column type specification, and funccoltypmods
 
701
         * lists their declared typmods.  Otherwise, both fields are NIL.
 
702
         */
 
703
        Node       *funcexpr;           /* expression tree for func call */
 
704
        List       *funccoltypes;       /* OID list of column type OIDs */
 
705
        List       *funccoltypmods; /* integer list of column typmods */
 
706
 
 
707
        /*
 
708
         * Fields valid for a values RTE (else NIL):
 
709
         */
 
710
        List       *values_lists;       /* list of expression lists */
 
711
 
 
712
        /*
 
713
         * Fields valid for a CTE RTE (else NULL/zero):
 
714
         */
 
715
        char       *ctename;            /* name of the WITH list item */
 
716
        Index           ctelevelsup;    /* number of query levels up */
 
717
        bool            self_reference; /* is this a recursive self-reference? */
 
718
        List       *ctecoltypes;        /* OID list of column type OIDs */
 
719
        List       *ctecoltypmods;      /* integer list of column typmods */
 
720
 
 
721
        /*
598
722
         * Fields valid in all RTEs:
599
723
         */
600
724
        Alias      *alias;                      /* user-written alias clause, if any */
603
727
        bool            inFromCl;               /* present in FROM clause? */
604
728
        AclMode         requiredPerms;  /* bitmask of required access permissions */
605
729
        Oid                     checkAsUser;    /* if valid, check access as this role */
 
730
        Bitmapset  *selectedCols;       /* columns needing SELECT permission */
 
731
        Bitmapset  *modifiedCols;       /* columns needing INSERT/UPDATE permission */
606
732
} RangeTblEntry;
607
733
 
608
734
/*
609
 
 * SortClause -
610
 
 *         representation of ORDER BY clauses
 
735
 * SortGroupClause -
 
736
 *              representation of ORDER BY, GROUP BY, PARTITION BY,
 
737
 *              DISTINCT, DISTINCT ON items
 
738
 *
 
739
 * You might think that ORDER BY is only interested in defining ordering,
 
740
 * and GROUP/DISTINCT are only interested in defining equality.  However,
 
741
 * one way to implement grouping is to sort and then apply a "uniq"-like
 
742
 * filter.      So it's also interesting to keep track of possible sort operators
 
743
 * for GROUP/DISTINCT, and in particular to try to sort for the grouping
 
744
 * in a way that will also yield a requested ORDER BY ordering.  So we need
 
745
 * to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates
 
746
 * the decision to give them the same representation.
611
747
 *
612
748
 * tleSortGroupRef must match ressortgroupref of exactly one entry of the
613
 
 * associated targetlist; that is the expression to be sorted (or grouped) by.
614
 
 * sortop is the OID of the ordering operator (a "<" or ">" operator).
615
 
 * nulls_first does about what you'd expect.
616
 
 *
617
 
 * SortClauses are also used to identify targets that we will do a "Unique"
618
 
 * filter step on (for SELECT DISTINCT and SELECT DISTINCT ON).  The
619
 
 * distinctClause list is simply a copy of the relevant members of the
620
 
 * sortClause list.  Note that distinctClause can be a subset of sortClause,
621
 
 * but cannot have members not present in sortClause; and the members that
622
 
 * do appear must be in the same order as in sortClause.
 
749
 *              query's targetlist; that is the expression to be sorted or grouped by.
 
750
 * eqop is the OID of the equality operator.
 
751
 * sortop is the OID of the ordering operator (a "<" or ">" operator),
 
752
 *              or InvalidOid if not available.
 
753
 * nulls_first means about what you'd expect.  If sortop is InvalidOid
 
754
 *              then nulls_first is meaningless and should be set to false.
 
755
 *
 
756
 * In an ORDER BY item, all fields must be valid.  (The eqop isn't essential
 
757
 * here, but it's cheap to get it along with the sortop, and requiring it
 
758
 * to be valid eases comparisons to grouping items.)
 
759
 *
 
760
 * In a grouping item, eqop must be valid.      If the eqop is a btree equality
 
761
 * operator, then sortop should be set to a compatible ordering operator.
 
762
 * We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that
 
763
 * the query presents for the same tlist item.  If there is none, we just
 
764
 * use the default ordering op for the datatype.
 
765
 *
 
766
 * If the tlist item's type has a hash opclass but no btree opclass, then
 
767
 * we will set eqop to the hash equality operator, sortop to InvalidOid,
 
768
 * and nulls_first to false.  A grouping item of this kind can only be
 
769
 * implemented by hashing, and of course it'll never match an ORDER BY item.
 
770
 *
 
771
 * A query might have both ORDER BY and DISTINCT (or DISTINCT ON) clauses.
 
772
 * In SELECT DISTINCT, the distinctClause list is as long or longer than the
 
773
 * sortClause list, while in SELECT DISTINCT ON it's typically shorter.
 
774
 * The two lists must match up to the end of the shorter one --- the parser
 
775
 * rearranges the distinctClause if necessary to make this true.  (This
 
776
 * restriction ensures that only one sort step is needed to both satisfy the
 
777
 * ORDER BY and set up for the Unique step.  This is semantically necessary
 
778
 * for DISTINCT ON, and presents no real drawback for DISTINCT.)
623
779
 */
624
 
typedef struct SortClause
 
780
typedef struct SortGroupClause
625
781
{
626
782
        NodeTag         type;
627
783
        Index           tleSortGroupRef;        /* reference into targetlist */
628
 
        Oid                     sortop;                         /* the ordering operator ('<' op) */
629
 
        bool            nulls_first;            /* do NULLs come before normal values? */
630
 
} SortClause;
 
784
        Oid                     eqop;                   /* the equality operator ('=' op) */
 
785
        Oid                     sortop;                 /* the ordering operator ('<' op), or 0 */
 
786
        bool            nulls_first;    /* do NULLs come before normal values? */
 
787
} SortGroupClause;
631
788
 
632
789
/*
633
 
 * GroupClause -
634
 
 *         representation of GROUP BY clauses
635
 
 *
636
 
 * GroupClause is exactly like SortClause except for the nodetag value.
637
 
 * We have routines that operate interchangeably on both.
638
 
 *
639
 
 * XXX SortClause overspecifies the semantics so far as GROUP BY is concerned
640
 
 * (ditto for DISTINCT).  It'd be better to specify an equality operator not
641
 
 * an ordering operator.  However, the two implementations are tightly entwined
642
 
 * at the moment ... breaking them apart is work for another day.
 
790
 * WindowClause -
 
791
 *              transformed representation of WINDOW and OVER clauses
 
792
 *
 
793
 * A parsed Query's windowClause list contains these structs.  "name" is set
 
794
 * if the clause originally came from WINDOW, and is NULL if it originally
 
795
 * was an OVER clause (but note that we collapse out duplicate OVERs).
 
796
 * partitionClause and orderClause are lists of SortGroupClause structs.
 
797
 * winref is an ID number referenced by WindowFunc nodes; it must be unique
 
798
 * among the members of a Query's windowClause list.
 
799
 * When refname isn't null, the partitionClause is always copied from there;
 
800
 * the orderClause might or might not be copied (see copiedOrder); the framing
 
801
 * options are never copied, per spec.
643
802
 */
644
 
typedef SortClause GroupClause;
 
803
typedef struct WindowClause
 
804
{
 
805
        NodeTag         type;
 
806
        char       *name;                       /* window name (NULL in an OVER clause) */
 
807
        char       *refname;            /* referenced window name, if any */
 
808
        List       *partitionClause;    /* PARTITION BY list */
 
809
        List       *orderClause;        /* ORDER BY list */
 
810
        int                     frameOptions;   /* frame_clause options, see WindowDef */
 
811
        Index           winref;                 /* ID referenced by window functions */
 
812
        bool            copiedOrder;    /* did we copy orderClause from refname? */
 
813
} WindowClause;
645
814
 
646
815
/*
647
816
 * RowMarkClause -
648
817
 *         representation of FOR UPDATE/SHARE clauses
649
818
 *
650
 
 * We create a separate RowMarkClause node for each target relation
 
819
 * We create a separate RowMarkClause node for each target relation.  In the
 
820
 * output of the parser and rewriter, all RowMarkClauses have rti == prti and
 
821
 * isParent == false.  When the planner discovers that a target relation
 
822
 * is the root of an inheritance tree, it sets isParent true, and adds an
 
823
 * additional RowMarkClause to the list for each child relation (including
 
824
 * the target rel itself in its role as a child).  The child entries have
 
825
 * rti == child rel's RT index, prti == parent's RT index, and can therefore
 
826
 * be recognized as children by the fact that prti != rti.
651
827
 */
652
828
typedef struct RowMarkClause
653
829
{
654
830
        NodeTag         type;
655
831
        Index           rti;                    /* range table index of target relation */
 
832
        Index           prti;                   /* range table index of parent relation */
656
833
        bool            forUpdate;              /* true = FOR UPDATE, false = FOR SHARE */
657
834
        bool            noWait;                 /* NOWAIT option */
 
835
        bool            isParent;               /* set by planner when expanding inheritance */
658
836
} RowMarkClause;
659
837
 
 
838
/*
 
839
 * WithClause -
 
840
 *         representation of WITH clause
 
841
 *
 
842
 * Note: WithClause does not propagate into the Query representation;
 
843
 * but CommonTableExpr does.
 
844
 */
 
845
typedef struct WithClause
 
846
{
 
847
        NodeTag         type;
 
848
        List       *ctes;                       /* list of CommonTableExprs */
 
849
        bool            recursive;              /* true = WITH RECURSIVE */
 
850
        int                     location;               /* token location, or -1 if unknown */
 
851
} WithClause;
 
852
 
 
853
/*
 
854
 * CommonTableExpr -
 
855
 *         representation of WITH list element
 
856
 *
 
857
 * We don't currently support the SEARCH or CYCLE clause.
 
858
 */
 
859
typedef struct CommonTableExpr
 
860
{
 
861
        NodeTag         type;
 
862
        char       *ctename;            /* query name (never qualified) */
 
863
        List       *aliascolnames;      /* optional list of column names */
 
864
        Node       *ctequery;           /* subquery (SelectStmt or Query) */
 
865
        int                     location;               /* token location, or -1 if unknown */
 
866
        /* These fields are set during parse analysis: */
 
867
        bool            cterecursive;   /* is this CTE actually recursive? */
 
868
        int                     cterefcount;    /* number of RTEs referencing this CTE
 
869
                                                                 * (excluding internal self-references) */
 
870
        List       *ctecolnames;        /* list of output column names */
 
871
        List       *ctecoltypes;        /* OID list of output column type OIDs */
 
872
        List       *ctecoltypmods;      /* integer list of output column typmods */
 
873
} CommonTableExpr;
 
874
 
660
875
/*****************************************************************************
661
876
 *              Optimizable Statements
662
877
 *****************************************************************************/
741
956
        Node       *whereClause;        /* WHERE qualification */
742
957
        List       *groupClause;        /* GROUP BY clauses */
743
958
        Node       *havingClause;       /* HAVING conditional-expression */
 
959
        List       *windowClause;       /* WINDOW window_name AS (...), ... */
 
960
        WithClause *withClause;         /* WITH clause */
744
961
 
745
962
        /*
746
963
         * In a "leaf" node representing a VALUES list, the above fields are all
779
996
 * top-level Query node containing the leaf SELECTs as subqueries in its
780
997
 * range table.  Its setOperations field shows the tree of set operations,
781
998
 * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal
782
 
 * nodes replaced by SetOperationStmt nodes.
 
999
 * nodes replaced by SetOperationStmt nodes.  Information about the output
 
1000
 * column types is added, too.  (Note that the child nodes do not necessarily
 
1001
 * produce these types directly, but we've checked that their output types
 
1002
 * can be coerced to the output column type.)  Also, if it's not UNION ALL,
 
1003
 * information about the types' sort/group semantics is provided in the form
 
1004
 * of a SortGroupClause list (same representation as, eg, DISTINCT).
783
1005
 * ----------------------
784
1006
 */
785
1007
typedef struct SetOperationStmt
794
1016
        /* Fields derived during parse analysis: */
795
1017
        List       *colTypes;           /* OID list of output column type OIDs */
796
1018
        List       *colTypmods;         /* integer list of output column typmods */
 
1019
        List       *groupClauses;       /* a list of SortGroupClause's */
 
1020
        /* groupClauses is NIL if UNION ALL, but must be set otherwise */
797
1021
} SetOperationStmt;
798
1022
 
799
1023
 
823
1047
        OBJECT_CONVERSION,
824
1048
        OBJECT_DATABASE,
825
1049
        OBJECT_DOMAIN,
 
1050
        OBJECT_FDW,
 
1051
        OBJECT_FOREIGN_SERVER,
826
1052
        OBJECT_FUNCTION,
827
1053
        OBJECT_INDEX,
828
1054
        OBJECT_LANGUAGE,
882
1108
typedef enum AlterTableType
883
1109
{
884
1110
        AT_AddColumn,                           /* add column */
 
1111
        AT_AddColumnToView,                     /* implicitly via CREATE OR REPLACE VIEW */
885
1112
        AT_ColumnDefault,                       /* alter column default */
886
1113
        AT_DropNotNull,                         /* alter column drop not null */
887
1114
        AT_SetNotNull,                          /* alter column set not null */
892
1119
        AT_AddIndex,                            /* add index */
893
1120
        AT_ReAddIndex,                          /* internal to commands/tablecmds.c */
894
1121
        AT_AddConstraint,                       /* add constraint */
 
1122
        AT_AddConstraintRecurse,        /* internal to commands/tablecmds.c */
895
1123
        AT_ProcessedConstraint,         /* pre-processed add constraint (local in
896
1124
                                                                 * parser/parse_utilcmd.c) */
897
1125
        AT_DropConstraint,                      /* drop constraint */
898
 
        AT_DropConstraintQuietly,       /* drop constraint, no error/warning (local in
899
 
                                                                 * commands/tablecmds.c) */
 
1126
        AT_DropConstraintRecurse,       /* internal to commands/tablecmds.c */
900
1127
        AT_AlterColumnType,                     /* alter column type */
901
1128
        AT_ChangeOwner,                         /* change owner */
902
1129
        AT_ClusterOn,                           /* CLUSTER ON */
903
1130
        AT_DropCluster,                         /* SET WITHOUT CLUSTER */
 
1131
        AT_AddOids,                                     /* SET WITH OIDS */
904
1132
        AT_DropOids,                            /* SET WITHOUT OIDS */
905
1133
        AT_SetTableSpace,                       /* SET TABLESPACE */
906
1134
        AT_SetRelOptions,                       /* SET (...) -- AM specific parameters */
965
1193
 */
966
1194
typedef enum GrantObjectType
967
1195
{
 
1196
        ACL_OBJECT_COLUMN,                      /* column */
968
1197
        ACL_OBJECT_RELATION,            /* table, view */
969
1198
        ACL_OBJECT_SEQUENCE,            /* sequence */
970
1199
        ACL_OBJECT_DATABASE,            /* database */
 
1200
        ACL_OBJECT_FDW,                         /* foreign-data wrapper */
 
1201
        ACL_OBJECT_FOREIGN_SERVER,      /* foreign server */
971
1202
        ACL_OBJECT_FUNCTION,            /* function */
972
1203
        ACL_OBJECT_LANGUAGE,            /* procedural language */
973
1204
        ACL_OBJECT_NAMESPACE,           /* namespace */
981
1212
        GrantObjectType objtype;        /* kind of object being operated on */
982
1213
        List       *objects;            /* list of RangeVar nodes, FuncWithArgs nodes,
983
1214
                                                                 * or plain names (as Value strings) */
984
 
        List       *privileges;         /* list of privilege names (as Strings) */
985
 
        /* privileges == NIL denotes "all privileges" */
 
1215
        List       *privileges;         /* list of AccessPriv nodes */
 
1216
        /* privileges == NIL denotes ALL PRIVILEGES */
986
1217
        List       *grantees;           /* list of PrivGrantee nodes */
987
1218
        bool            grant_option;   /* grant or revoke grant option */
988
1219
        DropBehavior behavior;          /* drop behavior (for REVOKE) */
1006
1237
        List       *funcargs;           /* list of Typename nodes */
1007
1238
} FuncWithArgs;
1008
1239
 
1009
 
/* This is only used internally in gram.y. */
1010
 
typedef struct PrivTarget
 
1240
/*
 
1241
 * An access privilege, with optional list of column names
 
1242
 * priv_name == NULL denotes ALL PRIVILEGES (only used with a column list)
 
1243
 * cols == NIL denotes "all columns"
 
1244
 * Note that simple "ALL PRIVILEGES" is represented as a NIL list, not
 
1245
 * an AccessPriv with both fields null.
 
1246
 */
 
1247
typedef struct AccessPriv
1011
1248
{
1012
1249
        NodeTag         type;
1013
 
        GrantObjectType objtype;
1014
 
        List       *objs;
1015
 
} PrivTarget;
 
1250
        char       *priv_name;          /* string name of privilege */
 
1251
        List       *cols;                       /* list of Value strings */
 
1252
} AccessPriv;
1016
1253
 
1017
1254
/* ----------------------
1018
1255
 *              Grant/Revoke Role Statement
1019
1256
 *
1020
 
 * Note: the lists of roles are lists of names, as Value strings
 
1257
 * Note: because of the parsing ambiguity with the GRANT <privileges>
 
1258
 * statement, granted_roles is a list of AccessPriv; the execution code
 
1259
 * should complain if any column lists appear.  grantee_roles is a list
 
1260
 * of role names, as Value strings.
1021
1261
 * ----------------------
1022
1262
 */
1023
1263
typedef struct GrantRoleStmt
1221
1461
} DropTableSpaceStmt;
1222
1462
 
1223
1463
/* ----------------------
 
1464
 *              Create/Drop FOREIGN DATA WRAPPER Statements
 
1465
 * ----------------------
 
1466
 */
 
1467
 
 
1468
typedef struct CreateFdwStmt
 
1469
{
 
1470
        NodeTag         type;
 
1471
        char       *fdwname;            /* foreign-data wrapper name */
 
1472
        List       *validator;          /* optional validator function (qual. name) */
 
1473
        List       *options;            /* generic options to FDW */
 
1474
} CreateFdwStmt;
 
1475
 
 
1476
typedef struct AlterFdwStmt
 
1477
{
 
1478
        NodeTag         type;
 
1479
        char       *fdwname;            /* foreign-data wrapper name */
 
1480
        List       *validator;          /* optional validator function (qual. name) */
 
1481
        bool            change_validator;
 
1482
        List       *options;            /* generic options to FDW */
 
1483
} AlterFdwStmt;
 
1484
 
 
1485
typedef struct DropFdwStmt
 
1486
{
 
1487
        NodeTag         type;
 
1488
        char       *fdwname;            /* foreign-data wrapper name */
 
1489
        bool            missing_ok;             /* don't complain if missing */
 
1490
        DropBehavior behavior;          /* drop behavior - cascade/restrict */
 
1491
} DropFdwStmt;
 
1492
 
 
1493
/* ----------------------
 
1494
 *              Create/Drop FOREIGN SERVER Statements
 
1495
 * ----------------------
 
1496
 */
 
1497
 
 
1498
typedef struct CreateForeignServerStmt
 
1499
{
 
1500
        NodeTag         type;
 
1501
        char       *servername;         /* server name */
 
1502
        char       *servertype;         /* optional server type */
 
1503
        char       *version;            /* optional server version */
 
1504
        char       *fdwname;            /* FDW name */
 
1505
        List       *options;            /* generic options to server */
 
1506
} CreateForeignServerStmt;
 
1507
 
 
1508
typedef struct AlterForeignServerStmt
 
1509
{
 
1510
        NodeTag         type;
 
1511
        char       *servername;         /* server name */
 
1512
        char       *version;            /* optional server version */
 
1513
        List       *options;            /* generic options to server */
 
1514
        bool            has_version;    /* version specified */
 
1515
} AlterForeignServerStmt;
 
1516
 
 
1517
typedef struct DropForeignServerStmt
 
1518
{
 
1519
        NodeTag         type;
 
1520
        char       *servername;         /* server name */
 
1521
        bool            missing_ok;             /* ignore missing servers */
 
1522
        DropBehavior behavior;          /* drop behavior - cascade/restrict */
 
1523
} DropForeignServerStmt;
 
1524
 
 
1525
/* ----------------------
 
1526
 *              Create/Drop USER MAPPING Statements
 
1527
 * ----------------------
 
1528
 */
 
1529
 
 
1530
typedef struct CreateUserMappingStmt
 
1531
{
 
1532
        NodeTag         type;
 
1533
        char       *username;           /* username or PUBLIC/CURRENT_USER */
 
1534
        char       *servername;         /* server name */
 
1535
        List       *options;            /* generic options to server */
 
1536
} CreateUserMappingStmt;
 
1537
 
 
1538
typedef struct AlterUserMappingStmt
 
1539
{
 
1540
        NodeTag         type;
 
1541
        char       *username;           /* username or PUBLIC/CURRENT_USER */
 
1542
        char       *servername;         /* server name */
 
1543
        List       *options;            /* generic options to server */
 
1544
} AlterUserMappingStmt;
 
1545
 
 
1546
typedef struct DropUserMappingStmt
 
1547
{
 
1548
        NodeTag         type;
 
1549
        char       *username;           /* username or PUBLIC/CURRENT_USER */
 
1550
        char       *servername;         /* server name */
 
1551
        bool            missing_ok;             /* ignore missing mappings */
 
1552
} DropUserMappingStmt;
 
1553
 
 
1554
/* ----------------------
1224
1555
 *              Create/Drop TRIGGER Statements
1225
1556
 * ----------------------
1226
1557
 */
1234
1565
        List       *args;                       /* list of (T_String) Values or NIL */
1235
1566
        bool            before;                 /* BEFORE/AFTER */
1236
1567
        bool            row;                    /* ROW/STATEMENT */
1237
 
        char            actions[4];             /* 1 to 3 of 'i', 'u', 'd', + trailing \0 */
 
1568
        /* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
 
1569
        int16           events;                 /* INSERT/UPDATE/DELETE/TRUNCATE */
1238
1570
 
1239
1571
        /* The following are used for referential */
1240
1572
        /* integrity constraint triggers */
1383
1715
        List       *name;                       /* operator or function name */
1384
1716
        List       *args;                       /* argument types */
1385
1717
        int                     number;                 /* strategy num or support proc num */
1386
 
        bool            recheck;                /* only used for operators */
1387
1718
        List       *class_args;         /* only used for functions */
1388
1719
        /* fields used for a storagetype item: */
1389
1720
        TypeName   *storedtype;         /* datatype stored in index */
1453
1784
{
1454
1785
        NodeTag         type;
1455
1786
        List       *relations;          /* relations (RangeVars) to be truncated */
 
1787
        bool            restart_seqs;   /* restart owned sequences? */
1456
1788
        DropBehavior behavior;          /* RESTRICT or CASCADE behavior */
1457
1789
} TruncateStmt;
1458
1790
 
1473
1805
 *              Declare Cursor Statement
1474
1806
 *
1475
1807
 * Note: the "query" field of DeclareCursorStmt is only used in the raw grammar
1476
 
 * output.  After parse analysis it's set to null, and the Query points to the
 
1808
 * output.      After parse analysis it's set to null, and the Query points to the
1477
1809
 * DeclareCursorStmt, not vice versa.
1478
1810
 * ----------------------
1479
1811
 */
1480
 
#define CURSOR_OPT_BINARY               0x0001          /* BINARY */
1481
 
#define CURSOR_OPT_SCROLL               0x0002          /* SCROLL explicitly given */
1482
 
#define CURSOR_OPT_NO_SCROLL    0x0004          /* NO SCROLL explicitly given */
1483
 
#define CURSOR_OPT_INSENSITIVE  0x0008          /* INSENSITIVE (unimplemented) */
1484
 
#define CURSOR_OPT_HOLD                 0x0010          /* WITH HOLD */
1485
 
#define CURSOR_OPT_FAST_PLAN    0x0020          /* prefer fast-start plan */
 
1812
#define CURSOR_OPT_BINARY               0x0001  /* BINARY */
 
1813
#define CURSOR_OPT_SCROLL               0x0002  /* SCROLL explicitly given */
 
1814
#define CURSOR_OPT_NO_SCROLL    0x0004  /* NO SCROLL explicitly given */
 
1815
#define CURSOR_OPT_INSENSITIVE  0x0008  /* INSENSITIVE */
 
1816
#define CURSOR_OPT_HOLD                 0x0010  /* WITH HOLD */
 
1817
#define CURSOR_OPT_FAST_PLAN    0x0020  /* prefer fast-start plan */
1486
1818
 
1487
1819
typedef struct DeclareCursorStmt
1488
1820
{
1500
1832
{
1501
1833
        NodeTag         type;
1502
1834
        char       *portalname;         /* name of the portal (cursor) */
1503
 
                                                                /* NULL means CLOSE ALL */
 
1835
        /* NULL means CLOSE ALL */
1504
1836
} ClosePortalStmt;
1505
1837
 
1506
1838
/* ----------------------
1538
1870
        char       *idxname;            /* name of new index, or NULL for default */
1539
1871
        RangeVar   *relation;           /* relation to build index on */
1540
1872
        char       *accessMethod;       /* name of access method (eg. btree) */
1541
 
        char       *tableSpace;         /* tablespace, or NULL to use parent's */
 
1873
        char       *tableSpace;         /* tablespace, or NULL for default */
1542
1874
        List       *indexParams;        /* a list of IndexElem */
1543
1875
        List       *options;            /* options from WITH clause */
1544
 
        char       *src_options;        /* relopts inherited from source index */
1545
1876
        Node       *whereClause;        /* qualification (partial-index predicate) */
1546
1877
        bool            unique;                 /* is index unique? */
1547
1878
        bool            primary;                /* is index on primary key? */
1569
1900
        /* the assigned enum values appear in pg_proc, don't change 'em! */
1570
1901
        FUNC_PARAM_IN = 'i',            /* input only */
1571
1902
        FUNC_PARAM_OUT = 'o',           /* output only */
1572
 
        FUNC_PARAM_INOUT = 'b'          /* both */
 
1903
        FUNC_PARAM_INOUT = 'b',         /* both */
 
1904
        FUNC_PARAM_VARIADIC = 'v',      /* variadic (always input) */
 
1905
        FUNC_PARAM_TABLE = 't'          /* table function output column */
1573
1906
} FunctionParameterMode;
1574
1907
 
1575
1908
typedef struct FunctionParameter
1577
1910
        NodeTag         type;
1578
1911
        char       *name;                       /* parameter name, or NULL if not given */
1579
1912
        TypeName   *argType;            /* TypeName for parameter type */
1580
 
        FunctionParameterMode mode; /* IN/OUT/INOUT */
 
1913
        FunctionParameterMode mode; /* IN/OUT/etc */
 
1914
        Node       *defexpr;            /* raw default expr, or NULL if not given */
1581
1915
} FunctionParameter;
1582
1916
 
1583
1917
typedef struct AlterFunctionStmt
1697
2031
typedef struct NotifyStmt
1698
2032
{
1699
2033
        NodeTag         type;
1700
 
        RangeVar   *relation;           /* qualified name to notify */
 
2034
        char       *conditionname;      /* condition name to notify */
1701
2035
} NotifyStmt;
1702
2036
 
1703
2037
/* ----------------------
1707
2041
typedef struct ListenStmt
1708
2042
{
1709
2043
        NodeTag         type;
1710
 
        RangeVar   *relation;           /* qualified name to listen on */
 
2044
        char       *conditionname;      /* condition name to listen on */
1711
2045
} ListenStmt;
1712
2046
 
1713
2047
/* ----------------------
1717
2051
typedef struct UnlistenStmt
1718
2052
{
1719
2053
        NodeTag         type;
1720
 
        RangeVar   *relation;           /* qualified name to unlisten on, or '*' */
 
2054
        char       *conditionname;      /* name to unlisten on, or NULL for all */
1721
2055
} UnlistenStmt;
1722
2056
 
1723
2057
/* ----------------------
1841
2175
        NodeTag         type;
1842
2176
        RangeVar   *relation;           /* relation being indexed, or NULL if all */
1843
2177
        char       *indexname;          /* original index defined */
 
2178
        bool            verbose;                /* print progress info */
1844
2179
} ClusterStmt;
1845
2180
 
1846
2181
/* ----------------------
1857
2192
        bool            full;                   /* do FULL (non-concurrent) vacuum */
1858
2193
        bool            analyze;                /* do ANALYZE step */
1859
2194
        bool            verbose;                /* print progress info */
1860
 
        int                     freeze_min_age; /* min freeze age, or -1 to use default */
 
2195
        int                     freeze_min_age; /* min freeze age, or -1 to use default */
 
2196
        int                     freeze_table_age;               /* age at which to scan whole table */
1861
2197
        RangeVar   *relation;           /* single table to process, or NULL */
1862
2198
        List       *va_cols;            /* list of column names, or NIL for all */
1863
2199
} VacuumStmt;
1898
2234
typedef struct DiscardStmt
1899
2235
{
1900
2236
        NodeTag         type;
1901
 
        DiscardMode     target;
 
2237
        DiscardMode target;
1902
2238
} DiscardStmt;
1903
2239
 
1904
2240
/* ----------------------
1963
2299
        TypeName   *targettype;
1964
2300
        FuncWithArgs *func;
1965
2301
        CoercionContext context;
 
2302
        bool            inout;
1966
2303
} CreateCastStmt;
1967
2304
 
1968
2305
/* ----------------------
2014
2351
{
2015
2352
        NodeTag         type;
2016
2353
        char       *name;                       /* The name of the plan to remove */
2017
 
                                                                /* NULL means DEALLOCATE ALL */
 
2354
        /* NULL means DEALLOCATE ALL */
2018
2355
} DeallocateStmt;
2019
2356
 
2020
2357
/*
2056
2393
        List       *cfgname;            /* qualified name (list of Value strings) */
2057
2394
 
2058
2395
        /*
2059
 
         * dicts will be non-NIL if ADD/ALTER MAPPING was specified.
2060
 
         * If dicts is NIL, but tokentype isn't, DROP MAPPING was specified.
 
2396
         * dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is
 
2397
         * NIL, but tokentype isn't, DROP MAPPING was specified.
2061
2398
         */
2062
 
        List            *tokentype;             /* list of Value strings */
2063
 
        List            *dicts;                 /* list of list of Value strings */
2064
 
        bool             override;              /* if true - remove old variant */
2065
 
        bool             replace;               /* if true - replace dictionary by another */
2066
 
        bool             missing_ok;    /* for DROP - skip error if missing? */
 
2399
        List       *tokentype;          /* list of Value strings */
 
2400
        List       *dicts;                      /* list of list of Value strings */
 
2401
        bool            override;               /* if true - remove old variant */
 
2402
        bool            replace;                /* if true - replace dictionary by another */
 
2403
        bool            missing_ok;             /* for DROP - skip error if missing? */
2067
2404
} AlterTSConfigurationStmt;
2068
2405
 
2069
2406
#endif   /* PARSENODES_H */