parsenodes.h 21.2 KB
Newer Older
1 2 3 4 5 6 7 8
/*-------------------------------------------------------------------------
 *
 * parsenodes.h--
 *    definitions for parse tree nodes
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
9
 * $Id: parsenodes.h,v 1.18 1997/08/20 01:12:38 vadim Exp $
10 11 12 13 14 15
 *
 *-------------------------------------------------------------------------
 */
#ifndef	PARSENODES_H
#define	PARSENODES_H

16 17
#include <utils/tqual.h>
#include <nodes/primnodes.h>
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138

/*****************************************************************************
 *  Query Tree 
 *****************************************************************************/

/*
 * Query -
 *    all statments are turned into a Query tree (via transformStmt)
 *    for further processing by the optimizer
 *    utility statements (i.e. non-optimizable statements)
 *    have the *utilityStmt field set.
 *
 * we need the isPortal flag because portal names can be null too; can
 * get rid of it if we support CURSOR as a commandType.
 *
 */
typedef struct Query {
    NodeTag 	type;
    
    CmdType 	commandType;	/* select|insert|update|delete|utility */
    
    Node  	*utilityStmt;   /* non-null if this is a non-optimizable
				   statement */
    
    int		resultRelation;	/* target relation (index to rtable) */
    char	*into;		/* portal (cursor) name */
    bool	isPortal;	/* is this a retrieve into portal? */
    bool	isBinary;	/* binary portal? */
    
    char  	*uniqueFlag;	/* NULL, '*', or Unique attribute name */
    List	*sortClause;	/* a list of SortClause's */
    
    List	*rtable;	/* list of range table entries */
    List	*targetList;	/* target list (of TargetEntry) */
    Node	*qual;		/* qualifications */

    List	*groupClause;	/* list of columns to specified in GROUP BY */
    Node	*havingQual;	/* qualification of each group */

    int		qry_numAgg;	/* number of aggregates in the target list */
    Aggreg	**qry_aggs;	/* the aggregates */
    
    /* internal to planner */
    List *base_relation_list_;	/* base relation list */
    List *join_relation_list_;	/* list of relations generated by joins */
    bool  query_is_archival_;	/* archival query flag */
} Query;


/*****************************************************************************
 *	Other Statements (no optimizations required)
 *
 *      Some of them require a little bit of transformation (which is also
 *      done by transformStmt). The whole structure is then passed on to
 *      ProcessUtility (by-passing the optimization step) as the utilityStmt
 *      field in Query.
 *****************************************************************************/

/* ----------------------
 *	Add Column Statement
 * ----------------------
 */
typedef struct AddAttrStmt {
    NodeTag		type;
    char		*relname;	/* the relation to add attr */
    bool		inh;		/* add recursively to children? */
    struct ColumnDef	*colDef;	/* the attribute definition */
} AddAttrStmt;

/* ----------------------
 *	Change ACL Statement
 * ----------------------
 */
typedef struct ChangeACLStmt {
    NodeTag		type;
    struct AclItem	*aclitem;
    unsigned		modechg;
    List		*relNames;
} ChangeACLStmt;

/* ----------------------
 *	Close Portal Statement
 * ----------------------
 */
typedef struct ClosePortalStmt {
    NodeTag		type;
    char		*portalname;	/* name of the portal (cursor) */
} ClosePortalStmt;

/* ----------------------
 *	Copy Statement
 * ----------------------
 */
typedef struct CopyStmt {
    NodeTag		type;
    bool		binary;		/* is a binary copy? */
    char		*relname;	/* the relation to copy */
    bool		oids;		/* copy oid's? */
    int			direction;	/* TO or FROM */
    char		*filename;	/* if NULL, use stdin/stdout */
    char                *delimiter;     /* delimiter character, \t by default*/
} CopyStmt;

/* ----------------------
 *	Create Table Statement
 * ----------------------
 */
