parsenodes.h 37.8 KB
Newer Older
1 2
/*-------------------------------------------------------------------------
 *
3
 * parsenodes.h
4
 *	  definitions for parse tree nodes
5 6
 *
 *
7
 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
B
Add:  
Bruce Momjian 已提交
8
 * Portions Copyright (c) 1994, Regents of the University of California
9
 *
10
 * $Id: parsenodes.h,v 1.150 2001/11/05 05:00:14 tgl Exp $
11 12 13
 *
 *-------------------------------------------------------------------------
 */
14 15
#ifndef PARSENODES_H
#define PARSENODES_H
16

17
#include "nodes/primnodes.h"
18 19

/*****************************************************************************
20
 *	Query Tree
21 22 23 24
 *****************************************************************************/

/*
 * Query -
25 26 27 28
 *	  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.
29 30 31 32
 *
 * we need the isPortal flag because portal names can be null too; can
 * get rid of it if we support CURSOR as a commandType.
 */
33 34
typedef struct Query
{
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 41
								 * statement */

42
	int			resultRelation; /* target relation (index into rtable) */
43 44 45
	char	   *into;			/* portal (cursor) name */
	bool		isPortal;		/* is this a retrieve into portal? */
	bool		isBinary;		/* binary portal? */
46
	bool		isTemp;			/* is 'into' a temp table? */
47

48
	bool		hasAggs;		/* has aggregates in tlist or havingQual */
49
	bool		hasSubLinks;	/* has subquery SubLink */
50

51
	List	   *rtable;			/* list of range table entries */
B
Bruce Momjian 已提交
52 53
	FromExpr   *jointree;		/* table join tree (FROM and WHERE
								 * clauses) */
54

55 56
	List	   *rowMarks;		/* integer list of RT indexes of relations
								 * that are selected FOR UPDATE */
57

58
	List	   *targetList;		/* target list (of TargetEntry) */
59

60 61 62
	List	   *groupClause;	/* a list of GroupClause's */

	Node	   *havingQual;		/* qualifications applied to groups */
B
Hi!  
Bruce Momjian 已提交
63

64 65 66
	List	   *distinctClause; /* a list of SortClause's */

	List	   *sortClause;		/* a list of SortClause's */
67

B
Bruce Momjian 已提交
68 69
	Node	   *limitOffset;	/* # of result tuples to skip */
	Node	   *limitCount;		/* # of result tuples to return */
B
Bruce Momjian 已提交
70

71 72 73
	Node	   *setOperations;	/* set-operation tree if this is top level
								 * of a UNION/INTERSECT/EXCEPT query */

74 75 76 77 78 79 80 81
	/*
	 * If the resultRelation turns out to be the parent of an inheritance
	 * tree, the planner will add all the child tables to the rtable and
	 * store a list of the rtindexes of all the result relations here.
	 * This is done at plan time, not parse time, since we don't want to
	 * commit to the exact set of child tables at parse time.  This field
	 * ought to go in some sort of TopPlan plan node, not in the Query.
	 */
82
	List	   *resultRelations;	/* integer list of RT indexes, or NIL */
83

84
	/* internal to planner */
85
	List	   *base_rel_list;	/* list of base-relation RelOptInfos */
86
	List	   *other_rel_list; /* list of other 1-relation RelOptInfos */
87
	List	   *join_rel_list;	/* list of join-relation RelOptInfos */
88 89
	List	   *equi_key_list;	/* list of lists of equijoined
								 * PathKeyItems */
90
	List	   *query_pathkeys; /* pathkeys for query_planner()'s result */
91
} Query;
92 93


94 95
typedef enum InhOption
{
96 97 98
	INH_NO,						/* Do NOT scan child tables */
	INH_YES,					/* DO scan child tables */
	INH_DEFAULT					/* Use current SQL_inheritance option */
99 100
} InhOption;

101
/*****************************************************************************
102
 *		Other Statements (no optimizations required)
103
 *
104 105 106 107
 *		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.
108 109 110
 *****************************************************************************/

/* ----------------------
111
 *	Alter Table
112 113 114
 *
 * The fields are used in different ways by the different variants of
 * this command.
115 116
 * ----------------------
 */
117
typedef struct AlterTableStmt
118
{
119
	NodeTag		type;
120
	char		subtype;		/*------------
121
								 *	A = add column
122 123
								 *	T = alter column default
								 *	S = alter column statistics
124 125 126
								 *	D = drop column
								 *	C = add constraint
								 *	X = drop constraint
127
								 *	E = create toast table
128 129 130
								 *	U = change owner
								 *------------
								 */
131
	char	   *relname;		/* table to work on */
132
	InhOption	inhOpt;			/* recursively act on children? */
B
Bruce Momjian 已提交
133 134
	char	   *name;			/* column or constraint name to act on, or
								 * new owner */
135 136
	Node	   *def;			/* definition of new column or constraint */
	int			behavior;		/* CASCADE or RESTRICT drop behavior */
137
} AlterTableStmt;
138 139

/* ----------------------
140
 *		Grant Statement
141 142
 * ----------------------
 */
143 144 145 146 147 148 149 150 151 152 153 154

typedef struct GrantStmt
{
	NodeTag		type;
	bool		is_grant;		/* not revoke */
	List	   *relnames;
	char	   *privileges;
	List	   *grantees;
} GrantStmt;


typedef struct PrivGrantee
155
{
156
	NodeTag		type;
157 158 159 160
	char	   *username;		/* if both are NULL then PUBLIC */
	char	   *groupname;
} PrivGrantee;

161 162

/* ----------------------
163
 *		Close Portal Statement
164 165
 * ----------------------
 */
166 167
typedef struct ClosePortalStmt
{
168 169
	NodeTag		type;
	char	   *portalname;		/* name of the portal (cursor) */
170
} ClosePortalStmt;
171 172

/* ----------------------
173
 *		Copy Statement
174 175
 * ----------------------
 */
176 177
typedef struct CopyStmt
{
178 179 180 181 182 183 184
	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 */
185
	char	   *null_print;		/* how to print NULLs, `\N' by default */
186
} CopyStmt;
187 188

