~ubuntu-branches/ubuntu/lucid/postgresql-8.4/lucid-proposed

« back to all changes in this revision

Viewing changes to src/include/nodes/parsenodes.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
14
14
 * Portions Copyright (c) 1994, Regents of the University of California
15
15
 *
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 $
17
17
 *
18
18
 *-------------------------------------------------------------------------
19
19
 */
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
                                                                 * servers */
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 */
114
115
 
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 */
184
185
/*
185
186
 * ColumnRef - specifies a reference to a column, or possibly a whole tuple
186
187
 *
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
385
386
{
386
387
        NodeTag         type;
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 */
393
394
} WindowDef;
394
395
 
395
396
/*
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.
402
403
 */
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. */
413
414
 
414
415
#define FRAMEOPTION_DEFAULTS \
415
416
        (FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \
505
506
/*
506
507
 * DefElem - a generic "name = value" option definition
507
508
 *
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
699
700
         */
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 */
705
706
 
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.)
744
745
 *
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.
750
751
 *
751
752
 * If the tlist item's type has a hash opclass but no btree opclass, then
766
767
{
767
768
        NodeTag         type;
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;
773
774
 
774
775
/*
788
789
typedef struct WindowClause
789
790
{
790
791
        NodeTag         type;
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? */
798
799
} WindowClause;
799
800
 
800
801
/*
822
823
 
823
824
/*
824
825
 * WithClause -
825
 
 *     representation of WITH clause
 
826
 *         representation of WITH clause
826
827
 *
827
828
 * Note: WithClause does not propagate into the Query representation;
828
829
 * but CommonTableExpr does.
837
838
 
838
839
/*
839
840
 * CommonTableExpr -
840
 
 *     representation of WITH list element
 
841
 *         representation of WITH list element
841
842
 *
842
843
 * We don't currently support the SEARCH or CYCLE clause.
843
844
 */
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
1241
1242
 *
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
 * ----------------------
1247
1248
 */
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 */
1554
1556
 
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 */
2183
2185
} VacuumStmt;