parsenodes.h 22.1 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
 *
B
Bruce Momjian 已提交
9
 * $Id: parsenodes.h,v 1.47 1998/02/10 16:04:26 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

B
Bruce Momjian 已提交
61 62
	List	   *unionClause;	/* unions are linked under the previous query */

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


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

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

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

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

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

/* ----------------------
128
 *		Create Table Statement
129 130
 * ----------------------
 */
131 132
typedef struct CreateStmt
{
133 134
	NodeTag		type;
	char	   *relname;		/* the relation to create */
135
	List	   *tableElts;		/* column definitions list of Column */
136
	List	   *inhRelnames;	/* relations to inherit from list of Value
137
								 * (string) */
138
	List	   *constraints;	/* list of constraints (ConstaintDef) */
139
} CreateStmt;
140

141
typedef enum ConstrType			/* type of constaints */
142
{
143 144
	CONSTR_NONE, CONSTR_NOTNULL, CONSTR_DEFAULT, CONSTR_CHECK, CONSTR_PRIMARY, CONSTR_UNIQUE
} ConstrType;
145

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

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

160 161
typedef struct CreateTrigStmt
{
162 163 164 165 166 167 168 169 170 171 172 173
	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 */
174
} CreateTrigStmt;
175

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


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

typedef struct DropPLangStmt
{
	NodeTag		type;
	char	   *plname;			/* PL name */
201
} DropPLangStmt;
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
/* ----------------------
 *              Create/Alter/Drop User Statements
 * ----------------------
 */
typedef struct CreateUserStmt
{
        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  */
} CreateUserStmt;

typedef CreateUserStmt        AlterUserStmt;

typedef struct DropUserStmt
{
        NodeTag         type;
        char*           user;           /* PostgreSQL user login              */
} DropUserStmt;


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

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

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

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

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

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

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

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

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

/* ----------------------
332
 *		Create Function Statement
333 334
 * ----------------------
 */
335 336
typedef struct ProcedureStmt
{
337 338 339
	NodeTag		type;
	char	   *funcname;		/* name of function to create */
	List	   *defArgs;		/* list of definitions a list of strings
340
								 * (as Value *) */
341
	Node	   *returnType;		/* the return type (as a string or a
342
								 * TypeName (ie.setof) */
343 344 345
	List	   *withClause;		/* a list of ParamString */
	char	   *as;				/* the SQL statement or filename */
	char	   *language;		/* C or SQL */
346
} ProcedureStmt;
347

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

563 564

/*****************************************************************************
565
 *		Optimizable Statements
566 567 568
 *****************************************************************************/

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

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

/* ----------------------
599
 *		Update Statement
600 601
 * ----------------------
 */
B
Bruce Momjian 已提交
602
typedef struct UpdateStmt
603
{
604 605 606 607 608
	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 已提交
609
} UpdateStmt;
610 611

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


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

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

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

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

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

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

/*
 * ColumnDef - column definition (used in various creates)
 */
702 703
typedef struct ColumnDef
{
704 705 706 707 708
	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 */
709 710
	List	   *constraints;	/* constraints on column */
} ColumnDef;
711 712

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

891
#endif							/* PARSENODES_H */