typedef enum ArchType {
    ARCH_NONE, ARCH_LIGHT, ARCH_HEAVY	/* archive mode */
} ArchType;

typedef struct CreateStmt {
    NodeTag		type;
    char		*relname;	/* the relation to create */
    List		*tableElts;	/* column definitions
					   list of ColumnDef */
    List		*inhRelnames;	/* relations to inherit from
					   list of Value (string) */
    ArchType		archiveType;	/* archive mode (ARCH_NONE if none */
    int			location;	/* smgrid (-1 if none) */
    int			archiveLoc;	/* smgrid (-1 if none) */
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
139
    List		*check;		/* list of CHECK constr */
140 141
} CreateStmt;

Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
142 143 144 145 146 147 148 149 150 151 152
/* ----------------------
 *	Create SEQUENCE Statement
 * ----------------------
 */

typedef struct CreateSeqStmt {
    NodeTag		type;
    char		*seqname;	/* the relation to create */
    List		*options;
} CreateSeqStmt;

153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
/* ----------------------
 *	Create Version Statement
 * ----------------------
 */
typedef struct VersionStmt {
    NodeTag		type;
    char		*relname;	/* the new relation */
    int			direction;	/* FORWARD | BACKWARD */
    char		*fromRelname;	/* relation to create a version */
    char		*date;		/* date of the snapshot */
} VersionStmt;

/* ----------------------
 *	Create {Operator|Type|Aggregate} Statement
 * ----------------------
 */
typedef struct DefineStmt {
    NodeTag		type;
    int			defType;	/* OPERATOR|P_TYPE|AGGREGATE*/
    char		*defname;
    List		*definition;	/* a list of DefElem */
} DefineStmt;

/* ----------------------
 *	Drop Table Statement
 * ----------------------
 */
typedef struct DestroyStmt {
    NodeTag		type;
    List		*relNames;	/* relations to be dropped */
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
183
    bool		sequence;
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
} DestroyStmt;

/* ----------------------
 *	Extend Index Statement
 * ----------------------
 */
typedef struct ExtendStmt {
    NodeTag		type;
    char		*idxname;	/* name of the index */
    Node		*whereClause;	/* qualifications */
    List		*rangetable;	/* range table, filled in
					   by transformStmt() */
} ExtendStmt;

/* ----------------------
 *	Begin Recipe Statement
 * ----------------------
 */
typedef struct RecipeStmt {
    NodeTag		type;
    char		*recipeName;	/* name of the recipe*/
} RecipeStmt;

/* ----------------------
 *	Fetch Statement
 * ----------------------
 */
typedef struct FetchStmt {
    NodeTag		type;
    int			direction;	/* FORWARD or BACKWARD */
    int		        howMany;	/* amount to fetch ("ALL" --> 0) */
    char		*portalname;	/* name of portal (cursor) */
} FetchStmt;

/* ----------------------
 *	Create Index Statement
 * ----------------------
 */
typedef struct IndexStmt {
    NodeTag		type;
    char		*idxname;	/* name of the index */
    char		*relname;	/* name of relation to index on */
    char		*accessMethod;	/* name of acess methood (eg. btree) */
    List		*indexParams;	/* a list of IndexElem */
    List		*withClause;	/* a list of ParamString */
    Node		*whereClause;	/* qualifications */
    List		*rangetable;	/* range table, filled in
					   by transformStmt() */
    bool                *lossy;         /* is index lossy? */
233
    bool                unique;         /* is index unique? */
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
} IndexStmt;

/* ----------------------
 *	Move Statement (Not implemented)
 * ----------------------
 */
typedef struct MoveStmt {
    NodeTag		type;
    int			direction;	/* FORWARD or BACKWARD */
    bool		to;
    int			where;
    char		*portalname;
} MoveStmt;

/* ----------------------
 *	Create Function Statement
 * ----------------------
 */
