parsenodes.h 22.0 KB
Newer Older
1 2 3
/*-------------------------------------------------------------------------
 *
 * parsenodes.h--
4
 *	  definitions for parse tree nodes
5 6 7 8
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
9
 * $Id: parsenodes.h,v 1.50 1998/07/12 21:29:31 momjian Exp $
10 11 12
 *
 *-------------------------------------------------------------------------
 */
13 14
#ifndef PARSENODES_H
#define PARSENODES_H
15

16
#include <nodes/primnodes.h>
17 18

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

/*
 * Query -
24 25 26 27
 *	  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.
28 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 43 44 45
	int			resultRelation; /* target relation (index to rtable) */
	char	   *into;			/* portal (cursor) name */
	bool		isPortal;		/* is this a retrieve into portal? */
	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 51
	char	   *uniqueFlag;		/* NULL, '*', or Unique attribute name */
	List	   *sortClause;		/* a list of SortClause's */
52

53 54 55
	List	   *rtable;			/* list of range table entries */
	List	   *targetList;		/* target list (of TargetEntry) */
	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 62
	List	   *unionClause;	/* unions are linked under the previous
								 * query */
B
Bruce Momjian 已提交
63

64
	/* internal to planner */
65
	List	   *base_relation_list_;	/* base relation list */
B
Bruce Momjian 已提交
66
	List	   *join_relation_list_;	/* list of relations */
67
} Query;
68 69 70


/*****************************************************************************
71
 *		Other Statements (no optimizations required)
72
 *
73 74 75 76
 *		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.
77 78 79
 *****************************************************************************/

/* ----------------------
80
 *		Add Column Statement
81 82
 * ----------------------
 */
83 84
typedef struct AddAttrStmt
{
85 86 87
	NodeTag		type;
	char	   *relname;		/* the relation to add attr */
	bool		inh;			/* add recursively to children? */
88
	Node	   *colDef;			/* the attribute definition */
B
Bruce Momjian 已提交
89
} AddAttrStmt;
90 91

/* ----------------------
92
 *		Change ACL Statement
93 94
 * ----------------------
 */
95 96
typedef struct ChangeACLStmt
{
97
	NodeTag		type;
98
	struct AclItem *aclitem;
99 100
	unsigned	modechg;
	List	   *relNames;
101
} ChangeACLStmt;
102 103

/* ----------------------
104
 *		Close Portal Statement
105 106
 * ----------------------
 */
107 108
typedef struct ClosePortalStmt
{
109 110
	NodeTag		type;
	char	   *portalname;		/* name of the portal (cursor) */
111
} ClosePortalStmt;
112 113

/* ----------------------
114
 *		Copy Statement
115 116
 * ----------------------
 */
117 118
typedef struct CopyStmt
{
119 120 121 122 123 124 125
	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 */
126
} CopyStmt;
127 128

/* ----------------------
129
 *		Create Table Statement
130 131
 * ----------------------
 */
132 133
typedef struct CreateStmt
{
134 135
	NodeTag		type;
	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 145
	CONSTR_NONE, CONSTR_NOTNULL, CONSTR_DEFAULT, CONSTR_CHECK, CONSTR_PRIMARY, CONSTR_UNIQUE
} ConstrType;
146

147
typedef struct Constraint
148
{
149 150
	NodeTag		type;
	ConstrType	contype;
151 152
	char	   *name;			/* name */
	void	   *def;			/* definition */
153 154
	void	   *keys;			/* list of primary keys */
} Constraint;
155

156
/* ----------------------
157
 *		Create/Drop TRIGGER Statements
158 159 160
 * ----------------------
 */

161 162
typedef struct CreateTrigStmt
{
163 164 165 166 167 168 169 170 171 172 173 174
	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 */
	char	   *lang;			/* NULL (which means Clanguage) */
	char	   *text;			/* AS 'text' */
	List	   *attr;			/* UPDATE OF a, b,... (NI) or NULL */
	char	   *when;			/* WHEN 'a > 10 ...' (NI) or NULL */
175
} CreateTrigStmt;
176

