summaryrefslogtreecommitdiff
path: root/src/include/optimizer/planner.h
diff options
context:
space:
mode:
authorTom Lane2011-09-24 23:33:16 +0000
committerTom Lane2011-09-24 23:33:16 +0000
commit7741dd6590073719688891898e85f0cb73453159 (patch)
tree98b57a56460a9b9313609e598efe1b7cf11a6f13 /src/include/optimizer/planner.h
parent337c0b03614c45516f2c3ec956405713bb264d54 (diff)
Recognize self-contradictory restriction clauses for non-table relations.
The constraint exclusion feature checks for contradictions among scan restriction clauses, as well as contradictions between those clauses and a table's CHECK constraints. The first aspect of this testing can be useful for non-table relations (such as subqueries or functions-in-FROM), but the feature was coded with only the CHECK case in mind so we were applying it only to plain-table RTEs. Move the relation_excluded_by_constraints call so that it is applied to all RTEs not just plain tables. With the default setting of constraint_exclusion this results in no extra work, but with constraint_exclusion = ON we will detect optimizations that we missed before (at the cost of more planner cycles than we expended before). Per a gripe from Gunnlaugur Þór Briem. Experimentation with his example also showed we were not being very bright about the case where constraint exclusion is proven within a subquery within UNION ALL, so tweak the code to allow set_append_rel_pathlist to recognize such cases.
Diffstat (limited to 'src/include/optimizer/planner.h')
-rw-r--r--src/include/optimizer/planner.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/optimizer/planner.h b/src/include/optimizer/planner.h
index 01fc1fc5d4a..77a5a43421d 100644
--- a/src/include/optimizer/planner.h
+++ b/src/include/optimizer/planner.h
@@ -35,6 +35,8 @@ extern Plan *subquery_planner(PlannerGlobal *glob, Query *parse,
bool hasRecursion, double tuple_fraction,
PlannerInfo **subroot);
+extern bool is_dummy_plan(Plan *plan);
+
extern Expr *expression_planner(Expr *expr);
extern bool plan_cluster_use_sort(Oid tableOid, Oid indexOid);