/* ----------------------
189
 *		Create Table Statement
190 191 192 193 194 195
 *
 * NOTE: in the raw gram.y output, ColumnDef, Constraint, and FkConstraint
 * nodes are intermixed in tableElts, and constraints is NIL.  After parse
 * analysis, tableElts contains just ColumnDefs, and constraints contains
 * just Constraint nodes (in fact, only CONSTR_CHECK nodes, in the present
 * implementation).
196 197
 * ----------------------
 */
198 199
typedef struct CreateStmt
{
200
	NodeTag		type;
201 202 203 204
	char	   *relname;		/* name of relation to create */
	List	   *tableElts;		/* column definitions (list of ColumnDef) */
	List	   *inhRelnames;	/* relations to inherit from (list of
								 * T_String Values) */
205
	List	   *constraints;	/* constraints (list of Constraint nodes) */
206 207
	bool		istemp;			/* is this a temp table? */
	bool		hasoids;		/* should it have OIDs? */
208
} CreateStmt;
209

210 211 212 213 214
/* ----------
 * Definitions for plain (non-FOREIGN KEY) constraints in CreateStmt
 *
 * XXX probably these ought to be unified with FkConstraints at some point?
 *
215 216 217 218 219 220
 * For constraints that use expressions (CONSTR_DEFAULT, CONSTR_CHECK)
 * we may have the expression in either "raw" form (an untransformed
 * parse tree) or "cooked" form (the nodeToString representation of
 * an executable expression tree), depending on how this Constraint
 * node was created (by parsing, or by inheritance from an existing
 * relation).  We should never have both in the same node!
221 222 223 224 225 226
 *
 * Constraint attributes (DEFERRABLE etc) are initially represented as
 * separate Constraint nodes for simplicity of parsing.  analyze.c makes
 * a pass through the constraints list to attach the info to the appropriate
 * FkConstraint node (and, perhaps, someday to other kinds of constraints).
 * ----------
227 228
 */

229 230
typedef enum ConstrType			/* types of constraints */
{
231
	CONSTR_NULL,				/* not SQL92, but a lot of people expect
232
								 * it */
233 234 235 236 237 238 239 240 241
	CONSTR_NOTNULL,
	CONSTR_DEFAULT,
	CONSTR_CHECK,
	CONSTR_PRIMARY,
	CONSTR_UNIQUE,
	CONSTR_ATTR_DEFERRABLE,		/* attributes for previous constraint node */
	CONSTR_ATTR_NOT_DEFERRABLE,
	CONSTR_ATTR_DEFERRED,
	CONSTR_ATTR_IMMEDIATE
242 243
} ConstrType;

244
typedef struct Constraint
245
{
246 247
	NodeTag		type;
	ConstrType	contype;
248 249 250
	char	   *name;			/* name, or NULL if unnamed */
	Node	   *raw_expr;		/* expr, as untransformed parse tree */
	char	   *cooked_expr;	/* expr, as nodeToString representation */
T
Tom Lane 已提交
251
	List	   *keys;			/* Ident nodes naming referenced column(s) */
252
} Constraint;
253

J
Jan Wieck 已提交
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273

/* ----------
 * Definitions for FOREIGN KEY constraints in CreateStmt
 * ----------
 */
#define FKCONSTR_ON_KEY_NOACTION		0x0000
#define FKCONSTR_ON_KEY_RESTRICT		0x0001
#define FKCONSTR_ON_KEY_CASCADE			0x0002
#define FKCONSTR_ON_KEY_SETNULL			0x0004
#define FKCONSTR_ON_KEY_SETDEFAULT		0x0008

#define FKCONSTR_ON_DELETE_MASK			0x000F
#define FKCONSTR_ON_DELETE_SHIFT		0

#define FKCONSTR_ON_UPDATE_MASK			0x00F0
#define FKCONSTR_ON_UPDATE_SHIFT		4

typedef struct FkConstraint
{
	NodeTag		type;
274 275 276 277 278 279 280 281
	char	   *constr_name;	/* Constraint name */
	char	   *pktable_name;	/* Primary key table name */
	List	   *fk_attrs;		/* Attributes of foreign key */
	List	   *pk_attrs;		/* Corresponding attrs in PK table */
	char	   *match_type;		/* FULL or PARTIAL */
	int32		actions;		/* ON DELETE/UPDATE actions */
	bool		deferrable;		/* DEFERRABLE */
	bool		initdeferred;	/* INITIALLY DEFERRED */
J
Jan Wieck 已提交
282 283 284
} FkConstraint;


285
/* ----------------------
286
 *		Create/Drop TRIGGER Statements
287 288 289
 * ----------------------
 */

290 291
typedef struct CreateTrigStmt
{
292 293 294 295 296 297 298 299
	NodeTag		type;
	char	   *trigname;		/* TRIGGER' name */
	char	   *relname;		/* triggered relation */
	char	   *funcname;		/* function to call (or NULL) */
	List	   *args;			/* list of (T_String) Values or NULL */
	bool		before;			/* BEFORE/AFTER */
	bool		row;			/* ROW/STATEMENT */
	char		actions[4];		/* Insert, Update, Delete */
300
	char	   *lang;			/* currently not used, always NULL */
301 302 303
	char	   *text;			/* AS 'text' */
	List	   *attr;			/* UPDATE OF a, b,... (NI) or NULL */
	char	   *when;			/* WHEN 'a > 10 ...' (NI) or NULL */
304

305 306
	/* The following are used for referential */
	/* integrity constraint triggers */
307 308 309 310
	bool		isconstraint;	/* This is an RI trigger */
	bool		deferrable;		/* [NOT] DEFERRABLE */
	bool		initdeferred;	/* INITIALLY {DEFERRED|IMMEDIATE} */
	char	   *constrrelname;	/* opposite relation */
311
} CreateTrigStmt;
312

313 314
typedef struct DropTrigStmt
{
315 316 317
	NodeTag		type;
	char	   *trigname;		/* TRIGGER' name */
	char	   *relname;		/* triggered relation */
318
} DropTrigStmt;
319 320 321 322 323 324 325 326 327 328 329 330 331


/* ----------------------
 *		Create/Drop PROCEDURAL LANGUAGE Statement
 * ----------------------
 */