177 178
typedef struct DropTrigStmt
{
179 180 181
	NodeTag		type;
	char	   *trigname;		/* TRIGGER' name */
	char	   *relname;		/* triggered relation */
182
} DropTrigStmt;
183 184 185 186 187 188 189 190 191 192 193 194 195


/* ----------------------
 *		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 */
196
} CreatePLangStmt;
197 198 199 200 201

typedef struct DropPLangStmt
{
	NodeTag		type;
	char	   *plname;			/* PL name */
202
} DropPLangStmt;
203

204

205
/* ----------------------
206
 *				Create/Alter/Drop User Statements
207 208 209 210
 * ----------------------
 */
typedef struct CreateUserStmt
{
211 212 213 214 215 216 217
	NodeTag		type;
	char	   *user;			/* PostgreSQL user login			  */
	char	   *password;		/* PostgreSQL user password			  */
	bool	   *createdb;		/* Can the user create databases?	  */
	bool	   *createuser;		/* Can this user create users?		  */
	List	   *groupElts;		/* The groups the user is a member of */
	char	   *validUntil;		/* The time the login is valid until  */
218 219
} CreateUserStmt;

220
typedef CreateUserStmt AlterUserStmt;
221 222 223

typedef struct DropUserStmt
{
224 225
	NodeTag		type;
	char	   *user;			/* PostgreSQL user login			  */
226 227 228
} DropUserStmt;


V
Vadim B. Mikheev 已提交
229
/* ----------------------
230
 *		Create SEQUENCE Statement
V
Vadim B. Mikheev 已提交
231 232 233
 * ----------------------
 */

234 235
typedef struct CreateSeqStmt
{
236 237 238
	NodeTag		type;
	char	   *seqname;		/* the relation to create */
	List	   *options;
239
} CreateSeqStmt;
V
Vadim B. Mikheev 已提交
240

241
/* ----------------------
242
 *		Create Version Statement
243 244
 * ----------------------
 */
245 246
typedef struct VersionStmt
{
247 248 249 250 251
	NodeTag		type;
	char	   *relname;		/* the new relation */
	int			direction;		/* FORWARD | BACKWARD */
	char	   *fromRelname;	/* relation to create a version */
	char	   *date;			/* date of the snapshot */
252
} VersionStmt;
253 254

/* ----------------------
255
 *		Create {Operator|Type|Aggregate} Statement
256 257
 * ----------------------
 */
258 259
typedef struct DefineStmt
{
260 261 262 263
	NodeTag		type;
	int			defType;		/* OPERATOR|P_TYPE|AGGREGATE */
	char	   *defname;
	List	   *definition;		/* a list of DefElem */
264
} DefineStmt;
265 266

/* ----------------------
267
 *		Drop Table Statement
268 269
 * ----------------------
 */
270 271
typedef struct DestroyStmt
{
272 273 274
	NodeTag		type;
	List	   *relNames;		/* relations to be dropped */
	bool		sequence;
275
} DestroyStmt;
276 277

/* ----------------------
278
 *		Extend Index Statement
279 280
 * ----------------------
 */
281 282
typedef struct ExtendStmt
{
283 284 285 286
	NodeTag		type;
	char	   *idxname;		/* name of the index */
	Node	   *whereClause;	/* qualifications */
	List	   *rangetable;		/* range table, filled in by
287
								 * transformStmt() */
288
} ExtendStmt;
289 290

/* ----------------------
291
 *		Begin Recipe Statement
292 293
 * ----------------------
 */
294 295
typedef struct RecipeStmt
{
296 297
	NodeTag		type;
	char	   *recipeName;		/* name of the recipe */
298
} RecipeStmt;
299 300

/* ----------------------
301
 *		Fetch Statement
302 303
 * ----------------------
 */
304 305
typedef struct FetchStmt
{
306 307 308 309
	NodeTag		type;
	int			direction;		/* FORWARD or BACKWARD */
	int			howMany;		/* amount to fetch ("ALL" --> 0) */
	char	   *portalname;		/* name of portal (cursor) */
310
	bool		ismove;			/* TRUE if MOVE */
311
} FetchStmt;
312 313

/* ----------------------
314
 *		Create Index Statement
315 316
 * ----------------------
 */
