PostgreSQL Source Code  git master
nodeFuncs.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * nodeFuncs.h
4  * Various general-purpose manipulations of Node trees
5  *
6  * Portions Copyright (c) 1996-2017, 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 
16 #include "nodes/parsenodes.h"
17 
18 
19 /* flags bits for query_tree_walker and query_tree_mutator */
20 #define QTW_IGNORE_RT_SUBQUERIES 0x01 /* subqueries in rtable */
21 #define QTW_IGNORE_CTE_SUBQUERIES 0x02 /* subqueries in cteList */
22 #define QTW_IGNORE_RC_SUBQUERIES 0x03 /* both of above */
23 #define QTW_IGNORE_JOINALIASES 0x04 /* JOIN alias var lists */
24 #define QTW_IGNORE_RANGE_TABLE 0x08 /* skip rangetable entirely */
25 #define QTW_EXAMINE_RTES 0x10 /* examine RTEs */
26 #define QTW_DONT_COPY_QUERY 0x20 /* do not copy top Query */
27 
28 /* callback function for check_functions_in_node */
29 typedef bool (*check_function_callback) (Oid func_id, void *context);
30 
31 
32 extern Oid exprType(const Node *expr);
33 extern int32 exprTypmod(const Node *expr);
34 extern bool exprIsLengthCoercion(const Node *expr, int32 *coercedTypmod);
35 extern Node *relabel_to_typmod(Node *expr, int32 typmod);
36 extern Node *strip_implicit_coercions(Node *node);
37 extern bool expression_returns_set(Node *clause);
38 
39 extern Oid exprCollation(const Node *expr);
40 extern Oid exprInputCollation(const Node *expr);
41 extern void exprSetCollation(Node *expr, Oid collation);
42 extern void exprSetInputCollation(Node *expr, Oid inputcollation);
43 
44 extern int exprLocation(const Node *expr);
45 
46 extern void fix_opfuncids(Node *node);
47 extern void set_opfuncid(OpExpr *opexpr);
48 extern void set_sa_opfuncid(ScalarArrayOpExpr *opexpr);
49 
50 extern bool check_functions_in_node(Node *node, check_function_callback checker,
51  void *context);
52 
53 extern bool expression_tree_walker(Node *node, bool (*walker) (),
54  void *context);
55 extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (),
56  void *context);
57 
58 extern bool query_tree_walker(Query *query, bool (*walker) (),
59  void *context, int flags);
60 extern Query *query_tree_mutator(Query *query, Node *(*mutator) (),
61  void *context, int flags);
62 
63 extern bool range_table_walker(List *rtable, bool (*walker) (),
64  void *context, int flags);
65 extern List *range_table_mutator(List *rtable, Node *(*mutator) (),
66  void *context, int flags);
67 
68 extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (),
69  void *context, int flags);
70 extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator) (),
71  void *context, int flags);
72 
73 extern bool raw_expression_tree_walker(Node *node, bool (*walker) (),
74  void *context);
75 
76 struct PlanState;
77 extern bool planstate_tree_walker(struct PlanState *planstate, bool (*walker) (),
78  void *context);
79 
80 #endif /* NODEFUNCS_H */
Query * query_tree_mutator(Query *query, Node *(*mutator)(), void *context, int flags)
Definition: nodeFuncs.c:3068
Node * relabel_to_typmod(Node *expr, int32 typmod)
Definition: nodeFuncs.c:588
Definition: nodes.h:512
unsigned int Oid
Definition: postgres_ext.h:31
Node * expression_tree_mutator(Node *node, Node *(*mutator)(), void *context)
Definition: nodeFuncs.c:2409
bool planstate_tree_walker(struct PlanState *planstate, bool(*walker)(), void *context)
Definition: nodeFuncs.c:3697
char bool
Definition: c.h:257
signed int int32
Definition: c.h:294
Oid exprType(const Node *expr)
Definition: nodeFuncs.c:42
void fix_opfuncids(Node *node)
Definition: nodeFuncs.c:1582
bool exprIsLengthCoercion(const Node *expr, int32 *coercedTypmod)
Definition: nodeFuncs.c:513
bool check_functions_in_node(Node *node, check_function_callback checker, void *context)
Definition: nodeFuncs.c:1651
Node * query_or_expression_tree_mutator(Node *node, Node *(*mutator)(), void *context, int flags)
Definition: nodeFuncs.c:3201
Oid exprCollation(const Node *expr)
Definition: nodeFuncs.c:720
void set_sa_opfuncid(ScalarArrayOpExpr *opexpr)
Definition: nodeFuncs.c:1624
bool raw_expression_tree_walker(Node *node, bool(*walker)(), void *context)
Definition: nodeFuncs.c:3232
int32 exprTypmod(const Node *expr)
Definition: nodeFuncs.c:276
Node * strip_implicit_coercions(Node *node)
Definition: nodeFuncs.c:612
bool expression_returns_set(Node *clause)
Definition: nodeFuncs.c:670
bool query_tree_walker(Query *query, bool(*walker)(), void *context, int flags)
Definition: nodeFuncs.c:2245
bool expression_tree_walker(Node *node, bool(*walker)(), void *context)
Definition: nodeFuncs.c:1834
void exprSetInputCollation(Node *expr, Oid inputcollation)
Definition: nodeFuncs.c:1122
Oid exprInputCollation(const Node *expr)
Definition: nodeFuncs.c:921
List * range_table_mutator(List *rtable, Node *(*mutator)(), void *context, int flags)
Definition: nodeFuncs.c:3107
int exprLocation(const Node *expr)
Definition: nodeFuncs.c:1186
bool query_or_expression_tree_walker(Node *node, bool(*walker)(), void *context, int flags)
Definition: nodeFuncs.c:3178
bool(* check_function_callback)(Oid func_id, void *context)
Definition: nodeFuncs.h:29
void exprSetCollation(Node *expr, Oid collation)
Definition: nodeFuncs.c:969
bool range_table_walker(List *rtable, bool(*walker)(), void *context, int flags)
Definition: nodeFuncs.c:2289
void set_opfuncid(OpExpr *opexpr)
Definition: nodeFuncs.c:1613
Definition: pg_list.h:45