typedef struct ProcedureStmt {
    NodeTag		type;
    char		*funcname;	/* name of function to create */
    List		*defArgs;	/* list of definitions
					   a list of strings (as Value *) */
    Node		*returnType;	/* the return type (as a string or
					   a TypeName (ie.setof) */
    List		*withClause;	/* a list of ParamString */
    char		*as;		/* the SQL statement or filename */
    char		*language;	/* C or SQL */
} ProcedureStmt;

/* ----------------------
 *	Purge Statement
 * ----------------------
 */
typedef struct PurgeStmt {
    NodeTag		type;
    char		*relname;	/* relation to purge */
    char		*beforeDate;	/* purge before this date */
    char		*afterDate;	/* purge after this date */
} PurgeStmt;

275 276 277 278 279 280 281 282 283 284
/* ----------------------
 *	Drop Aggregate Statement
 * ----------------------
 */
typedef struct RemoveAggrStmt {
    NodeTag		type;
    char		*aggname;	/* aggregate to drop */
    char		*aggtype;	/* for this type */
} RemoveAggrStmt;

285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
/* ----------------------
 *	Drop Function Statement
 * ----------------------
 */
typedef struct RemoveFuncStmt {
    NodeTag		type;
    char		*funcname;	/* function to drop */
    List		*args;		/* types of the arguments */
} RemoveFuncStmt;

/* ----------------------
 *	Drop Operator Statement
 * ----------------------
 */
typedef struct RemoveOperStmt {
    NodeTag		type;
    char		*opname;	/* operator to drop */
    List		*args;		/* types of the arguments */
} RemoveOperStmt;

/* ----------------------
306
 *	Drop {Type|Index|Rule|View} Statement
307 308 309 310
 * ----------------------
 */
typedef struct RemoveStmt {
    NodeTag		type;
311
    int 		removeType;	/* P_TYPE|INDEX|RULE|VIEW */
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
    char		*name;		/* name to drop */
} RemoveStmt;

/* ----------------------
 *	Alter Table Statement
 * ----------------------
 */
typedef struct RenameStmt {
    NodeTag		type;
    char		*relname;	/* relation to be altered */
    bool		inh;		/* recursively alter children? */
    char		*column;	/* if NULL, rename the relation name
					   to the new name. Otherwise, rename
					   this column name. */
    char		*newname;	/* the new name */
} RenameStmt;

/* ----------------------
 *	Create Rule Statement
 * ----------------------
 */
typedef struct RuleStmt {
    NodeTag		type;
    char		*rulename;	/* name of the rule */
    Node		*whereClause;	/* qualifications */
    CmdType		event;		/* RETRIEVE */
    struct Attr		*object;	/* object affected */
    bool		instead;	/* is a 'do instead'? */
    List		*actions;	/* the action statements */
} RuleStmt;

/* ----------------------
 *	Notify Statement
 * ----------------------
 */
typedef struct NotifyStmt {
    NodeTag		type;
    char		*relname;	/* relation to notify */
} NotifyStmt;

/* ----------------------
 *	Listen Statement
 * ----------------------
 */
typedef struct ListenStmt {
    NodeTag		type;
    char		*relname;	/* relation to listen on */
} ListenStmt;

/* ----------------------
 *	{Begin|Abort|End} Transaction Statement
 * ----------------------
 */
typedef struct TransactionStmt {
    NodeTag		type;
    int			command;	/* BEGIN|END|ABORT */
} TransactionStmt;

/* ----------------------
 *	Create View Statement
 * ----------------------
 */
typedef struct ViewStmt {
    NodeTag		type;
    char		*viewname;	/* name of the view */
    Query		*query;		/* the SQL statement */
} ViewStmt;

/* ----------------------
 *	Load Statement
 * ----------------------
 */
typedef struct LoadStmt {
    NodeTag		type;
    char		*filename;	/* file to load */
} LoadStmt;

/* ----------------------
 *	Createdb Statement
 * ----------------------
 */