317 318
typedef struct IndexStmt
{
319 320 321 322 323 324 325 326
	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
327
								 * transformStmt() */
328 329
	bool	   *lossy;			/* is index lossy? */
	bool		unique;			/* is index unique? */
330
} IndexStmt;
331 332

/* ----------------------
333
 *		Create Function Statement
334 335
 * ----------------------
 */
336 337
typedef struct ProcedureStmt
{
338 339 340
	NodeTag		type;
	char	   *funcname;		/* name of function to create */
	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 345 346
	List	   *withClause;		/* a list of ParamString */
	char	   *as;				/* the SQL statement or filename */
	char	   *language;		/* C or SQL */
347
} ProcedureStmt;
348

349
/* ----------------------
350
 *		Drop Aggregate Statement
351 352
 * ----------------------
 */
353 354
typedef struct RemoveAggrStmt
{
355 356 357
	NodeTag		type;
	char	   *aggname;		/* aggregate to drop */
	char	   *aggtype;		/* for this type */
358
} RemoveAggrStmt;
359

360
/* ----------------------
361
 *		Drop Function Statement
362 363
 * ----------------------
 */
364 365
typedef struct RemoveFuncStmt
{
366 367 368
	NodeTag		type;
	char	   *funcname;		/* function to drop */
	List	   *args;			/* types of the arguments */
369
} RemoveFuncStmt;
370 371

/* ----------------------
372
 *		Drop Operator Statement
373 374
 * ----------------------
 */
375 376
typedef struct RemoveOperStmt
{
377 378 379
	NodeTag		type;
	char	   *opname;			/* operator to drop */
	List	   *args;			/* types of the arguments */
380
} RemoveOperStmt;
381 382

/* ----------------------
383
 *		Drop {Type|Index|Rule|View} Statement
384 385
 * ----------------------
 */
386 387
typedef struct RemoveStmt
{
388 389 390
	NodeTag		type;
	int			removeType;		/* P_TYPE|INDEX|RULE|VIEW */
	char	   *name;			/* name to drop */
391
} RemoveStmt;
392 393

/* ----------------------
394
 *		Alter Table Statement
395 396
 * ----------------------
 */
397 398
typedef struct RenameStmt
{
399 400 401 402
	NodeTag		type;
	char	   *relname;		/* relation to be altered */
	bool		inh;			/* recursively alter children? */
	char	   *column;			/* if NULL, rename the relation name to
403 404
								 * the new name. Otherwise, rename this
								 * column name. */
405
	char	   *newname;		/* the new name */
406
} RenameStmt;
407 408

/* ----------------------
409
 *		Create Rule Statement
410 411
 * ----------------------
 */
412 413
typedef struct RuleStmt
{
414 415 416 417 418 419 420
	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 */
421
} RuleStmt;
422 423

/* ----------------------
424
 *		Notify Statement
425 426
 * ----------------------
 */
427 428
typedef struct NotifyStmt
{
429 430
	NodeTag		type;
	char	   *relname;		/* relation to notify */
431
} NotifyStmt;
432 433

/* ----------------------
434
 *		Listen Statement
435 436
 * ----------------------
 */
437 438
typedef struct ListenStmt
{
439 440
	NodeTag		type;
	char	   *relname;		/* relation to listen on */
441
} ListenStmt;
442 443

/* ----------------------
444
 *		{Begin|Abort|End} Transaction Statement
445 446
 * ----------------------
 */
447 448
typedef struct TransactionStmt
{
449 450
	NodeTag		type;
	int			command;		/* BEGIN|END|ABORT */
451
} TransactionStmt;
452 453

/* ----------------------
454
 *		Create View Statement
455 456
 * ----------------------
 */
457 458
typedef struct ViewStmt
{
459 460 461
	NodeTag		type;
	char	   *viewname;		/* name of the view */
	Query	   *query;			/* the SQL statement */
462
} ViewStmt;
463 464

/* ----------------------
465
 *		Load Statement
466 467
 * ----------------------
 */
468 469
typedef struct LoadStmt
{
470 471
	NodeTag		type;
	char	   *filename;		/* file to load */
472
} LoadStmt;
473 474

/* ----------------------
475
 *		Createdb Statement
476 477
 * ----------------------
 */
