1 /*-------------------------------------------------------------------------
4 * Routines to access various components and subcomponents of
8 * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
11 * $PostgreSQL: pgsql/src/include/parser/parsetree.h,v 1.24 2004/05/26 04:41:46 neilc Exp $
13 *-------------------------------------------------------------------------
18 #include "nodes/parsenodes.h"
19 #include "nodes/pg_list.h" /* for list_nth(), etc */
23 * range table operations
30 * NB: this will crash and burn if handed an out-of-range RT index
32 #define rt_fetch(rangetable_index, rangetable) \
33 ((RangeTblEntry *) list_nth(rangetable, (rangetable_index)-1))
38 * Given the range index of a relation, return the corresponding
39 * relation OID. Note that InvalidOid will be returned if the
40 * RTE is for a non-relation-type RTE.
42 #define getrelid(rangeindex,rangetable) \
43 (rt_fetch(rangeindex, rangetable)->relid)
46 * Given an RTE and an attribute number, return the appropriate
47 * variable name or alias for that attribute of that RTE.
49 extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum);
52 * Given an RTE and an attribute number, return the appropriate
53 * type and typemod info for that attribute of that RTE.
55 extern void get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
56 Oid *vartype, int32 *vartypmod);
60 * target list operations
64 extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno);
66 #endif /* PARSETREE_H */