1 /*-------------------------------------------------------------------------
4 * Querytree manipulation subroutines for query rewriter.
7 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
12 *-------------------------------------------------------------------------
14 #ifndef REWRITEMANIP_H
15 #define REWRITEMANIP_H
17 #include "nodes/parsenodes.h"
20 extern void OffsetVarNodes(Node
*node
, int offset
, int sublevels_up
);
21 extern void ChangeVarNodes(Node
*node
, int old_varno
, int new_varno
,
23 extern void IncrementVarSublevelsUp(Node
*node
, int delta_sublevels_up
,
24 int min_sublevels_up
);
25 extern void IncrementVarSublevelsUp_rtable(List
*rtable
,
26 int delta_sublevels_up
, int min_sublevels_up
);
28 extern bool rangeTableEntry_used(Node
*node
, int rt_index
,
30 extern bool attribute_used(Node
*node
, int rt_index
, int attno
,
33 extern Query
*getInsertSelectQuery(Query
*parsetree
, Query
***subquery_ptr
);
35 extern void AddQual(Query
*parsetree
, Node
*qual
);
36 extern void AddInvertedQual(Query
*parsetree
, Node
*qual
);
38 extern bool contain_aggs_of_level(Node
*node
, int levelsup
);
39 extern int locate_agg_of_level(Node
*node
, int levelsup
);
40 extern int locate_windowfunc(Node
*node
);
41 extern bool checkExprHasAggs(Node
*node
);
42 extern bool checkExprHasWindowFuncs(Node
*node
);
43 extern bool checkExprHasSubLink(Node
*node
);
45 extern Node
*ResolveNew(Node
*node
, int target_varno
, int sublevels_up
,
46 RangeTblEntry
*target_rte
,
47 List
*targetlist
, int event
, int update_varno
);
49 #endif /* REWRITEMANIP_H */