478 479
typedef struct CreatedbStmt
{
480 481
	NodeTag		type;
	char	   *dbname;			/* database to create */
482
	char	   *dbpath;			/* location of database */
483
} CreatedbStmt;
484 485

/* ----------------------
486
 *		Destroydb Statement
487 488
 * ----------------------
 */
489 490
typedef struct DestroydbStmt
{
491 492
	NodeTag		type;
	char	   *dbname;			/* database to drop */
493
} DestroydbStmt;
494 495

/* ----------------------
496
 *		Cluster Statement (support pbrown's cluster index implementation)
497 498
 * ----------------------
 */
499 500
typedef struct ClusterStmt
{
501 502 503
	NodeTag		type;
	char	   *relname;		/* relation being indexed */
	char	   *indexname;		/* original index defined */
504
} ClusterStmt;
505 506

/* ----------------------
507
 *		Vacuum Statement
508 509
 * ----------------------
 */
510 511
typedef struct VacuumStmt
{
512 513 514 515 516
	NodeTag		type;
	bool		verbose;		/* print status info */
	bool		analyze;		/* analyze data */
	char	   *vacrel;			/* table to vacuum */
	List	   *va_spec;		/* columns to analyse */
517
} VacuumStmt;
518 519

/* ----------------------
520
 *		Explain Statement
521 522
 * ----------------------
 */
523 524
typedef struct ExplainStmt
{
525 526 527
	NodeTag		type;
	Query	   *query;			/* the query */
	bool		verbose;		/* print plan info */
528
} ExplainStmt;
529

530 531 532 533 534
/* ----------------------
 * Set Statement
 * ----------------------
 */

535 536
typedef struct VariableSetStmt
{
537 538 539
	NodeTag		type;
	char	   *name;
	char	   *value;
540
} VariableSetStmt;
541 542 543 544 545 546

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

547 548
typedef struct VariableShowStmt
{
549 550
	NodeTag		type;
	char	   *name;
551
} VariableShowStmt;
552 553 554 555 556 557

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

558 559
typedef struct VariableResetStmt
{
560 561
	NodeTag		type;
	char	   *name;
562
} VariableResetStmt;
563

564 565

/*****************************************************************************
566
 *		Optimizable Statements
567 568 569
 *****************************************************************************/

/* ----------------------
570
 *		Insert Statement
571 572
 * ----------------------
 */
B
Bruce Momjian 已提交
573
typedef struct InsertStmt
574
{
575 576
	NodeTag		type;
	char	   *relname;		/* relation to insert into */
577
	char	   *unique;			/* NULL, '*', or unique attribute name */
578 579 580 581
	List	   *cols;			/* names of the columns */
	List	   *targetList;		/* the target list (of ResTarget) */
	List	   *fromClause;		/* the from clause */
	Node	   *whereClause;	/* qualifications */
582 583 584 585
	List	   *groupClause;	/* group by clause */
	Node	   *havingClause;	/* having conditional-expression */
	List	   *unionClause;	/* union subselect parameters */
	bool		unionall;		/* union without unique sort */
B
Bruce Momjian 已提交
586
} InsertStmt;
587 588

/* ----------------------
589
 *		Delete Statement
590 591
 * ----------------------
 */
592 593
typedef struct DeleteStmt
{
594 595 596
	NodeTag		type;
	char	   *relname;		/* relation to delete from */
	Node	   *whereClause;	/* qualifications */
597
} DeleteStmt;
598 599

/* ----------------------
600
 *		Update Statement
601 602
 * ----------------------
 */
B
Bruce Momjian 已提交
603
typedef struct UpdateStmt
604
{
605 606 607 608 609
	NodeTag		type;
	char	   *relname;		/* relation to update */
	List	   *targetList;		/* the target list (of ResTarget) */
	Node	   *whereClause;	/* qualifications */
	List	   *fromClause;		/* the from clause */
B
Bruce Momjian 已提交
610
} UpdateStmt;
611 612

/* ----------------------
613
 *		Select Statement
614 615
 * ----------------------
 */
