1 /*-------------------------------------------------------------------------
4 * Routines to access various components and subcomponents of
8 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
11 * $Id: parsetree.h,v 1.15 2001/10/28 06:26:08 momjian Exp $
13 *-------------------------------------------------------------------------
18 #include "nodes/parsenodes.h"
19 #include "nodes/pg_list.h" /* for nth(), etc */
31 * Access and (destructively) replace rangetable entries.
33 #define rt_fetch(rangetable_index, rangetable) \
34 ((RangeTblEntry *) nth((rangetable_index)-1, rangetable))
36 #define rt_store(rangetable_index, rangetable, rt) \
37 set_nth(rangetable, (rangetable_index)-1, rt)
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.
46 #define getrelid(rangeindex,rangetable) \
47 (rt_fetch(rangeindex, rangetable)->relid)
50 * Given an RTE and an attribute number, return the appropriate
51 * variable name or alias for that attribute of that RTE.
53 extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum);
55 #endif /* PARSETREE_H */