summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/join.out16
-rw-r--r--src/test/regress/sql/join.sql5
2 files changed, 21 insertions, 0 deletions
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out
index 9bafadde66f..8fa2b376f3a 100644
--- a/src/test/regress/expected/join.out
+++ b/src/test/regress/expected/join.out
@@ -5432,6 +5432,22 @@ select d.* from d left join (select distinct * from b) s
-> Seq Scan on d
(9 rows)
+-- join removal is not possible here
+explain (costs off)
+select 1 from a t1
+ left join (a t2 left join a t3 on t2.id = 1) on t2.id = 1;
+ QUERY PLAN
+--------------------------------------------------------
+ Nested Loop Left Join
+ -> Seq Scan on a t1
+ -> Materialize
+ -> Nested Loop Left Join
+ Join Filter: (t2.id = 1)
+ -> Index Only Scan using a_pkey on a t2
+ Index Cond: (id = 1)
+ -> Seq Scan on a t3
+(8 rows)
+
-- check join removal works when uniqueness of the join condition is enforced
-- by a UNION
explain (costs off)
diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql
index a44234b0af7..641fd1a21b9 100644
--- a/src/test/regress/sql/join.sql
+++ b/src/test/regress/sql/join.sql
@@ -1958,6 +1958,11 @@ explain (costs off)
select d.* from d left join (select distinct * from b) s
on d.a = s.id;
+-- join removal is not possible here
+explain (costs off)
+select 1 from a t1
+ left join (a t2 left join a t3 on t2.id = 1) on t2.id = 1;
+
-- check join removal works when uniqueness of the join condition is enforced
-- by a UNION
explain (costs off)