typedef struct CreatePLangStmt
{
	NodeTag		type;
	char	   *plname;			/* PL name */
	char	   *plhandler;		/* PL call handler function */
	char	   *plcompiler;		/* lancompiler text */
	bool		pltrusted;		/* PL is trusted */
332
} CreatePLangStmt;
333 334 335 336 337

typedef struct DropPLangStmt
{
	NodeTag		type;
	char	   *plname;			/* PL name */
338
} DropPLangStmt;
339

340

341
/* ----------------------
342
 *				Create/Alter/Drop User Statements
343 344 345 346
 * ----------------------
 */
typedef struct CreateUserStmt
{
347
	NodeTag		type;
348 349
	char	   *user;			/* PostgreSQL user login name */
	List	   *options;		/* List of DefElem nodes */
350 351
} CreateUserStmt;

352 353 354
typedef struct AlterUserStmt
{
	NodeTag		type;
355 356
	char	   *user;			/* PostgreSQL user login name */
	List	   *options;		/* List of DefElem nodes */
357
} AlterUserStmt;
358 359 360

typedef struct DropUserStmt
{
361
	NodeTag		type;
362
	List	   *users;			/* List of users to remove */
363 364 365
} DropUserStmt;


366
/* ----------------------
367
 *		Create/Alter/Drop Group Statements
368 369 370 371
 * ----------------------
 */
typedef struct CreateGroupStmt
{
372 373
	NodeTag		type;
	char	   *name;			/* name of the new group */
374
	List	   *options;		/* List of DefElem nodes */
375 376 377 378
} CreateGroupStmt;

typedef struct AlterGroupStmt
{
379 380 381 382
	NodeTag		type;
	char	   *name;			/* name of group to alter */
	int			action;			/* +1 = add, -1 = drop user */
	List	   *listUsers;		/* list of users to add/drop */
383 384 385 386
} AlterGroupStmt;

typedef struct DropGroupStmt
{
387 388
	NodeTag		type;
	char	   *name;
389 390 391
} DropGroupStmt;


V
Vadim B. Mikheev 已提交
392
/* ----------------------
393
 *		Create SEQUENCE Statement
V
Vadim B. Mikheev 已提交
394 395 396
 * ----------------------
 */

397 398
typedef struct CreateSeqStmt
{
399 400
	NodeTag		type;
	char	   *seqname;		/* the relation to create */
401
	bool		istemp;			/* is this a temp sequence? */
402
	List	   *options;
403
} CreateSeqStmt;
V
Vadim B. Mikheev 已提交
404

405
/* ----------------------
406
 *		Create Version Statement
407 408
 * ----------------------
 */
409 410
typedef struct VersionStmt
{
411 412 413 414 415
	NodeTag		type;
	char	   *relname;		/* the new relation */
	int			direction;		/* FORWARD | BACKWARD */
	char	   *fromRelname;	/* relation to create a version */
	char	   *date;			/* date of the snapshot */
416
} VersionStmt;
417 418

/* ----------------------
419
 *		Create {Operator|Type|Aggregate} Statement
420 421
 * ----------------------
 */
422 423
typedef struct DefineStmt
{
424 425 426 427
	NodeTag		type;
	int			defType;		/* OPERATOR|P_TYPE|AGGREGATE */
	char	   *defname;
	List	   *definition;		/* a list of DefElem */
428
} DefineStmt;
429

430

431
/* ----------------------
432
 *		Drop Table|Sequence|View|Index|Rule|Type Statement
433 434
 * ----------------------
 */
435

B
Bruce Momjian 已提交
436
#define DROP_TABLE	  1
437
#define DROP_SEQUENCE 2
B
Bruce Momjian 已提交
438 439 440
#define DROP_VIEW	  3
#define DROP_INDEX	  4
#define DROP_RULE	  5
441 442
#define DROP_TYPE_P   6

443
typedef struct DropStmt
444
{
445
	NodeTag		type;
446 447
	List	   *names;
	int			removeType;
448
} DropStmt;
449

450
/* ----------------------
451
 *				Truncate Table Statement
452 453 454 455
 * ----------------------
 */
typedef struct TruncateStmt
{
456 457
	NodeTag		type;
	char	   *relName;		/* relation to be truncated */
458
} TruncateStmt;
459 460

/* ----------------------
461
 *				Comment On Statement
462 463 464 465
 * ----------------------
 */
typedef struct CommentStmt
{
466 467 468 469 470 471
	NodeTag		type;
	int			objtype;		/* Object's type */
	char	   *objname;		/* Name of the object */
	char	   *objproperty;	/* Property Id (such as column) */
	List	   *objlist;		/* Arguments for VAL objects */
	char	   *comment;		/* The comment to insert */
472
} CommentStmt;
473

474
/* ----------------------
475
 *		Begin Recipe Statement
476 477
 * ----------------------
 */
478 479
typedef struct RecipeStmt
{
480 481
	NodeTag		type;
	char	   *recipeName;		/* name of the recipe */
482
} RecipeStmt;
483 484

/* ----------------------
485
 *		Fetch Statement
486 487
 * ----------------------
 */
488 489
typedef struct FetchStmt
{
490 491 492 493
	NodeTag		type;
	int			direction;		/* FORWARD or BACKWARD */
	int			howMany;		/* amount to fetch ("ALL" --> 0) */
	char	   *portalname;		/* name of portal (cursor) */
494
	bool		ismove;			/* TRUE if MOVE */
495
} FetchStmt;
496 497

/* ----------------------
498
 *		Create Index Statement
499 500
 * ----------------------
 */
501 502
typedef struct IndexStmt
{
503 504 505
	NodeTag		type;
	char	   *idxname;		/* name of the index */
	char	   *relname;		/* name of relation to index on */
506
	char	   *accessMethod;	/* name of access method (eg. btree) */
507
	List	   *indexParams;	/* a list of IndexElem */
508 509
	Node	   *whereClause;	/* qualification (partial-index predicate) */
	List	   *rangetable;		/* range table for qual, filled in by
510
								 * transformStmt() */
511
	bool		unique;			/* is index unique? */
512
	bool		primary;		/* is index on primary key? */
513
} IndexStmt;
514 515

