Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef REWRITEMANIP_H
00015 #define REWRITEMANIP_H
00016
00017 #include "nodes/parsenodes.h"
00018
00019
00020 typedef struct replace_rte_variables_context replace_rte_variables_context;
00021
00022 typedef Node *(*replace_rte_variables_callback) (Var *var,
00023 replace_rte_variables_context *context);
00024
00025 struct replace_rte_variables_context
00026 {
00027 replace_rte_variables_callback callback;
00028 void *callback_arg;
00029 int target_varno;
00030 int sublevels_up;
00031 bool inserted_sublink;
00032 };
00033
00034 typedef enum ReplaceVarsNoMatchOption
00035 {
00036 REPLACEVARS_REPORT_ERROR,
00037 REPLACEVARS_CHANGE_VARNO,
00038 REPLACEVARS_SUBSTITUTE_NULL
00039 } ReplaceVarsNoMatchOption;
00040
00041
00042 extern void OffsetVarNodes(Node *node, int offset, int sublevels_up);
00043 extern void ChangeVarNodes(Node *node, int old_varno, int new_varno,
00044 int sublevels_up);
00045 extern void IncrementVarSublevelsUp(Node *node, int delta_sublevels_up,
00046 int min_sublevels_up);
00047 extern void IncrementVarSublevelsUp_rtable(List *rtable,
00048 int delta_sublevels_up, int min_sublevels_up);
00049
00050 extern bool rangeTableEntry_used(Node *node, int rt_index,
00051 int sublevels_up);
00052 extern bool attribute_used(Node *node, int rt_index, int attno,
00053 int sublevels_up);
00054
00055 extern Query *getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr);
00056
00057 extern void AddQual(Query *parsetree, Node *qual);
00058 extern void AddInvertedQual(Query *parsetree, Node *qual);
00059
00060 extern bool contain_aggs_of_level(Node *node, int levelsup);
00061 extern int locate_agg_of_level(Node *node, int levelsup);
00062 extern bool contain_windowfuncs(Node *node);
00063 extern int locate_windowfunc(Node *node);
00064 extern bool checkExprHasSubLink(Node *node);
00065
00066 extern Node *replace_rte_variables(Node *node,
00067 int target_varno, int sublevels_up,
00068 replace_rte_variables_callback callback,
00069 void *callback_arg,
00070 bool *outer_hasSubLinks);
00071 extern Node *replace_rte_variables_mutator(Node *node,
00072 replace_rte_variables_context *context);
00073
00074 extern Node *map_variable_attnos(Node *node,
00075 int target_varno, int sublevels_up,
00076 const AttrNumber *attno_map, int map_length,
00077 bool *found_whole_row);
00078
00079 extern Node *ReplaceVarsFromTargetList(Node *node,
00080 int target_varno, int sublevels_up,
00081 RangeTblEntry *target_rte,
00082 List *targetlist,
00083 ReplaceVarsNoMatchOption nomatch_option,
00084 int nomatch_varno,
00085 bool *outer_hasSubLinks);
00086
00087 #endif