nodeFuncs.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*-------------------------------------------------------------------------
  2. *
  3. * nodeFuncs.h
  4. * Various general-purpose manipulations of Node trees
  5. *
  6. * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  7. * Portions Copyright (c) 1994, Regents of the University of California
  8. *
  9. * src/include/nodes/nodeFuncs.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef NODEFUNCS_H
  14. #define NODEFUNCS_H
  15. #include "nodes/parsenodes.h"
  16. /* flags bits for query_tree_walker and query_tree_mutator */
  17. #define QTW_IGNORE_RT_SUBQUERIES 0x01 /* subqueries in rtable */
  18. #define QTW_IGNORE_CTE_SUBQUERIES 0x02 /* subqueries in cteList */
  19. #define QTW_IGNORE_RC_SUBQUERIES 0x03 /* both of above */
  20. #define QTW_IGNORE_JOINALIASES 0x04 /* JOIN alias var lists */
  21. #define QTW_IGNORE_RANGE_TABLE 0x08 /* skip rangetable entirely */
  22. #define QTW_EXAMINE_RTES 0x10 /* examine RTEs */
  23. #define QTW_DONT_COPY_QUERY 0x20 /* do not copy top Query */
  24. /* callback function for check_functions_in_node */
  25. typedef bool (*check_function_callback) (Oid func_id, void *context);
  26. extern Oid exprType(const Node *expr);
  27. extern int32 exprTypmod(const Node *expr);
  28. extern bool exprIsLengthCoercion(const Node *expr, int32 *coercedTypmod);
  29. extern Node *relabel_to_typmod(Node *expr, int32 typmod);
  30. extern Node *strip_implicit_coercions(Node *node);
  31. extern bool expression_returns_set(Node *clause);
  32. extern Oid exprCollation(const Node *expr);
  33. extern Oid exprInputCollation(const Node *expr);
  34. extern void exprSetCollation(Node *expr, Oid collation);
  35. extern void exprSetInputCollation(Node *expr, Oid inputcollation);
  36. extern int exprLocation(const Node *expr);
  37. extern void fix_opfuncids(Node *node);
  38. extern void set_opfuncid(OpExpr *opexpr);
  39. extern void set_sa_opfuncid(ScalarArrayOpExpr *opexpr);
  40. extern bool check_functions_in_node(Node *node, check_function_callback checker,
  41. void *context);
  42. extern bool expression_tree_walker(Node *node, bool (*walker) (),
  43. void *context);
  44. extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (),
  45. void *context);
  46. extern bool query_tree_walker(Query *query, bool (*walker) (),
  47. void *context, int flags);
  48. extern Query *query_tree_mutator(Query *query, Node *(*mutator) (),
  49. void *context, int flags);
  50. extern bool range_table_walker(List *rtable, bool (*walker) (),
  51. void *context, int flags);
  52. extern List *range_table_mutator(List *rtable, Node *(*mutator) (),
  53. void *context, int flags);
  54. extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (),
  55. void *context, int flags);
  56. extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator) (),
  57. void *context, int flags);
  58. extern bool raw_expression_tree_walker(Node *node, bool (*walker) (),
  59. void *context);
  60. struct PlanState;
  61. extern bool planstate_tree_walker(struct PlanState *planstate, bool (*walker) (),
  62. void *context);
  63. #endif /* NODEFUNCS_H */