summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util/restrictinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/util/restrictinfo.c')
-rw-r--r--src/backend/optimizer/util/restrictinfo.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c
index 87dc3431eb8..cc0b747008e 100644
--- a/src/backend/optimizer/util/restrictinfo.c
+++ b/src/backend/optimizer/util/restrictinfo.c
@@ -418,6 +418,7 @@ extract_actual_clauses(List *restrictinfo_list,
*/
void
extract_actual_join_clauses(List *restrictinfo_list,
+ Relids joinrelids,
List **joinquals,
List **otherquals)
{
@@ -432,7 +433,15 @@ extract_actual_join_clauses(List *restrictinfo_list,
Assert(IsA(rinfo, RestrictInfo));
- if (rinfo->is_pushed_down)
+ /*
+ * 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->pseudoconstant)
*otherquals = lappend(*otherquals, rinfo->clause);