/* ----------------------
516
 *		Create Function Statement
517 518
 * ----------------------
 */
519 520
typedef struct ProcedureStmt
{
521
	NodeTag		type;
522
	bool		replace;		/* T => replace if already exists */
523
	char	   *funcname;		/* name of function to create */
524 525
	List	   *argTypes;		/* list of argument types (TypeName nodes) */
	Node	   *returnType;		/* the return type (a TypeName node) */
526
	List	   *withClause;		/* a list of DefElem */
527 528
	List	   *as;				/* definition of function body */
	char	   *language;		/* C, SQL, etc */
529
} ProcedureStmt;
530

531
/* ----------------------
532
 *		Drop Aggregate Statement
533 534
 * ----------------------
 */
535 536
typedef struct RemoveAggrStmt
{
537 538
	NodeTag		type;
	char	   *aggname;		/* aggregate to drop */
539
	Node	   *aggtype;		/* TypeName for input datatype, or NULL */
540
} RemoveAggrStmt;
541

542
/* ----------------------
543
 *		Drop Function Statement
544 545
 * ----------------------
 */
546 547
typedef struct RemoveFuncStmt
{
548 549 550
	NodeTag		type;
	char	   *funcname;		/* function to drop */
	List	   *args;			/* types of the arguments */
551
} RemoveFuncStmt;
552 553

/* ----------------------
554
 *		Drop Operator Statement
555 556
 * ----------------------
 */
557 558
typedef struct RemoveOperStmt
{
559 560 561
	NodeTag		type;
	char	   *opname;			/* operator to drop */
	List	   *args;			/* types of the arguments */
562
} RemoveOperStmt;
563 564

/* ----------------------
565
 *		Alter Table Statement
566 567
 * ----------------------
 */
568 569
typedef struct RenameStmt
{
570 571
	NodeTag		type;
	char	   *relname;		/* relation to be altered */
572
	InhOption	inhOpt;			/* recursively act on children? */
573
	char	   *column;			/* if NULL, rename the relation name to
574 575
								 * the new name. Otherwise, rename this
								 * column name. */
576
	char	   *newname;		/* the new name */
577
} RenameStmt;
578 579

/* ----------------------
580
 *		Create Rule Statement
581 582
 * ----------------------
 */
583 584
typedef struct RuleStmt
{
585 586 587 588 589 590 591
	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 */
592
} RuleStmt;
593 594

/* ----------------------
595
 *		Notify Statement
596 597
 * ----------------------
 */
598 599
typedef struct NotifyStmt
{
600 601
	NodeTag		type;
	char	   *relname;		/* relation to notify */
602
} NotifyStmt;
603 604

/* ----------------------
605
 *		Listen Statement
606 607
 * ----------------------
 */
608 609
typedef struct ListenStmt
{
610 611
	NodeTag		type;
	char	   *relname;		/* relation to listen on */
612
} ListenStmt;
M
 
Marc G. Fournier 已提交
613 614 615 616 617 618 619 620 621

/* ----------------------
 *		Unlisten Statement
 * ----------------------
 */
typedef struct UnlistenStmt
{
	NodeTag		type;
	char	   *relname;		/* relation to unlisten on */
622
} UnlistenStmt;
623 624

/* ----------------------
625
 *		{Begin|Abort|End} Transaction Statement
626 627
 * ----------------------
 */
628 629
typedef struct TransactionStmt
{
630 631
	NodeTag		type;
	int			command;		/* BEGIN|END|ABORT */
632
} TransactionStmt;
633 634

/* ----------------------
635
 *		Create View Statement
636 637
 * ----------------------
 */
638 639
typedef struct ViewStmt
{
640 641
	NodeTag		type;
	char	   *viewname;		/* name of the view */
642
	List	   *aliases;		/* target column names */
643
	Query	   *query;			/* the SQL statement */
644
} ViewStmt;
645 646

/* ----------------------
647
 *		Load Statement
648 649
 * ----------------------
 */
650 651
typedef struct LoadStmt
{
652 653
	NodeTag		type;
	char	   *filename;		/* file to load */
654
} LoadStmt;
655 656

/* ----------------------
657
 *		Createdb Statement
658 659
 * ----------------------
 */
660 661
typedef struct CreatedbStmt
{
662
	NodeTag		type;
663 664 665 666
	char	   *dbname;			/* name of database to create */
	char	   *dbpath;			/* location of database (NULL = default) */
	char	   *dbtemplate;		/* template to use (NULL = default) */
	int			encoding;		/* MULTIBYTE encoding (-1 = use default) */
667
} CreatedbStmt;
668 669

/* ----------------------
670
 *		Dropdb Statement
671 672
 * ----------------------
 */
673
typedef struct DropdbStmt
674
{
675 676
	NodeTag		type;
	char	   *dbname;			/* database to drop */
677
} DropdbStmt;
678 679

/* ----------------------
680
 *		Cluster Statement (support pbrown's cluster index implementation)
681 682
 * ----------------------
 */
683 684
typedef struct ClusterStmt
{
685 686 687
	NodeTag		type;
	char	   *relname;		/* relation being indexed */
	char	   *indexname;		/* original index defined */
688
} ClusterStmt;
689 690

/* ----------------------
691 692 693 694
 *		Vacuum and Analyze Statements
 *
 * Even though these are nominally two statements, it's convenient to use
 * just one node type for both.
695 696
 * ----------------------
 */
697 698
typedef struct VacuumStmt
{
699
	NodeTag		type;
700
	bool		vacuum;			/* do VACUUM step */
701
	bool		full;			/* do FULL (non-concurrent) vacuum */
702
	bool		analyze;		/* do ANALYZE step */
703
	bool		freeze;			/* early-freeze option */
704
	bool		verbose;		/* print progress info */
705 706
	char	   *vacrel;			/* name of single table to process, or
								 * NULL */
707
	List	   *va_cols;		/* list of column names, or NIL for all */
708
} VacuumStmt;
709 710

/* ----------------------
711
 *		Explain Statement
712 713
 * ----------------------
 */
714 715
typedef struct ExplainStmt
{
716 717 718
	NodeTag		type;
	Query	   *query;			/* the query */
	bool		verbose;		/* print plan info */
719
	bool		analyze;		/* get statistics by executing plan */
720
} ExplainStmt;
721

