summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util/restrictinfo.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-04-20 15:19:16 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-04-20 15:19:16 -0400
commit8b6294c7a560c115fb9027e9cc5a3eee17fdf419 (patch)
tree4b3fb856fbcd756144d42ddba4e5ac34c98e2e7d /src/backend/optimizer/util/restrictinfo.c
parent68fab04f7c2a07c5308e3d2957198ccd7a80ebc5 (diff)
Change more places to be less trusting of RestrictInfo.is_pushed_down.
On further reflection, commit e5d83995e didn't go far enough: pretty much everywhere in the planner that examines a clause's is_pushed_down flag ought to be changed to use the more complicated behavior where we also check the clause's required_relids. Otherwise we could make incorrect decisions about whether, say, a clause is safe to use as a hash clause. Some (many?) of these places are safe as-is, either because they are never reached while considering a parameterized path, or because there are additional checks that would reject a pushed-down clause anyway. However, it seems smarter to just code them all the same way rather than rely on easily-broken reasoning of that sort. In support of that, invent a new macro RINFO_IS_PUSHED_DOWN that should be used in place of direct tests on the is_pushed_down flag. Like the previous patch, back-patch to all supported branches. Discussion: https://postgr.es/m/f8128b11-c5bf-3539-48cd-234178b2314d@proxel.se
Diffstat (limited to 'src/backend/optimizer/util/restrictinfo.c')
-rw-r--r--src/backend/optimizer/util/restrictinfo.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c
index fd66c1303db..d5652b0f728 100644
--- a/src/backend/optimizer/util/restrictinfo.c
+++ b/src/backend/optimizer/util/restrictinfo.c
@@ -371,7 +371,7 @@ extract_actual_clauses(List *restrictinfo_list,
* extract_actual_join_clauses
*
* Extract bare clauses from 'restrictinfo_list', separating those that
- * syntactically match the join level from those that were pushed down.
+ * semantically match the join level from those that were pushed down.
* Pseudoconstant clauses are excluded from the results.
*
* This is only used at outer joins, since for plain joins we don't care
@@ -392,15 +392,7 @@ extract_actual_join_clauses(List *restrictinfo_list,
{
RestrictInfo *rinfo = lfirst_node(RestrictInfo, l);
- /*
- * We must check both is_pushed_down and required_relids, since an
- * outer-join clause that's been pushed down to some lower join level
- * via path parameterization will not be marked is_pushed_down;
- * nonetheless, it must be treated as a filter clause not a join
- * clause so far as the lower join level is concerned.
- */
- if (rinfo->is_pushed_down ||
- !bms_is_subset(rinfo->required_relids, joinrelids))
+ if (RINFO_IS_PUSHED_DOWN(rinfo, joinrelids))
{
if (!rinfo->pseudoconstant)
*otherquals = lappend(*otherquals, rinfo->clause);