1 /*-------------------------------------------------------------------------
4 * Routines to access various components and subcomponents of
8 * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
11 * src/include/parser/parsetree.h
13 *-------------------------------------------------------------------------
18 #include "nodes/parsenodes.h"
22 * range table operations
29 * NB: this will crash and burn if handed an out-of-range RT index
31 #define rt_fetch(rangetable_index, rangetable) \
32 ((RangeTblEntry *) list_nth(rangetable, (rangetable_index)-1))
37 * Given the range index of a relation, return the corresponding
38 * relation OID. Note that InvalidOid will be returned if the
39 * RTE is for a non-relation-type RTE.
41 #define getrelid(rangeindex,rangetable) \
42 (rt_fetch(rangeindex, rangetable)->relid)
45 * Given an RTE and an attribute number, return the appropriate
46 * variable name or alias for that attribute of that RTE.
48 extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum);
51 * Given an RTE and an attribute number, return the appropriate
52 * type and typemod info for that attribute of that RTE.
54 extern void get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
55 Oid *vartype, int32 *vartypmod, Oid *varcollid);
58 * Check whether an attribute of an RTE has been dropped (note that
59 * get_rte_attribute_type will fail on such an attr)
61 extern bool get_rte_attribute_is_dropped(RangeTblEntry *rte,
66 * target list operations
70 extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno);
73 * FOR UPDATE/SHARE info
77 extern RowMarkClause *get_parse_rowmark(Query *qry, Index rtindex);
79 #endif /* PARSETREE_H */