722
/* ----------------------
723
 * Checkpoint Statement
724 725
 * ----------------------
 */
V
Vadim B. Mikheev 已提交
726 727 728 729 730
typedef struct CheckPointStmt
{
	NodeTag		type;
} CheckPointStmt;

731 732 733 734 735
/* ----------------------
 * Set Statement
 * ----------------------
 */

736 737
typedef struct VariableSetStmt
{
738 739
	NodeTag		type;
	char	   *name;
740
	List	   *args;
741
} VariableSetStmt;
742 743 744 745 746 747

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

748 749
typedef struct VariableShowStmt
{
750 751
	NodeTag		type;
	char	   *name;
752
} VariableShowStmt;
753 754 755 756 757 758

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

759 760
typedef struct VariableResetStmt
{
761 762
	NodeTag		type;
	char	   *name;
763
} VariableResetStmt;
764

765 766 767 768 769 770 771
/* ----------------------
 *		LOCK Statement
 * ----------------------
 */
typedef struct LockStmt
{
	NodeTag		type;
772
	List	   *rellist;		/* relations to lock */
773
	int			mode;			/* lock mode */
774
} LockStmt;
775

776 777 778 779 780 781 782 783

/* ----------------------
 *		SET CONSTRAINTS Statement
 * ----------------------
 */
typedef struct ConstraintsSetStmt
{
	NodeTag		type;
784
	List	   *constraints;
785 786 787
	bool		deferred;
} ConstraintsSetStmt;

H
Hiroshi Inoue 已提交
788 789 790 791 792 793 794
/* ----------------------
 *		REINDEX Statement
 * ----------------------
 */
typedef struct ReindexStmt
{
	NodeTag		type;
795 796
	int			reindexType;	/* INDEX|TABLE|DATABASE */
	const char *name;			/* name to reindex */
H
Hiroshi Inoue 已提交
797 798 799 800
	bool		force;
	bool		all;
} ReindexStmt;

801

802
/*****************************************************************************
803
 *		Optimizable Statements
804 805 806
 *****************************************************************************/

/* ----------------------
807
 *		Insert Statement
808 809
 * ----------------------
 */
B
Bruce Momjian 已提交
810
typedef struct InsertStmt
811
{
812 813
	NodeTag		type;
	char	   *relname;		/* relation to insert into */
814
	List	   *cols;			/* optional: names of the target columns */
B
Bruce Momjian 已提交
815

816
	/*
B
Bruce Momjian 已提交
817 818 819
	 * An INSERT statement has *either* VALUES or SELECT, never both. If
	 * VALUES, a targetList is supplied (empty for DEFAULT VALUES). If
	 * SELECT, a complete SelectStmt (or set-operation tree) is supplied.
820
	 */
821
	List	   *targetList;		/* the target list (of ResTarget) */
822
	Node	   *selectStmt;		/* the source SELECT */
B
Bruce Momjian 已提交
823
} InsertStmt;
824 825

/* ----------------------
826
 *		Delete Statement
827 828
 * ----------------------
 */
829 830
typedef struct DeleteStmt
{
831 832 833
	NodeTag		type;
	char	   *relname;		/* relation to delete from */
	Node	   *whereClause;	/* qualifications */
834
	InhOption	inhOpt;			/* recursively act on children? */
835
} DeleteStmt;
836 837

/* ----------------------
838
 *		Update Statement
839 840
 * ----------------------
 */
B
Bruce Momjian 已提交
841
typedef struct UpdateStmt
842
{
843 844 845 846 847
	NodeTag		type;
	char	   *relname;		/* relation to update */
	List	   *targetList;		/* the target list (of ResTarget) */
	Node	   *whereClause;	/* qualifications */
	List	   *fromClause;		/* the from clause */
848
	InhOption	inhOpt;			/* recursively act on children? */
B
Bruce Momjian 已提交
849
} UpdateStmt;
850 851

/* ----------------------
852
 *		Select Statement
853 854 855 856 857 858 859 860 861
 *
 * A "simple" SELECT is represented in the output of gram.y by a single
 * SelectStmt node.  A SELECT construct containing set operators (UNION,
 * INTERSECT, EXCEPT) is represented by a tree of SelectStmt nodes, in
 * which the leaf nodes are component SELECTs and the internal nodes
 * represent UNION, INTERSECT, or EXCEPT operators.  Using the same node
 * type for both leaf and internal nodes allows gram.y to stick ORDER BY,
 * LIMIT, etc, clause values into a SELECT statement without worrying
 * whether it is a simple or compound SELECT.
862 863
 * ----------------------
 */
864 865
typedef enum SetOperation
{
866 867 868 869
	SETOP_NONE = 0,
	SETOP_UNION,
	SETOP_INTERSECT,
	SETOP_EXCEPT
870 871
} SetOperation;

B
Bruce Momjian 已提交
872
typedef struct SelectStmt
873
{
874
	NodeTag		type;
B
Bruce Momjian 已提交
875

876 877 878
	/*
	 * These fields are used only in "leaf" SelectStmts.
	 */
879 880 881
	List	   *distinctClause; /* NULL, list of DISTINCT ON exprs, or
								 * lcons(NIL,NIL) for all (SELECT
								 * DISTINCT) */
882
	char	   *into;			/* name of table (for select into table) */
883
	bool		istemp;			/* into is a temp table? */
884
	List	   *intoColNames;	/* column names for into table */
885
	List	   *targetList;		/* the target list (of ResTarget) */
886 887
	List	   *fromClause;		/* the FROM clause */
	Node	   *whereClause;	/* WHERE qualification */
888
	List	   *groupClause;	/* GROUP BY clauses */
889
	Node	   *havingClause;	/* HAVING conditional-expression */
B
Bruce Momjian 已提交
890

891 892 893 894
	/*
	 * These fields are used in both "leaf" SelectStmts and upper-level
	 * SelectStmts.  portalname/binary may only be set at the top level.
	 */
895
	List	   *sortClause;		/* sort clause (a list of SortGroupBy's) */
896 897
	char	   *portalname;		/* the portal (cursor) to create */
	bool		binary;			/* a binary (internal) portal? */
B
Bruce Momjian 已提交
898 899
	Node	   *limitOffset;	/* # of result tuples to skip */
	Node	   *limitCount;		/* # of result tuples to return */
V
Vadim B. Mikheev 已提交
900
	List	   *forUpdate;		/* FOR UPDATE clause */
B
Bruce Momjian 已提交
901

902 903 904 905 906 907 908 909
	/*
	 * These fields are used only in upper-level SelectStmts.
	 */
	SetOperation op;			/* type of set op */
	bool		all;			/* ALL specified? */
	struct SelectStmt *larg;	/* left child */
	struct SelectStmt *rarg;	/* right child */
	/* Eventually add fields for CORRESPONDING spec here */
B
Bruce Momjian 已提交
910
} SelectStmt;
911

