OSDN Git Service

Another pgindent run. Fixes enum indenting, and improves #endif
[pg-rex/syncrep.git] / src / include / parser / parsetree.h
1 /*-------------------------------------------------------------------------
2  *
3  * parsetree.h
4  *        Routines to access various components and subcomponents of
5  *        parse trees.
6  *
7  *
8  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
9  * Portions Copyright (c) 1994, Regents of the University of California
10  *
11  * $Id: parsetree.h,v 1.15 2001/10/28 06:26:08 momjian Exp $
12  *
13  *-------------------------------------------------------------------------
14  */
15 #ifndef PARSETREE_H
16 #define PARSETREE_H
17
18 #include "nodes/parsenodes.h"
19 #include "nodes/pg_list.h"              /* for nth(), etc */
20
21
22 /* ----------------
23  *              range table macros
24  * ----------------
25  */
26
27 /*
28  *              rt_fetch
29  *              rt_store
30  *
31  *              Access and (destructively) replace rangetable entries.
32  */
33 #define rt_fetch(rangetable_index, rangetable) \
34         ((RangeTblEntry *) nth((rangetable_index)-1, rangetable))
35
36 #define rt_store(rangetable_index, rangetable, rt) \
37         set_nth(rangetable, (rangetable_index)-1, rt)
38
39 /*
40  *              getrelid
41  *
42  *              Given the range index of a relation, return the corresponding
43  *              relation OID.  Note that InvalidOid will be returned if the
44  *              RTE is for a sub-select rather than a relation.
45  */
46 #define getrelid(rangeindex,rangetable) \
47         (rt_fetch(rangeindex, rangetable)->relid)
48
49 /*
50  * Given an RTE and an attribute number, return the appropriate
51  * variable name or alias for that attribute of that RTE.
52  */
53 extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum);
54
55 #endif   /* PARSETREE_H */