Header And Logo

PostgreSQL
| The world's most advanced open source database.

nodeFuncs.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * nodeFuncs.h
00004  *      Various general-purpose manipulations of Node trees
00005  *
00006  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00007  * Portions Copyright (c) 1994, Regents of the University of California
00008  *
00009  * src/include/nodes/nodeFuncs.h
00010  *
00011  *-------------------------------------------------------------------------
00012  */
00013 #ifndef NODEFUNCS_H
00014 #define NODEFUNCS_H
00015 
00016 #include "nodes/parsenodes.h"
00017 
00018 
00019 /* flags bits for query_tree_walker and query_tree_mutator */
00020 #define QTW_IGNORE_RT_SUBQUERIES    0x01        /* subqueries in rtable */
00021 #define QTW_IGNORE_CTE_SUBQUERIES   0x02        /* subqueries in cteList */
00022 #define QTW_IGNORE_RC_SUBQUERIES    0x03        /* both of above */
00023 #define QTW_IGNORE_JOINALIASES      0x04        /* JOIN alias var lists */
00024 #define QTW_IGNORE_RANGE_TABLE      0x08        /* skip rangetable entirely */
00025 #define QTW_EXAMINE_RTES            0x10        /* examine RTEs */
00026 #define QTW_DONT_COPY_QUERY         0x20        /* do not copy top Query */
00027 
00028 
00029 extern Oid  exprType(const Node *expr);
00030 extern int32 exprTypmod(const Node *expr);
00031 extern bool exprIsLengthCoercion(const Node *expr, int32 *coercedTypmod);
00032 extern Node *relabel_to_typmod(Node *expr, int32 typmod);
00033 extern bool expression_returns_set(Node *clause);
00034 
00035 extern Oid  exprCollation(const Node *expr);
00036 extern Oid  exprInputCollation(const Node *expr);
00037 extern void exprSetCollation(Node *expr, Oid collation);
00038 extern void exprSetInputCollation(Node *expr, Oid inputcollation);
00039 
00040 extern int  exprLocation(const Node *expr);
00041 
00042 extern bool expression_tree_walker(Node *node, bool (*walker) (),
00043                                                void *context);
00044 extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (),
00045                                                  void *context);
00046 
00047 extern bool query_tree_walker(Query *query, bool (*walker) (),
00048                                           void *context, int flags);
00049 extern Query *query_tree_mutator(Query *query, Node *(*mutator) (),
00050                                              void *context, int flags);
00051 
00052 extern bool range_table_walker(List *rtable, bool (*walker) (),
00053                                            void *context, int flags);
00054 extern List *range_table_mutator(List *rtable, Node *(*mutator) (),
00055                                              void *context, int flags);
00056 
00057 extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (),
00058                                                    void *context, int flags);
00059 extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator) (),
00060                                                    void *context, int flags);
00061 
00062 extern bool raw_expression_tree_walker(Node *node, bool (*walker) (),
00063                                                    void *context);
00064 
00065 #endif   /* NODEFUNCS_H */