912
/* ----------------------
913
 *		Set Operation node for post-analysis query trees
914
 *
915 916 917 918 919
 * After parse analysis, a SELECT with set operations is represented by a
 * top-level Query node containing the leaf SELECTs as subqueries in its
 * range table.  Its setOperations field shows the tree of set operations,
 * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal
 * nodes replaced by SetOperationStmt nodes.
920 921 922 923 924 925 926 927 928 929 930
 * ----------------------
 */
typedef struct SetOperationStmt
{
	NodeTag		type;
	SetOperation op;			/* type of set op */
	bool		all;			/* ALL specified? */
	Node	   *larg;			/* left child */
	Node	   *rarg;			/* right child */
	/* Eventually add fields for CORRESPONDING spec here */

931
	/* Fields derived during parse analysis: */
B
Bruce Momjian 已提交
932 933
	List	   *colTypes;		/* integer list of OIDs of output column
								 * types */
934 935
} SetOperationStmt;

936
/****************************************************************************
937
 *	Supporting data structures for Parse Trees
938 939
 *
 *	Most of these node types appear in raw parsetrees output by the grammar,
940
 *	and get transformed to something else by the analyzer.	A few of them
941
 *	are used as-is in transformed querytrees.
942 943 944 945 946
 ****************************************************************************/

/*
 * TypeName - specifies a type in definitions
 */
947 948
typedef struct TypeName
{
949 950 951 952
	NodeTag		type;
	char	   *name;			/* name of the type */
	bool		timezone;		/* timezone specified? */
	bool		setof;			/* is a set? */
953
	int32		typmod;			/* type modifier */
954
	List	   *arrayBounds;	/* array bounds */
955
	char	   *attrname;		/* field name when using %TYPE */
956
} TypeName;
957 958 959 960

/*
 * ParamNo - specifies a parameter reference
 */
961 962
typedef struct ParamNo
{
963 964 965
	NodeTag		type;
	int			number;			/* the number of the parameter */
	TypeName   *typename;		/* the typecast */
966
	List	   *indirection;	/* array references */
967
} ParamNo;
968 969 970 971

/*
 * A_Expr - binary expressions
 */
972 973
typedef struct A_Expr
{
974
	NodeTag		type;
975 976
	int			oper;			/* type of operation (OP,OR,AND,NOT) */
	char	   *opname;			/* name of operator */
977 978
	Node	   *lexpr;			/* left argument */
	Node	   *rexpr;			/* right argument */
B
Bruce Momjian 已提交
979
} A_Expr;
980 981 982

/*
 * Attr -
983 984
 *	  specifies an Attribute (ie. a Column); could have nested dots or
 *	  array references.
985 986
 *
 */
987 988
typedef struct Attr
{
989 990 991 992
	NodeTag		type;
	char	   *relname;		/* name of relation (can be "*") */
	ParamNo    *paramNo;		/* or a parameter */
	List	   *attrs;			/* attributes (possibly nested); list of
993
								 * Values (strings) */
994
	List	   *indirection;	/* array refs (list of A_Indices') */
B
Bruce Momjian 已提交
995
} Attr;
996 997 998 999

/*
 * A_Const - a constant expression
 */
1000 1001
typedef struct A_Const
{
1002 1003 1004
	NodeTag		type;
	Value		val;			/* the value (with the tag) */
	TypeName   *typename;		/* typecast */
B
Bruce Momjian 已提交
1005
} A_Const;
1006

1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022
/*
 * TypeCast - a CAST expression
 *
 * NOTE: for mostly historical reasons, A_Const and ParamNo parsenodes contain
 * room for a TypeName; we only generate a separate TypeCast node if the
 * argument to be casted is neither of those kinds of nodes.  In theory either
 * representation would work, but it is convenient (especially for A_Const)
 * to have the target type immediately available.
 */
typedef struct TypeCast
{
	NodeTag		type;
	Node	   *arg;			/* the expression being casted */
	TypeName   *typename;		/* the target type */
} TypeCast;

T
Thomas G. Lockhart 已提交
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032
/*
 * CaseExpr - a CASE expression
 */
typedef struct CaseExpr
{
	NodeTag		type;
	Oid			casetype;
	Node	   *arg;			/* implicit equality comparison argument */
	List	   *args;			/* the arguments (list of WHEN clauses) */
	Node	   *defresult;		/* the default result (ELSE clause) */
1033
} CaseExpr;
T
Thomas G. Lockhart 已提交
1034 1035 1036 1037 1038 1039 1040 1041 1042

/*
 * CaseWhen - an argument to a CASE expression
 */
typedef struct CaseWhen
{
	NodeTag		type;
	Node	   *expr;			/* comparison expression */
	Node	   *result;			/* substitution result */
1043
} CaseWhen;
T
Thomas G. Lockhart 已提交
1044

1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056
/* ----------------
 * NullTest
 *
 * NullTest represents the operation of testing a value for NULLness.
 * Currently, we only support scalar input values, but eventually a
 * row-constructor input should be supported.
 * The appropriate test is performed and returned as a boolean Datum.
 * ----------------
 */

typedef enum NullTestType
{
1057
	IS_NULL, IS_NOT_NULL
1058 1059 1060 1061
} NullTestType;

typedef struct NullTest
{
1062 1063 1064
	NodeTag		type;
	Node	   *arg;			/* input expression */
	NullTestType nulltesttype;	/* IS NULL, IS NOT NULL */
1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078
} NullTest;