B
Bruce Momjian 已提交
616
typedef struct SelectStmt
617
{
618 619 620 621 622 623 624 625
	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 */
626
	List	   *unionClause;	/* union subselect parameters */
627
	List	   *sortClause;		/* sort clause (a list of SortGroupBy's) */
628 629
	char	   *portalname;		/* the portal (cursor) to create */
	bool		binary;			/* a binary (internal) portal? */
630
	bool		unionall;		/* union without unique sort */
B
Bruce Momjian 已提交
631
} SelectStmt;
632 633 634


/****************************************************************************
635
 *	Supporting data structures for Parse Trees
636 637 638 639 640
 ****************************************************************************/

/*
 * TypeName - specifies a type in definitions
 */
641 642
typedef struct TypeName
{
643 644 645 646
	NodeTag		type;
	char	   *name;			/* name of the type */
	bool		timezone;		/* timezone specified? */
	bool		setof;			/* is a set? */
647
	int32		typmod;			/* type modifier */
648
	List	   *arrayBounds;	/* array bounds */
649
} TypeName;
650 651 652 653

/*
 * ParamNo - specifies a parameter reference
 */
654 655
typedef struct ParamNo
{
656 657 658
	NodeTag		type;
	int			number;			/* the number of the parameter */
	TypeName   *typename;		/* the typecast */
659
} ParamNo;
660 661 662 663

/*
 * A_Expr - binary expressions
 */
664 665
typedef struct A_Expr
{
666 667
	NodeTag		type;
	int			oper;			/* type of operation
668
								 * {OP,OR,AND,NOT,ISNULL,NOTNULL} */
669 670 671
	char	   *opname;			/* name of operator/function */
	Node	   *lexpr;			/* left argument */
	Node	   *rexpr;			/* right argument */
B
Bruce Momjian 已提交
672
} A_Expr;
673 674 675

/*
 * Attr -
676 677
 *	  specifies an Attribute (ie. a Column); could have nested dots or
 *	  array references.
678 679
 *
 */
680 681
typedef struct Attr
{
682 683 684 685
	NodeTag		type;
	char	   *relname;		/* name of relation (can be "*") */
	ParamNo    *paramNo;		/* or a parameter */
	List	   *attrs;			/* attributes (possibly nested); list of
686
								 * Values (strings) */
687
	List	   *indirection;	/* array refs (list of A_Indices') */
B
Bruce Momjian 已提交
688
} Attr;
689 690 691 692

/*
 * A_Const - a constant expression
 */
693 694
typedef struct A_Const
{
695 696 697
	NodeTag		type;
	Value		val;			/* the value (with the tag) */
	TypeName   *typename;		/* typecast */
B
Bruce Momjian 已提交
698
} A_Const;
699 700 701 702

/*
 * ColumnDef - column definition (used in various creates)
 */
703 704
typedef struct ColumnDef
{
705 706 707 708 709
	NodeTag		type;
	char	   *colname;		/* name of column */
	TypeName   *typename;		/* type of column */
	bool		is_not_null;	/* flag to NOT NULL constraint */
	char	   *defval;			/* default value of column */
710 711
	List	   *constraints;	/* constraints on column */
} ColumnDef;
712 713

/*
714 715 716 717 718 719 720 721
 * 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
{
722 723 724 725
	NodeTag		type;
	char	   *name;			/* its name */
	List	   *indirection;	/* array references */
	bool		isRel;			/* is a relation - filled in by
726
								 * transformExpr() */
727
} Ident;
728 729 730 731

/*
 * FuncCall - a function/aggregate invocation
 */
732 733
typedef struct FuncCall
{
734 735 736
	NodeTag		type;
	char	   *funcname;		/* name of function */
	List	   *args;			/* the arguments (list of exprs) */
737
} FuncCall;
738 739 740 741

/*
 * A_Indices - array reference or bounds ([lidx:uidx] or [uidx])
 */
742 743
typedef struct A_Indices
{
744 745 746
	NodeTag		type;
	Node	   *lidx;			/* could be NULL */
	Node	   *uidx;
B
Bruce Momjian 已提交
747
} A_Indices;
748 749

/*
750 751 752 753 754
 * ResTarget -
 *	  result target (used in target list of pre-transformed Parse trees)
 */
