1 /*------------------------------------------------------------------------- 2 * 3 * parsetree.h 4 * Routines to access various components and subcomponents of 5 * parse trees. 6 * 7 * 8 * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group 9 * Portions Copyright (c) 1994, Regents of the University of California 10 * 11 * src/include/parser/parsetree.h 12 * 13 *------------------------------------------------------------------------- 14 */ 15 #ifndef PARSETREE_H 16 #define PARSETREE_H 17 18 #include "nodes/parsenodes.h" 19 20 21 /* ---------------- 22 * range table operations 23 * ---------------- 24 */ 25 26 /* 27 * rt_fetch 28 * 29 * NB: this will crash and burn if handed an out-of-range RT index 30 */ 31 #define rt_fetch(rangetable_index, rangetable) \ 32 ((RangeTblEntry *) list_nth(rangetable, (rangetable_index)-1)) 33 34 /* 35 * Given an RTE and an attribute number, return the appropriate 36 * variable name or alias for that attribute of that RTE. 37 */ 38 extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum); 39 40 /* 41 * Check whether an attribute of an RTE has been dropped 42 */ 43 extern bool get_rte_attribute_is_dropped(RangeTblEntry *rte, 44 AttrNumber attnum); 45 46 47 /* ---------------- 48 * target list operations 49 * ---------------- 50 */ 51 52 extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno); 53 54 /* ---------------- 55 * FOR UPDATE/SHARE info 56 * ---------------- 57 */ 58 59 extern RowMarkClause *get_parse_rowmark(Query *qry, Index rtindex); 60 61 #endif /* PARSETREE_H */ 62