/* ----------------
 * BooleanTest
 *
 * BooleanTest represents the operation of determining whether a boolean
 * is TRUE, FALSE, or UNKNOWN (ie, NULL).  All six meaningful combinations
 * are supported.  Note that a NULL input does *not* cause a NULL result.
 * The appropriate test is performed and returned as a boolean Datum.
 * ----------------
 */

typedef enum BoolTestType
{
1079
	IS_TRUE, IS_NOT_TRUE, IS_FALSE, IS_NOT_FALSE, IS_UNKNOWN, IS_NOT_UNKNOWN
1080 1081 1082 1083
} BoolTestType;

typedef struct BooleanTest
{
1084 1085 1086
	NodeTag		type;
	Node	   *arg;			/* input expression */
	BoolTestType booltesttype;	/* test type */
1087 1088
} BooleanTest;

1089 1090
/*
 * ColumnDef - column definition (used in various creates)
1091 1092 1093 1094 1095
 *
 * If the column has a default value, we may have the value expression
 * in either "raw" form (an untransformed parse tree) or "cooked" form
 * (the nodeToString representation of an executable expression tree),
 * depending on how this ColumnDef node was created (by parsing, or by
1096
 * inheritance from an existing relation).	We should never have both
1097 1098 1099 1100 1101 1102
 * in the same node!
 *
 * The constraints list may contain a CONSTR_DEFAULT item in a raw
 * parsetree produced by gram.y, but transformCreateStmt will remove
 * the item and set raw_default instead.  CONSTR_DEFAULT items
 * should not appear in any subsequent processing.
1103
 */
1104 1105
typedef struct ColumnDef
{
1106 1107 1108
	NodeTag		type;
	char	   *colname;		/* name of column */
	TypeName   *typename;		/* type of column */
1109
	bool		is_not_null;	/* NOT NULL constraint specified? */
1110 1111 1112
	Node	   *raw_default;	/* default value (untransformed parse
								 * tree) */
	char	   *cooked_default; /* nodeToString representation */
1113
	List	   *constraints;	/* other constraints on column */
1114
} ColumnDef;
1115 1116

/*
1117 1118 1119 1120 1121 1122 1123 1124
 * 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
{
1125 1126 1127
	NodeTag		type;
	char	   *name;			/* its name */
	List	   *indirection;	/* array references */
1128
	bool		isRel;			/* is this a relation or a column? */
1129
} Ident;
1130 1131

/*
1132 1133 1134 1135 1136 1137
 * FuncCall - a function or aggregate invocation
 *
 * agg_star indicates we saw a 'foo(*)' construct, while agg_distinct
 * indicates we saw 'foo(DISTINCT ...)'.  In either case, the construct
 * *must* be an aggregate call.  Otherwise, it might be either an
 * aggregate or some other kind of function.
1138
 */
1139 1140
typedef struct FuncCall
{
1141 1142 1143
	NodeTag		type;
	char	   *funcname;		/* name of function */
	List	   *args;			/* the arguments (list of exprs) */
1144 1145
	bool		agg_star;		/* argument was really '*' */
	bool		agg_distinct;	/* arguments were labeled DISTINCT */
1146
} FuncCall;
1147 1148 1149 1150

/*
 * A_Indices - array reference or bounds ([lidx:uidx] or [uidx])
 */
1151 1152
typedef struct A_Indices
{
1153 1154 1155
	NodeTag		type;
	Node	   *lidx;			/* could be NULL */
	Node	   *uidx;
B
Bruce Momjian 已提交
1156
} A_Indices;
1157 1158

/*
1159 1160
 * ResTarget -
 *	  result target (used in target list of pre-transformed Parse trees)
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170
 *
 * In a SELECT or INSERT target list, 'name' is either NULL or
 * the column name assigned to the value.  (If there is an 'AS ColumnLabel'
 * clause, the grammar sets 'name' from it; otherwise 'name' is initially NULL
 * and is filled in during the parse analysis phase.)
 * The 'indirection' field is not used at all.
 *
 * In an UPDATE target list, 'name' is the name of the destination column,
 * and 'indirection' stores any subscripts attached to the destination.
 * That is, our representation is UPDATE table SET name [indirection] = val.
1171 1172 1173
 */
typedef struct ResTarget
{
1174
	NodeTag		type;
1175
	char	   *name;			/* column name or NULL */
1176 1177 1178 1179
	List	   *indirection;	/* subscripts for destination column, or
								 * NIL */
	Node	   *val;			/* the value expression to compute or
								 * assign */
1180
} ResTarget;
1181 1182

/*
T
Thomas G. Lockhart 已提交
1183
 * SortGroupBy - for ORDER BY clause
1184
 */
1185
typedef struct SortGroupBy
M
 
Marc G. Fournier 已提交
1186 1187 1188
{
	NodeTag		type;
	char	   *useOp;			/* operator to use */
1189
	Node	   *node;			/* Expression  */
M
 
Marc G. Fournier 已提交
1190 1191
} SortGroupBy;

1192
/*
T
Thomas G. Lockhart 已提交
1193
 * RangeVar - range variable, used in FROM clauses
1194
 */
1195 1196
typedef struct RangeVar
{
1197
	NodeTag		type;
1198
	char	   *relname;		/* the relation name */
1199
	InhOption	inhOpt;			/* expand rel by inheritance? */
1200
	Attr	   *name;			/* optional table alias & column aliases */
1201
} RangeVar;
1202

1203 1204 1205 1206 1207 1208 1209
/*
 * RangeSubselect - subquery appearing in a FROM clause
 */
typedef struct RangeSubselect
{
	NodeTag		type;
	Node	   *subquery;		/* the untransformed sub-select clause */
1210
	Attr	   *name;			/* table alias & optional column aliases */
1211 1212
} RangeSubselect;

1213
/*
T
Thomas G. Lockhart 已提交
1214
 * IndexElem - index parameters (used in CREATE INDEX)
1215 1216 1217 1218 1219
 *
 * For a plain index, each 'name' is an attribute name in the heap relation,
 * and 'args' is NIL.  For a functional index, only one IndexElem is allowed.
 * It has name = name of function and args = list of attribute names that
 * are the function's arguments.
1220
 */
