summaryrefslogtreecommitdiff
path: root/src/include/optimizer
diff options
context:
space:
mode:
authorTom Lane2019-01-29 20:26:44 +0000
committerTom Lane2019-01-29 20:26:44 +0000
commita1b8c41e990ec0f083e9b684700a07640d5a356a (patch)
treedaa26b95223c1e2a09507973853aa77b91df7644 /src/include/optimizer
parente77cfa54d700557ea700d47454c9e570f20f1841 (diff)
Make some small planner API cleanups.
Move a few very simple node-creation and node-type-testing functions from the planner's clauses.c to nodes/makefuncs and nodes/nodeFuncs. There's nothing planner-specific about them, as evidenced by the number of other places that were using them. While at it, rename and_clause() etc to is_andclause() etc, to clarify that they are node-type-testing functions not node-creation functions. And use "static inline" implementations for the shortest ones. Also, modify flatten_join_alias_vars() and some subsidiary functions to take a Query not a PlannerInfo to define the join structure that Vars should be translated according to. They were only using the "parse" field of the PlannerInfo anyway, so this just requires removing one level of indirection. The advantage is that now parse_agg.c can use flatten_join_alias_vars() without the horrid kluge of creating an incomplete PlannerInfo, which will allow that file to be decoupled from relation.h in a subsequent patch. Discussion: https://postgr.es/m/11460.1548706639@sss.pgh.pa.us
Diffstat (limited to 'src/include/optimizer')
-rw-r--r--src/include/optimizer/clauses.h22
-rw-r--r--src/include/optimizer/prep.h2
-rw-r--r--src/include/optimizer/var.h2
3 files changed, 2 insertions, 24 deletions
diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h
index 6891d0dc9c0..3f5342886da 100644
--- a/src/include/optimizer/clauses.h
+++ b/src/include/optimizer/clauses.h
@@ -17,9 +17,6 @@
#include "access/htup.h"
#include "nodes/relation.h"
-#define is_opclause(clause) ((clause) != NULL && IsA(clause, OpExpr))
-#define is_funcclause(clause) ((clause) != NULL && IsA(clause, FuncExpr))
-
typedef struct
{
int numWindowFuncs; /* total number of WindowFuncs found */
@@ -27,25 +24,6 @@ typedef struct
List **windowFuncs; /* lists of WindowFuncs for each winref */
} WindowFuncLists;
-extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset,
- Expr *leftop, Expr *rightop,
- Oid opcollid, Oid inputcollid);
-extern Node *get_leftop(const Expr *clause);
-extern Node *get_rightop(const Expr *clause);
-
-extern bool not_clause(Node *clause);
-extern Expr *make_notclause(Expr *notclause);
-extern Expr *get_notclausearg(Expr *notclause);
-
-extern bool or_clause(Node *clause);
-extern Expr *make_orclause(List *orclauses);
-
-extern bool and_clause(Node *clause);
-extern Expr *make_andclause(List *andclauses);
-extern Node *make_and_qual(Node *qual1, Node *qual2);
-extern Expr *make_ands_explicit(List *andclauses);
-extern List *make_ands_implicit(Expr *clause);
-
extern bool contain_agg_clause(Node *clause);
extern void get_agg_clause_costs(PlannerInfo *root, Node *clause,
AggSplit aggsplit, AggClauseCosts *costs);
diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h
index a03a024ce93..17c44c46b9d 100644
--- a/src/include/optimizer/prep.h
+++ b/src/include/optimizer/prep.h
@@ -29,7 +29,7 @@ extern void flatten_simple_union_all(PlannerInfo *root);
extern void reduce_outer_joins(PlannerInfo *root);
extern void remove_useless_result_rtes(PlannerInfo *root);
extern Relids get_relids_in_jointree(Node *jtnode, bool include_joins);
-extern Relids get_relids_for_join(PlannerInfo *root, int joinrelid);
+extern Relids get_relids_for_join(Query *query, int joinrelid);
/*
* prototypes for prepqual.c
diff --git a/src/include/optimizer/var.h b/src/include/optimizer/var.h
index a0c1387094a..f975074bf0b 100644
--- a/src/include/optimizer/var.h
+++ b/src/include/optimizer/var.h
@@ -35,6 +35,6 @@ extern bool contain_var_clause(Node *node);
extern bool contain_vars_of_level(Node *node, int levelsup);
extern int locate_var_of_level(Node *node, int levelsup);
extern List *pull_var_clause(Node *node, int flags);
-extern Node *flatten_join_alias_vars(PlannerInfo *root, Node *node);
+extern Node *flatten_join_alias_vars(Query *query, Node *node);
#endif /* VAR_H */