typedef struct ResTarget
{
755 756 757 758
	NodeTag		type;
	char	   *name;			/* name of the result column */
	List	   *indirection;	/* array references */
	Node	   *val;			/* the value of the result (A_Expr or
759
								 * Attr) (or A_Const) */
760
} ResTarget;
761 762 763 764

/*
 * ParamString - used in with clauses
 */
765 766
typedef struct ParamString
{
767 768 769
	NodeTag		type;
	char	   *name;
	char	   *val;
770
} ParamString;
771 772 773 774

/*
 * RelExpr - relation expressions
 */
775 776
typedef struct RelExpr
{
777 778 779
	NodeTag		type;
	char	   *relname;		/* the relation name */
	bool		inh;			/* inheritance query */
780
} RelExpr;
781 782

/*
783
 * SortGroupBy - for order by clause
784
 */
785 786
typedef struct SortGroupBy
{
787 788 789 790 791
	NodeTag		type;
	int			resno;			/* target number */
	char	   *range;
	char	   *name;			/* name of column to sort on */
	char	   *useOp;			/* operator to use */
792
} SortGroupBy;
793 794 795 796

/*
 * RangeVar - range variable, used in from clauses
 */
797 798
typedef struct RangeVar
{
799 800 801
	NodeTag		type;
	RelExpr    *relExpr;		/* the relation expression */
	char	   *name;			/* the name to be referenced (optional) */
802
} RangeVar;
803 804 805 806

/*
 * IndexElem - index parameters (used in create index)
 */
807 808
typedef struct IndexElem
{
809 810 811 812 813
	NodeTag		type;
	char	   *name;			/* name of index */
	List	   *args;			/* if not NULL, function index */
	char	   *class;
	TypeName   *tname;			/* type of index's keys (optional) */
814
} IndexElem;
815 816 817

/*
 * DefElem -
818
 *	  a definition (used in definition lists in the form of defname = arg)
819
 */
820 821
typedef struct DefElem
{
822 823 824
	NodeTag		type;
	char	   *defname;
	Node	   *arg;			/* a (Value *) or a (TypeName *) */
825
} DefElem;
826 827 828


/****************************************************************************
829
 *	Nodes for a Query tree
830 831 832 833
 ****************************************************************************/

/*
 * TargetEntry -
834
 *	   a target  entry (used in the transformed target list)
835 836
 *
 * one of resdom or fjoin is not NULL. a target list is
837
 *		((<resdom | fjoin> expr) (<resdom | fjoin> expr) ...)
838
 */
839 840
typedef struct TargetEntry
{
841 842 843 844
	NodeTag		type;
	Resdom	   *resdom;			/* fjoin overload this to be a list?? */
	Fjoin	   *fjoin;
	Node	   *expr;			/* can be a list too */
845
} TargetEntry;
846 847 848

/*
 * RangeTblEntry -
849 850
 *	  used in range tables. Some of the following are only used in one of
 *	  the parsing, optimizing, execution stages.
851
 *
852 853 854 855 856 857 858 859 860
 *	  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
{
861 862 863
	NodeTag		type;
	char	   *relname;		/* real name of the relation */
	char	   *refname;		/* the reference name (specified in the
864
								 * from clause) */
865 866 867
	Oid			relid;
	bool		inh;			/* inheritance? */
	bool		inFromCl;		/* comes from From Clause */
M
Marc G. Fournier 已提交
868
	bool		skipAcl;		/* skip ACL check in executor */
869
} RangeTblEntry;
870 871 872

/*
 * SortClause -
873
 *	   used in the sort clause for retrieves and cursors
874
 */
875 876
typedef struct SortClause
{
877 878 879
	NodeTag		type;
	Resdom	   *resdom;			/* attributes in tlist to be sorted */
	Oid			opoid;			/* sort operators */
880
} SortClause;
881 882 883

/*
 * GroupClause -
884
 *	   used in the GROUP BY clause
885
 */
886 887
typedef struct GroupClause
{
888 889 890
	NodeTag		type;
	TargetEntry *entry;			/* attributes to group on */
	Oid			grpOpoid;		/* the sort operator to use */
891
} GroupClause;
892

893
#endif							/* PARSENODES_H */