typedef struct CreatedbStmt {
    NodeTag		type;
    char		*dbname;	/* database to create */
} CreatedbStmt;

/* ----------------------
 *	Destroydb Statement
 * ----------------------
 */
typedef struct DestroydbStmt {
    NodeTag		type;
    char		*dbname;	/* database to drop */
} DestroydbStmt;

/* ----------------------
 *	Cluster Statement (support pbrown's cluster index implementation)
 * ----------------------
 */
typedef struct ClusterStmt {
    NodeTag		type;
    char		*relname;	/* relation being indexed */
    char		*indexname;	/* original index defined */
} ClusterStmt;

/* ----------------------
 *	Vacuum Statement
 * ----------------------
 */
typedef struct VacuumStmt {
    NodeTag		type;
423
    bool		verbose;	/* print status info */
424
    bool		analyze;	/* analyze data */
425
    char		*vacrel;	/* table to vacuum */
426
    List		*va_spec;	/* columns to analyse */
427 428 429 430 431 432 433 434 435
} VacuumStmt;

/* ----------------------
 *	Explain Statement
 * ----------------------
 */
typedef struct ExplainStmt {
    NodeTag		type;
    Query		*query;		/* the query */
436
    bool		verbose;	/* print plan info */
437 438
} ExplainStmt;

439 440 441 442 443 444 445 446 447
/* ----------------------
 * Set Statement
 * ----------------------
 */

typedef struct VariableSetStmt {
	NodeTag	type;
	char	*name;
	char	*value;
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
} VariableSetStmt;

/* ----------------------
 * Show Statement
 * ----------------------
 */

typedef struct VariableShowStmt {
	NodeTag	type;
	char	*name;
} VariableShowStmt;

/* ----------------------
 * Reset Statement
 * ----------------------
 */

typedef struct VariableResetStmt {
	NodeTag	type;
	char	*name;
} VariableResetStmt;
469

470 471 472 473 474 475 476 477 478 479 480 481 482

/*****************************************************************************
 *	Optimizable Statements
 *****************************************************************************/

/* ----------------------
 *	Insert Statement
 * ----------------------
 */
typedef struct AppendStmt {
    NodeTag		type;
    char		*relname;	/* relation to insert into */
    List		*cols;		/* names of the columns */
Bruce Momjian's avatar
Bruce Momjian committed
483
    List		*targetList;	/* the target list (of ResTarget) */
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
    List		*fromClause;	/* the from clause */
    Node		*whereClause;	/* qualifications */
} AppendStmt;

/* ----------------------
 *	Delete Statement
 * ----------------------
 */
typedef struct DeleteStmt {
    NodeTag		type;
    char		*relname;	/* relation to delete from */
    Node		*whereClause;	/* qualifications */
} DeleteStmt;

/* ----------------------
 *	Update Statement
 * ----------------------
 */
typedef struct ReplaceStmt {
    NodeTag		type;
    char		*relname;	/* relation to update */
    List		*targetList;	/* the target list (of ResTarget) */
    Node		*whereClause;	/* qualifications */
    List		*fromClause;	/* the from clause */
} ReplaceStmt;

/* ----------------------
 *	Create Cursor Statement
 * ----------------------
 */
typedef struct CursorStmt {
    NodeTag		type;
    char		*portalname;	/* the portal (cursor) to create */
    bool		binary;		/* a binary (internal) portal? */
    char		*unique;	/* NULL, "*", or unique attribute name */
    List		*targetList;	/* the target list (of ResTarget) */
    List		*fromClause;	/* the from clause */
    Node		*whereClause;	/* qualifications */
    List              *groupClause;   /* group by clause */
523
    List		*sortClause;	/* sort clause (a list of SortGroupBy's) */
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
} CursorStmt;    

/* ----------------------
 *	Select Statement
 * ----------------------
 */
