2
0

parsetree.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*-------------------------------------------------------------------------
  2. *
  3. * parsetree.h
  4. * Routines to access various components and subcomponents of
  5. * parse trees.
  6. *
  7. *
  8. * Portions Copyright (c) 1996-2022, 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. #include "nodes/parsenodes.h"
  18. /* ----------------
  19. * range table operations
  20. * ----------------
  21. */
  22. /*
  23. * rt_fetch
  24. *
  25. * NB: this will crash and burn if handed an out-of-range RT index
  26. */
  27. #define rt_fetch(rangetable_index, rangetable) \
  28. ((RangeTblEntry *) list_nth(rangetable, (rangetable_index)-1))
  29. /*
  30. * Given an RTE and an attribute number, return the appropriate
  31. * variable name or alias for that attribute of that RTE.
  32. */
  33. extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum);
  34. /*
  35. * Check whether an attribute of an RTE has been dropped
  36. */
  37. extern bool get_rte_attribute_is_dropped(RangeTblEntry *rte,
  38. AttrNumber attnum);
  39. /* ----------------
  40. * target list operations
  41. * ----------------
  42. */
  43. extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno);
  44. /* ----------------
  45. * FOR UPDATE/SHARE info
  46. * ----------------
  47. */
  48. extern RowMarkClause *get_parse_rowmark(Query *qry, Index rtindex);
  49. #endif /* PARSETREE_H */