1221 1222
typedef struct IndexElem
{
1223
	NodeTag		type;
1224 1225 1226
	char	   *name;			/* name of attribute to index, or function */
	List	   *args;			/* list of names of function arguments */
	char	   *class;			/* name of desired opclass; NULL = default */
1227
} IndexElem;
1228 1229 1230

/*
 * DefElem -
1231
 *	  a definition (used in definition lists in the form of defname = arg)
1232
 */
1233 1234
typedef struct DefElem
{
1235 1236 1237
	NodeTag		type;
	char	   *defname;
	Node	   *arg;			/* a (Value *) or a (TypeName *) */
1238
} DefElem;
1239 1240 1241


/****************************************************************************
1242
 *	Nodes for a Query tree
1243 1244 1245 1246
 ****************************************************************************/

/*
 * TargetEntry -
1247
 *	   a target  entry (used in the transformed target list)
1248 1249
 *
 * one of resdom or fjoin is not NULL. a target list is
1250
 *		((<resdom | fjoin> expr) (<resdom | fjoin> expr) ...)
1251
 */
1252 1253
typedef struct TargetEntry
{
1254 1255 1256
	NodeTag		type;
	Resdom	   *resdom;			/* fjoin overload this to be a list?? */
	Fjoin	   *fjoin;
1257
	Node	   *expr;
1258
} TargetEntry;
1259

1260
/*--------------------
1261
 * RangeTblEntry -
1262 1263
 *	  A range table is a List of RangeTblEntry nodes.
 *
1264 1265 1266
 *	  Currently we use the same node type for both plain relation references
 *	  and sub-selects in the FROM clause.  It might be cleaner to abstract
 *	  the common fields into a "superclass" nodetype.
1267
 *
1268 1269 1270 1271
 *	  alias is an Attr node representing the AS alias-clause attached to the
 *	  FROM expression, or NULL if no clause.
 *
 *	  eref is the table reference name and column reference names (either
1272 1273 1274 1275 1276 1277 1278 1279
 *	  real or aliases).  Note that system columns (OID etc) are not included
 *	  in the column list.
 *	  eref->relname is required to be present, and should generally be used
 *	  to identify the RTE for error messages etc.
 *
 *	  inh is TRUE for relation references that should be expanded to include
 *	  inheritance children, if the rel has any.  This *must* be FALSE for
 *	  subquery RTEs.
1280
 *
1281 1282 1283
 *	  inFromCl marks those range variables that are listed in the FROM clause.
 *	  In SQL, the query can only refer to range variables listed in the
 *	  FROM clause, but POSTQUEL allows you to refer to tables not listed,
1284
 *	  in which case a range table entry will be generated.	We still support
1285 1286 1287 1288 1289
 *	  this POSTQUEL feature, although there is some doubt whether it's
 *	  convenient or merely confusing.  The flag is needed since an
 *	  implicitly-added RTE shouldn't change the namespace for unqualified
 *	  column names processed later, and it also shouldn't affect the
 *	  expansion of '*'.
1290 1291 1292 1293 1294 1295 1296
 *
 *	  checkForRead, checkForWrite, and checkAsUser control run-time access
 *	  permissions checks.  A rel will be checked for read or write access
 *	  (or both, or neither) per checkForRead and checkForWrite.  If
 *	  checkAsUser is not InvalidOid, then do the permissions checks using
 *	  the access rights of that user, not the current effective user ID.
 *	  (This allows rules to act as setuid gateways.)
1297
 *--------------------
1298 1299 1300
 */
typedef struct RangeTblEntry
{
1301
	NodeTag		type;
B
Bruce Momjian 已提交
1302

1303 1304 1305
	/*
	 * Fields valid for a plain relation RTE (else NULL/zero):
	 */
1306
	char	   *relname;		/* real name of the relation */
1307
	Oid			relid;			/* OID of the relation */
B
Bruce Momjian 已提交
1308

1309 1310 1311 1312
	/*
	 * Fields valid for a subquery RTE (else NULL):
	 */
	Query	   *subquery;		/* the sub-query */
B
Bruce Momjian 已提交
1313

1314 1315 1316
	/*
	 * Fields valid in all RTEs:
	 */
1317 1318
	Attr	   *alias;			/* user-written alias clause, if any */
	Attr	   *eref;			/* expanded reference names */
1319 1320
	bool		inh;			/* inheritance requested? */
	bool		inFromCl;		/* present in FROM clause */
1321 1322 1323
	bool		checkForRead;	/* check rel for read access */
	bool		checkForWrite;	/* check rel for write access */
	Oid			checkAsUser;	/* if not zero, check access as this user */
1324
} RangeTblEntry;
1325 1326 1327

/*
 * SortClause -
1328 1329 1330 1331 1332
 *	   representation of ORDER BY clauses
 *
 * tleSortGroupRef must match ressortgroupref of exactly one Resdom of the
 * associated targetlist; that is the expression to be sorted (or grouped) by.
 * sortop is the OID of the ordering operator.
1333 1334 1335 1336 1337 1338 1339
 *
 * SortClauses are also used to identify Resdoms that we will do a "Unique"
 * filter step on (for SELECT DISTINCT and SELECT DISTINCT ON).  The
 * distinctClause list is simply a copy of the relevant members of the
 * sortClause list.  Note that distinctClause can be a subset of sortClause,
 * but cannot have members not present in sortClause; and the members that
 * do appear must be in the same order as in sortClause.
1340
 */
1341 1342
typedef struct SortClause
{
1343
	NodeTag		type;
1344
	Index		tleSortGroupRef;	/* reference into targetlist */
1345
	Oid			sortop;			/* the sort operator to use */
1346
} SortClause;
1347 1348 1349

/*
 * GroupClause -
1350 1351 1352
 *	   representation of GROUP BY clauses
 *
 * GroupClause is exactly like SortClause except for the nodetag value
1353
 * (it's probably not even really necessary to have two different
1354
 * nodetags...).  We have routines that operate interchangeably on both.
1355
 */
1356
typedef SortClause GroupClause;
1357

1358
#endif	 /* PARSENODES_H */