]> granicus.if.org Git - postgresql/blob - src/include/nodes/parsenodes.h
From: t-ishii@sra.co.jp
[postgresql] / src / include / nodes / parsenodes.h
1 /*-------------------------------------------------------------------------
2  *
3  * parsenodes.h--
4  *        definitions for parse tree nodes
5  *
6  *
7  * Copyright (c) 1994, Regents of the University of California
8  *
9  * $Id: parsenodes.h,v 1.52 1998/07/26 04:31:29 scrappy Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef PARSENODES_H
14 #define PARSENODES_H
15
16 #include <nodes/primnodes.h>
17
18 /*****************************************************************************
19  *      Query Tree
20  *****************************************************************************/
21
22 /*
23  * Query -
24  *        all statments are turned into a Query tree (via transformStmt)
25  *        for further processing by the optimizer
26  *        utility statements (i.e. non-optimizable statements)
27  *        have the *utilityStmt field set.
28  *
29  * we need the isPortal flag because portal names can be null too; can
30  * get rid of it if we support CURSOR as a commandType.
31  *
32  */
33 typedef struct Query
34 {
35         NodeTag         type;
36
37         CmdType         commandType;    /* select|insert|update|delete|utility */
38
39         Node       *utilityStmt;        /* non-null if this is a non-optimizable
40                                                                  * statement */
41
42         int                     resultRelation; /* target relation (index to rtable) */
43         char       *into;                       /* portal (cursor) name */
44         bool            isPortal;               /* is this a retrieve into portal? */
45         bool            isBinary;               /* binary portal? */
46         bool            unionall;               /* union without unique sort */
47         bool            hasAggs;                /* has aggregates in target list */
48         bool            hasSubLinks;    /* has subquery SubLink */
49
50         char       *uniqueFlag;         /* NULL, '*', or Unique attribute name */
51         List       *sortClause;         /* a list of SortClause's */
52
53         List       *rtable;                     /* list of range table entries */
54         List       *targetList;         /* target list (of TargetEntry) */
55         Node       *qual;                       /* qualifications */
56
57         List       *groupClause;        /* list of columns to specified in GROUP
58                                                                  * BY */
59         Node       *havingQual;         /* qualification of each group */
60
61         List       *unionClause;        /* unions are linked under the previous
62                                                                  * query */
63
64         /* internal to planner */
65         List       *base_relation_list_;        /* base relation list */
66         List       *join_relation_list_;        /* list of relations */
67 } Query;
68
69
70 /*****************************************************************************
71  *              Other Statements (no optimizations required)
72  *
73  *              Some of them require a little bit of transformation (which is also
74  *              done by transformStmt). The whole structure is then passed on to
75  *              ProcessUtility (by-passing the optimization step) as the utilityStmt
76  *              field in Query.
77  *****************************************************************************/
78
79 /* ----------------------
80  *              Add Column Statement
81  * ----------------------
82  */
83 typedef struct AddAttrStmt
84 {
85         NodeTag         type;
86         char       *relname;            /* the relation to add attr */
87         bool            inh;                    /* add recursively to children? */
88         Node       *colDef;                     /* the attribute definition */
89 } AddAttrStmt;
90
91 /* ----------------------
92  *              Change ACL Statement
93  * ----------------------
94  */
95 typedef struct ChangeACLStmt
96 {
97         NodeTag         type;
98         struct AclItem *aclitem;
99         unsigned        modechg;
100         List       *relNames;
101 } ChangeACLStmt;
102
103 /* ----------------------
104  *              Close Portal Statement
105  * ----------------------
106  */
107 typedef struct ClosePortalStmt
108 {
109         NodeTag         type;
110         char       *portalname;         /* name of the portal (cursor) */
111 } ClosePortalStmt;
112
113 /* ----------------------
114  *              Copy Statement
115  * ----------------------
116  */
117 typedef struct CopyStmt
118 {
119         NodeTag         type;
120         bool            binary;                 /* is a binary copy? */
121         char       *relname;            /* the relation to copy */
122         bool            oids;                   /* copy oid's? */
123         int                     direction;              /* TO or FROM */
124         char       *filename;           /* if NULL, use stdin/stdout */
125         char       *delimiter;          /* delimiter character, \t by default */
126 } CopyStmt;
127
128 /* ----------------------
129  *              Create Table Statement
130  * ----------------------
131  */
132 typedef struct CreateStmt
133 {
134         NodeTag         type;
135         char       *relname;            /* the relation to create */
136         List       *tableElts;          /* column definitions list of Column */
137         List       *inhRelnames;        /* relations to inherit from list of Value
138                                                                  * (string) */
139         List       *constraints;        /* list of constraints (ConstaintDef) */
140 } CreateStmt;
141
142 typedef enum ConstrType                 /* type of constaints */
143 {
144         CONSTR_NONE, CONSTR_NOTNULL, CONSTR_DEFAULT, CONSTR_CHECK, CONSTR_PRIMARY, CONSTR_UNIQUE
145 } ConstrType;
146
147 typedef struct Constraint
148 {
149         NodeTag         type;
150         ConstrType      contype;
151         char       *name;                       /* name */
152         void       *def;                        /* definition */
153         void       *keys;                       /* list of primary keys */
154 } Constraint;
155
156 /* ----------------------
157  *              Create/Drop TRIGGER Statements
158  * ----------------------
159  */
160
161 typedef struct CreateTrigStmt
162 {
163         NodeTag         type;
164         char       *trigname;           /* TRIGGER' name */
165         char       *relname;            /* triggered relation */
166         char       *funcname;           /* function to call (or NULL) */
167         List       *args;                       /* list of (T_String) Values or NULL */
168         bool            before;                 /* BEFORE/AFTER */
169         bool            row;                    /* ROW/STATEMENT */
170         char            actions[4];             /* Insert, Update, Delete */
171         char       *lang;                       /* NULL (which means Clanguage) */
172         char       *text;                       /* AS 'text' */
173         List       *attr;                       /* UPDATE OF a, b,... (NI) or NULL */
174         char       *when;                       /* WHEN 'a > 10 ...' (NI) or NULL */
175 } CreateTrigStmt;
176
177 typedef struct DropTrigStmt
178 {
179         NodeTag         type;
180         char       *trigname;           /* TRIGGER' name */
181         char       *relname;            /* triggered relation */
182 } DropTrigStmt;
183
184
185 /* ----------------------
186  *              Create/Drop PROCEDURAL LANGUAGE Statement
187  * ----------------------
188  */
189 typedef struct CreatePLangStmt
190 {
191         NodeTag         type;
192         char       *plname;                     /* PL name */
193         char       *plhandler;          /* PL call handler function */
194         char       *plcompiler;         /* lancompiler text */
195         bool            pltrusted;              /* PL is trusted */
196 } CreatePLangStmt;
197
198 typedef struct DropPLangStmt
199 {
200         NodeTag         type;
201         char       *plname;                     /* PL name */
202 } DropPLangStmt;
203
204
205 /* ----------------------
206  *                              Create/Alter/Drop User Statements
207  * ----------------------
208  */
209 typedef struct CreateUserStmt
210 {
211         NodeTag         type;
212         char       *user;                       /* PostgreSQL user login                          */
213         char       *password;           /* PostgreSQL user password                       */
214         bool       *createdb;           /* Can the user create databases?         */
215         bool       *createuser;         /* Can this user create users?            */
216         List       *groupElts;          /* The groups the user is a member of */
217         char       *validUntil;         /* The time the login is valid until  */
218 } CreateUserStmt;
219
220 typedef CreateUserStmt AlterUserStmt;
221
222 typedef struct DropUserStmt
223 {
224         NodeTag         type;
225         char       *user;                       /* PostgreSQL user login                          */
226 } DropUserStmt;
227
228
229 /* ----------------------
230  *              Create SEQUENCE Statement
231  * ----------------------
232  */
233
234 typedef struct CreateSeqStmt
235 {
236         NodeTag         type;
237         char       *seqname;            /* the relation to create */
238         List       *options;
239 } CreateSeqStmt;
240
241 /* ----------------------
242  *              Create Version Statement
243  * ----------------------
244  */
245 typedef struct VersionStmt
246 {
247         NodeTag         type;
248         char       *relname;            /* the new relation */
249         int                     direction;              /* FORWARD | BACKWARD */
250         char       *fromRelname;        /* relation to create a version */
251         char       *date;                       /* date of the snapshot */
252 } VersionStmt;
253
254 /* ----------------------
255  *              Create {Operator|Type|Aggregate} Statement
256  * ----------------------
257  */
258 typedef struct DefineStmt
259 {
260         NodeTag         type;
261         int                     defType;                /* OPERATOR|P_TYPE|AGGREGATE */
262         char       *defname;
263         List       *definition;         /* a list of DefElem */
264 } DefineStmt;
265
266 /* ----------------------
267  *              Drop Table Statement
268  * ----------------------
269  */
270 typedef struct DestroyStmt
271 {
272         NodeTag         type;
273         List       *relNames;           /* relations to be dropped */
274         bool            sequence;
275 } DestroyStmt;
276
277 /* ----------------------
278  *              Extend Index Statement
279  * ----------------------
280  */
281 typedef struct ExtendStmt
282 {
283         NodeTag         type;
284         char       *idxname;            /* name of the index */
285         Node       *whereClause;        /* qualifications */
286         List       *rangetable;         /* range table, filled in by
287                                                                  * transformStmt() */
288 } ExtendStmt;
289
290 /* ----------------------
291  *              Begin Recipe Statement
292  * ----------------------
293  */
294 typedef struct RecipeStmt
295 {
296         NodeTag         type;
297         char       *recipeName;         /* name of the recipe */
298 } RecipeStmt;
299
300 /* ----------------------
301  *              Fetch Statement
302  * ----------------------
303  */
304 typedef struct FetchStmt
305 {
306         NodeTag         type;
307         int                     direction;              /* FORWARD or BACKWARD */
308         int                     howMany;                /* amount to fetch ("ALL" --> 0) */
309         char       *portalname;         /* name of portal (cursor) */
310         bool            ismove;                 /* TRUE if MOVE */
311 } FetchStmt;
312
313 /* ----------------------
314  *              Create Index Statement
315  * ----------------------
316  */
317 typedef struct IndexStmt
318 {
319         NodeTag         type;
320         char       *idxname;            /* name of the index */
321         char       *relname;            /* name of relation to index on */
322         char       *accessMethod;       /* name of acess methood (eg. btree) */
323         List       *indexParams;        /* a list of IndexElem */
324         List       *withClause;         /* a list of ParamString */
325         Node       *whereClause;        /* qualifications */
326         List       *rangetable;         /* range table, filled in by
327                                                                  * transformStmt() */
328         bool       *lossy;                      /* is index lossy? */
329         bool            unique;                 /* is index unique? */
330 } IndexStmt;
331
332 /* ----------------------
333  *              Create Function Statement
334  * ----------------------
335  */
336 typedef struct ProcedureStmt
337 {
338         NodeTag         type;
339         char       *funcname;           /* name of function to create */
340         List       *defArgs;            /* list of definitions a list of strings
341                                                                  * (as Value *) */
342         Node       *returnType;         /* the return type (as a string or a
343                                                                  * TypeName (ie.setof) */
344         List       *withClause;         /* a list of ParamString */
345         char       *as;                         /* the SQL statement or filename */
346         char       *language;           /* C or SQL */
347 } ProcedureStmt;
348
349 /* ----------------------
350  *              Drop Aggregate Statement
351  * ----------------------
352  */
353 typedef struct RemoveAggrStmt
354 {
355         NodeTag         type;
356         char       *aggname;            /* aggregate to drop */
357         char       *aggtype;            /* for this type */
358 } RemoveAggrStmt;
359
360 /* ----------------------
361  *              Drop Function Statement
362  * ----------------------
363  */
364 typedef struct RemoveFuncStmt
365 {
366         NodeTag         type;
367         char       *funcname;           /* function to drop */
368         List       *args;                       /* types of the arguments */
369 } RemoveFuncStmt;
370
371 /* ----------------------
372  *              Drop Operator Statement
373  * ----------------------
374  */
375 typedef struct RemoveOperStmt
376 {
377         NodeTag         type;
378         char       *opname;                     /* operator to drop */
379         List       *args;                       /* types of the arguments */
380 } RemoveOperStmt;
381
382 /* ----------------------
383  *              Drop {Type|Index|Rule|View} Statement
384  * ----------------------
385  */
386 typedef struct RemoveStmt
387 {
388         NodeTag         type;
389         int                     removeType;             /* P_TYPE|INDEX|RULE|VIEW */
390         char       *name;                       /* name to drop */
391 } RemoveStmt;
392
393 /* ----------------------
394  *              Alter Table Statement
395  * ----------------------
396  */
397 typedef struct RenameStmt
398 {
399         NodeTag         type;
400         char       *relname;            /* relation to be altered */
401         bool            inh;                    /* recursively alter children? */
402         char       *column;                     /* if NULL, rename the relation name to
403                                                                  * the new name. Otherwise, rename this
404                                                                  * column name. */
405         char       *newname;            /* the new name */
406 } RenameStmt;
407
408 /* ----------------------
409  *              Create Rule Statement
410  * ----------------------
411  */
412 typedef struct RuleStmt
413 {
414         NodeTag         type;
415         char       *rulename;           /* name of the rule */
416         Node       *whereClause;        /* qualifications */
417         CmdType         event;                  /* RETRIEVE */
418         struct Attr *object;            /* object affected */
419         bool            instead;                /* is a 'do instead'? */
420         List       *actions;            /* the action statements */
421 } RuleStmt;
422
423 /* ----------------------
424  *              Notify Statement
425  * ----------------------
426  */
427 typedef struct NotifyStmt
428 {
429         NodeTag         type;
430         char       *relname;            /* relation to notify */
431 } NotifyStmt;
432
433 /* ----------------------
434  *              Listen Statement
435  * ----------------------
436  */
437 typedef struct ListenStmt
438 {
439         NodeTag         type;
440         char       *relname;            /* relation to listen on */
441 } ListenStmt;
442
443 /* ----------------------
444  *              {Begin|Abort|End} Transaction Statement
445  * ----------------------
446  */
447 typedef struct TransactionStmt
448 {
449         NodeTag         type;
450         int                     command;                /* BEGIN|END|ABORT */
451 } TransactionStmt;
452
453 /* ----------------------
454  *              Create View Statement
455  * ----------------------
456  */
457 typedef struct ViewStmt
458 {
459         NodeTag         type;
460         char       *viewname;           /* name of the view */
461         Query      *query;                      /* the SQL statement */
462 } ViewStmt;
463
464 /* ----------------------
465  *              Load Statement
466  * ----------------------
467  */
468 typedef struct LoadStmt
469 {
470         NodeTag         type;
471         char       *filename;           /* file to load */
472 } LoadStmt;
473
474 /* ----------------------
475  *              Createdb Statement
476  * ----------------------
477  */
478 typedef struct CreatedbStmt
479 {
480         NodeTag         type;
481         char       *dbname;                     /* database to create */
482         char       *dbpath;                     /* location of database */
483 #ifdef MULTIBYTE
484         int        encoding;                    /* default encoding
485                                                    (see regex/pg_wchar.h) */
486 #endif
487 } CreatedbStmt;
488
489 /* ----------------------
490  *              Destroydb Statement
491  * ----------------------
492  */
493 typedef struct DestroydbStmt
494 {
495         NodeTag         type;
496         char       *dbname;                     /* database to drop */
497 } DestroydbStmt;
498
499 /* ----------------------
500  *              Cluster Statement (support pbrown's cluster index implementation)
501  * ----------------------
502  */
503 typedef struct ClusterStmt
504 {
505         NodeTag         type;
506         char       *relname;            /* relation being indexed */
507         char       *indexname;          /* original index defined */
508 } ClusterStmt;
509
510 /* ----------------------
511  *              Vacuum Statement
512  * ----------------------
513  */
514 typedef struct VacuumStmt
515 {
516         NodeTag         type;
517         bool            verbose;                /* print status info */
518         bool            analyze;                /* analyze data */
519         char       *vacrel;                     /* table to vacuum */
520         List       *va_spec;            /* columns to analyse */
521 } VacuumStmt;
522
523 /* ----------------------
524  *              Explain Statement
525  * ----------------------
526  */
527 typedef struct ExplainStmt
528 {
529         NodeTag         type;
530         Query      *query;                      /* the query */
531         bool            verbose;                /* print plan info */
532 } ExplainStmt;
533
534 /* ----------------------
535  * Set Statement
536  * ----------------------
537  */
538
539 typedef struct VariableSetStmt
540 {
541         NodeTag         type;
542         char       *name;
543         char       *value;
544 } VariableSetStmt;
545
546 /* ----------------------
547  * Show Statement
548  * ----------------------
549  */
550
551 typedef struct VariableShowStmt
552 {
553         NodeTag         type;
554         char       *name;
555 } VariableShowStmt;
556
557 /* ----------------------
558  * Reset Statement
559  * ----------------------
560  */
561
562 typedef struct VariableResetStmt
563 {
564         NodeTag         type;
565         char       *name;
566 } VariableResetStmt;
567
568
569 /*****************************************************************************
570  *              Optimizable Statements
571  *****************************************************************************/
572
573 /* ----------------------
574  *              Insert Statement
575  * ----------------------
576  */
577 typedef struct InsertStmt
578 {
579         NodeTag         type;
580         char       *relname;            /* relation to insert into */
581         char       *unique;                     /* NULL, '*', or unique attribute name */
582         List       *cols;                       /* names of the columns */
583         List       *targetList;         /* the target list (of ResTarget) */
584         List       *fromClause;         /* the from clause */
585         Node       *whereClause;        /* qualifications */
586         List       *groupClause;        /* group by clause */
587         Node       *havingClause;       /* having conditional-expression */
588         List       *unionClause;        /* union subselect parameters */
589         bool            unionall;               /* union without unique sort */
590 } InsertStmt;
591
592 /* ----------------------
593  *              Delete Statement
594  * ----------------------
595  */
596 typedef struct DeleteStmt
597 {
598         NodeTag         type;
599         char       *relname;            /* relation to delete from */
600         Node       *whereClause;        /* qualifications */
601 } DeleteStmt;
602
603 /* ----------------------
604  *              Update Statement
605  * ----------------------
606  */
607 typedef struct UpdateStmt
608 {
609         NodeTag         type;
610         char       *relname;            /* relation to update */
611         List       *targetList;         /* the target list (of ResTarget) */
612         Node       *whereClause;        /* qualifications */
613         List       *fromClause;         /* the from clause */
614 } UpdateStmt;
615
616 /* ----------------------
617  *              Select Statement
618  * ----------------------
619  */
620 typedef struct SelectStmt
621 {
622         NodeTag         type;
623         char       *unique;                     /* NULL, '*', or unique attribute name */
624         char       *into;                       /* name of table (for select into table) */
625         List       *targetList;         /* the target list (of ResTarget) */
626         List       *fromClause;         /* the from clause */
627         Node       *whereClause;        /* qualifications */
628         List       *groupClause;        /* group by clause */
629         Node       *havingClause;       /* having conditional-expression */
630         List       *unionClause;        /* union subselect parameters */
631         List       *sortClause;         /* sort clause (a list of SortGroupBy's) */
632         char       *portalname;         /* the portal (cursor) to create */
633         bool            binary;                 /* a binary (internal) portal? */
634         bool            unionall;               /* union without unique sort */
635 } SelectStmt;
636
637
638 /****************************************************************************
639  *      Supporting data structures for Parse Trees
640  ****************************************************************************/
641
642 /*
643  * TypeName - specifies a type in definitions
644  */
645 typedef struct TypeName
646 {
647         NodeTag         type;
648         char       *name;                       /* name of the type */
649         bool            timezone;               /* timezone specified? */
650         bool            setof;                  /* is a set? */
651         int32           typmod;                 /* type modifier */
652         List       *arrayBounds;        /* array bounds */
653 } TypeName;
654
655 /*
656  * ParamNo - specifies a parameter reference
657  */
658 typedef struct ParamNo
659 {
660         NodeTag         type;
661         int                     number;                 /* the number of the parameter */
662         TypeName   *typename;           /* the typecast */
663 } ParamNo;
664
665 /*
666  * A_Expr - binary expressions
667  */
668 typedef struct A_Expr
669 {
670         NodeTag         type;
671         int                     oper;                   /* type of operation
672                                                                  * {OP,OR,AND,NOT,ISNULL,NOTNULL} */
673         char       *opname;                     /* name of operator/function */
674         Node       *lexpr;                      /* left argument */
675         Node       *rexpr;                      /* right argument */
676 } A_Expr;
677
678 /*
679  * Attr -
680  *        specifies an Attribute (ie. a Column); could have nested dots or
681  *        array references.
682  *
683  */
684 typedef struct Attr
685 {
686         NodeTag         type;
687         char       *relname;            /* name of relation (can be "*") */
688         ParamNo    *paramNo;            /* or a parameter */
689         List       *attrs;                      /* attributes (possibly nested); list of
690                                                                  * Values (strings) */
691         List       *indirection;        /* array refs (list of A_Indices') */
692 } Attr;
693
694 /*
695  * A_Const - a constant expression
696  */
697 typedef struct A_Const
698 {
699         NodeTag         type;
700         Value           val;                    /* the value (with the tag) */
701         TypeName   *typename;           /* typecast */
702 } A_Const;
703
704 /*
705  * ColumnDef - column definition (used in various creates)
706  */
707 typedef struct ColumnDef
708 {
709         NodeTag         type;
710         char       *colname;            /* name of column */
711         TypeName   *typename;           /* type of column */
712         bool            is_not_null;    /* flag to NOT NULL constraint */
713         char       *defval;                     /* default value of column */
714         List       *constraints;        /* constraints on column */
715 } ColumnDef;
716
717 /*
718  * Ident -
719  *        an identifier (could be an attribute or a relation name). Depending
720  *        on the context at transformStmt time, the identifier is treated as
721  *        either a relation name (in which case, isRel will be set) or an
722  *        attribute (in which case, it will be transformed into an Attr).
723  */
724 typedef struct Ident
725 {
726         NodeTag         type;
727         char       *name;                       /* its name */
728         List       *indirection;        /* array references */
729         bool            isRel;                  /* is a relation - filled in by
730                                                                  * transformExpr() */
731 } Ident;
732
733 /*
734  * FuncCall - a function/aggregate invocation
735  */
736 typedef struct FuncCall
737 {
738         NodeTag         type;
739         char       *funcname;           /* name of function */
740         List       *args;                       /* the arguments (list of exprs) */
741 } FuncCall;
742
743 /*
744  * A_Indices - array reference or bounds ([lidx:uidx] or [uidx])
745  */
746 typedef struct A_Indices
747 {
748         NodeTag         type;
749         Node       *lidx;                       /* could be NULL */
750         Node       *uidx;
751 } A_Indices;
752
753 /*
754  * ResTarget -
755  *        result target (used in target list of pre-transformed Parse trees)
756  */
757 typedef struct ResTarget
758 {
759         NodeTag         type;
760         char       *name;                       /* name of the result column */
761         List       *indirection;        /* array references */
762         Node       *val;                        /* the value of the result (A_Expr or
763                                                                  * Attr) (or A_Const) */
764 } ResTarget;
765
766 /*
767  * ParamString - used in with clauses
768  */
769 typedef struct ParamString
770 {
771         NodeTag         type;
772         char       *name;
773         char       *val;
774 } ParamString;
775
776 /*
777  * RelExpr - relation expressions
778  */
779 typedef struct RelExpr
780 {
781         NodeTag         type;
782         char       *relname;            /* the relation name */
783         bool            inh;                    /* inheritance query */
784 } RelExpr;
785
786 /*
787  * SortGroupBy - for order by clause
788  */
789 typedef struct SortGroupBy
790 {
791         NodeTag         type;
792         int                     resno;                  /* target number */
793         char       *range;
794         char       *name;                       /* name of column to sort on */
795         char       *useOp;                      /* operator to use */
796 } SortGroupBy;
797
798 /*
799  * RangeVar - range variable, used in from clauses
800  */
801 typedef struct RangeVar
802 {
803         NodeTag         type;
804         RelExpr    *relExpr;            /* the relation expression */
805         char       *name;                       /* the name to be referenced (optional) */
806 } RangeVar;
807
808 /*
809  * IndexElem - index parameters (used in create index)
810  */
811 typedef struct IndexElem
812 {
813         NodeTag         type;
814         char       *name;                       /* name of index */
815         List       *args;                       /* if not NULL, function index */
816         char       *class;
817         TypeName   *tname;                      /* type of index's keys (optional) */
818 } IndexElem;
819
820 /*
821  * DefElem -
822  *        a definition (used in definition lists in the form of defname = arg)
823  */
824 typedef struct DefElem
825 {
826         NodeTag         type;
827         char       *defname;
828         Node       *arg;                        /* a (Value *) or a (TypeName *) */
829 } DefElem;
830
831
832 /****************************************************************************
833  *      Nodes for a Query tree
834  ****************************************************************************/
835
836 /*
837  * TargetEntry -
838  *         a target  entry (used in the transformed target list)
839  *
840  * one of resdom or fjoin is not NULL. a target list is
841  *              ((<resdom | fjoin> expr) (<resdom | fjoin> expr) ...)
842  */
843 typedef struct TargetEntry
844 {
845         NodeTag         type;
846         Resdom     *resdom;                     /* fjoin overload this to be a list?? */
847         Fjoin      *fjoin;
848         Node       *expr;                       /* can be a list too */
849 } TargetEntry;
850
851 /*
852  * RangeTblEntry -
853  *        used in range tables. Some of the following are only used in one of
854  *        the parsing, optimizing, execution stages.
855  *
856  *        inFromCl marks those range variables that are listed in the from clause.
857  *        In SQL, the targetlist can only refer to range variables listed in the
858  *        from clause but POSTQUEL allows you to refer to tables not specified, in
859  *        which case a range table entry will be generated. We use POSTQUEL
860  *        semantics which is more powerful. However, we need SQL semantics in
861  *        some cases (eg. when expanding a '*')
862  */
863 typedef struct RangeTblEntry
864 {
865         NodeTag         type;
866         char       *relname;            /* real name of the relation */
867         char       *refname;            /* the reference name (specified in the
868                                                                  * from clause) */
869         Oid                     relid;
870         bool            inh;                    /* inheritance? */
871         bool            inFromCl;               /* comes from From Clause */
872         bool            skipAcl;                /* skip ACL check in executor */
873 } RangeTblEntry;
874
875 /*
876  * SortClause -
877  *         used in the sort clause for retrieves and cursors
878  */
879 typedef struct SortClause
880 {
881         NodeTag         type;
882         Resdom     *resdom;                     /* attributes in tlist to be sorted */
883         Oid                     opoid;                  /* sort operators */
884 } SortClause;
885
886 /*
887  * GroupClause -
888  *         used in the GROUP BY clause
889  */
890 typedef struct GroupClause
891 {
892         NodeTag         type;
893         TargetEntry *entry;                     /* attributes to group on */
894         Oid                     grpOpoid;               /* the sort operator to use */
895 } GroupClause;
896
897 #endif                                                  /* PARSENODES_H */