typedef struct RetrieveStmt {
    NodeTag		type;
    char                *unique;  /* NULL, '*', or unique attribute name */
    char		*into;		/* name of table (for select into
					   table) */
    List		*targetList;	/* the target list (of ResTarget) */
    List		*fromClause;	/* the from clause */
    Node		*whereClause;	/* qualifications */
    List		*groupClause;	/* group by clause */
    Node		*havingClause;	/* having conditional-expression */
540
    List		*sortClause;	/* sort clause (a list of SortGroupBy's) */
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
} RetrieveStmt;    


/****************************************************************************
 *  Supporting data structures for Parse Trees
 ****************************************************************************/

/*
 * TypeName - specifies a type in definitions
 */
typedef struct TypeName {
    NodeTag		type;
    char		*name;		/* name of the type */
    bool		setof;		/* is a set? */
    List		*arrayBounds;	/* array bounds */
    int			typlen;		/* length for char() and varchar() */
} TypeName;

/*
 * ParamNo - specifies a parameter reference
 */
typedef struct ParamNo {
    NodeTag		type;
    int			number;		/* the number of the parameter */
    TypeName		*typename;	/* the typecast */
} ParamNo;

/*
 * A_Expr - binary expressions
 */
typedef struct A_Expr {
    NodeTag		type;
    int			oper;		/* type of operation
					   {OP,OR,AND,NOT,ISNULL,NOTNULL} */
    char		*opname;	/* name of operator/function */
    Node		*lexpr;		/* left argument */
    Node		*rexpr;		/* right argument */
} A_Expr;

/*
 * Attr -
 *    specifies an Attribute (ie. a Column); could have nested dots or
 *    array references.
 *
 */
typedef struct Attr {
    NodeTag		type;
    char 		*relname;	/* name of relation (can be "*") */
    ParamNo		*paramNo;	/* or a parameter */
    List		*attrs;		/* attributes (possibly nested);
					   list of Values (strings) */
    List		*indirection;	/* array refs (list of A_Indices') */
} Attr;

/*
 * A_Const - a constant expression
 */
typedef struct A_Const {
    NodeTag		type;
    Value		val;		/* the value (with the tag) */
    TypeName		*typename;	/* typecast */
} A_Const;

/*
 * ColumnDef - column definition (used in various creates)
 */
typedef struct ColumnDef {
    NodeTag		type;
    char		*colname;	/* name of column */
    TypeName		*typename;	/* type of column */
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
611 612
    bool		is_not_null;	/* flag to NOT NULL constraint */
    char		*defval;	/* default value of column */
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656
} ColumnDef;

/*
 * Ident - 
 *    an identifier (could be an attribute or a relation name). Depending
 *    on the context at transformStmt time, the identifier is treated as
 *    either a relation name (in which case, isRel will be set) or an
 *    attribute (in which case, it will be transformed into an Attr).
 */
typedef struct Ident {
    NodeTag		type;
    char		*name;		/* its name */
    List		*indirection;	/* array references */
    bool		isRel;		/* is a relation - filled in by
					   transformExpr() */
} Ident;

/*
 * FuncCall - a function/aggregate invocation
 */
typedef struct FuncCall {
    NodeTag		type;
    char		*funcname;	/* name of function */
    List		*args;		/* the arguments (list of exprs) */
} FuncCall;

/*
 * A_Indices - array reference or bounds ([lidx:uidx] or [uidx])
 */
typedef struct A_Indices {
    NodeTag		type;
    Node		*lidx;		/* could be NULL */
    Node		*uidx;
} A_Indices;

/*
 * ResTarget - 
 *    result target (used in target list of pre-transformed Parse trees)
 */
typedef struct ResTarget {
    NodeTag		type;
    char		*name;		/* name of the result column */
    List		*indirection;	/* array references */
    Node		*val;		/* the value of the result
657
					   (A_Expr or Attr) (or A_Const) */
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688
} ResTarget;

/*
 * ParamString - used in with clauses
 */
typedef struct ParamString {
    NodeTag		type;
    char		*name;
    char		*val;
} ParamString;

/*
 * TimeRange - specifies a time range
 */
typedef struct TimeRange {
    NodeTag		type;
    char		*startDate;
    char		*endDate;	/* snapshot if NULL */
} TimeRange;

/*
 * RelExpr - relation expressions
 */
typedef struct RelExpr {
    NodeTag		type;
    char		*relname;	/* the relation name */
    bool		inh;		/* inheritance query */
    TimeRange		*timeRange;	/* the time range */
} RelExpr;

/*
689
 * SortGroupBy - for order by clause
690
 */
691
typedef struct SortGroupBy {
692
    NodeTag		type;
693
    int			resno;		/* target number */
694 695 696
    char                *range;
    char		*name;		/* name of column to sort on */
    char		*useOp;		/* operator to use */
697
} SortGroupBy;
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789

/*
 * RangeVar - range variable, used in from clauses
 */
typedef struct RangeVar {
    NodeTag		type;
    RelExpr		*relExpr;	/* the relation expression */
    char		*name;		/* the name to be referenced
					   (optional) */
} RangeVar;

/*
 * IndexElem - index parameters (used in create index)
 */
typedef struct IndexElem {
    NodeTag		type;
    char		*name;		/* name of index */
    List		*args;		/* if not NULL, function index */
    char 		*class;
    TypeName            *tname;         /* type of index's keys (optional) */
} IndexElem;

/*
 * DefElem -
 *    a definition (used in definition lists in the form of defname = arg)
 */
typedef struct DefElem {
    NodeTag		type;
    char		*defname;	
    Node		*arg;		/* a (Value *) or a (TypeName *) */
} DefElem;


/****************************************************************************
 *  Nodes for a Query tree
 ****************************************************************************/

/*
 * TargetEntry -
 *     a target  entry (used in the transformed target list)
 *
 * one of resdom or fjoin is not NULL. a target list is
 *	((<resdom | fjoin> expr) (<resdom | fjoin> expr) ...)
 */
typedef struct TargetEntry {
    NodeTag		type;
    Resdom		*resdom;	/* fjoin overload this to be a list??*/
    Fjoin		*fjoin;	
    Node		*expr;		/* can be a list too */
} TargetEntry;

/*
 * RangeTblEntry -
 *    used in range tables. Some of the following are only used in one of
 *    the parsing, optimizing, execution stages.
 *
 *    inFromCl marks those range variables that are listed in the from clause.
 *    In SQL, the targetlist can only refer to range variables listed in the
 *    from clause but POSTQUEL allows you to refer to tables not specified, in
 *    which case a range table entry will be generated. We use POSTQUEL
 *    semantics which is more powerful. However, we need SQL semantics in
 *    some cases (eg. when expanding a '*')
 */
typedef struct RangeTblEntry {
    NodeTag		type;
    char                *relname;	/* real name of the relation */
    TimeRange		*timeRange;	/* time range */
    char		*refname;	/* the reference name (specified in
					   the from clause) */
    Oid			relid;		
    bool		inh;		/* inheritance? */
    bool		archive;	/* filled in by plan_archive */
    bool		inFromCl;	/* comes from From Clause */
    TimeQual		timeQual;	/* filled in by pg_plan */
} RangeTblEntry;

/*
 * SortClause -
 *     used in the sort clause for retrieves and cursors
 */
typedef struct SortClause {
    NodeTag		type;
    Resdom		*resdom;	/* attributes in tlist to be sorted */
    Oid			opoid;		/* sort operators */
} SortClause;

/*
 * GroupClause -
 *     used in the GROUP BY clause
 */
typedef struct GroupClause {
    NodeTag		type;
790
    TargetEntry		*entry;		/* attributes to group on */
791 792 793 794
    Oid			grpOpoid;	/* the sort operator to use */
} GroupClause;

#endif	/* PARSENODES_H */