aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/expected/join.out
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/expected/join.out')
-rw-r--r--src/test/regress/expected/join.out54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out
index 6b16c3a6769..8d1d3ec1dcf 100644
--- a/src/test/regress/expected/join.out
+++ b/src/test/regress/expected/join.out
@@ -2926,6 +2926,60 @@ select tt1.*, tt2.* from tt2 right join tt1 on tt1.joincol = tt2.joincol;
reset enable_hashjoin;
reset enable_nestloop;
--
+-- regression test for bug #18522 (merge-right-anti-join in inner_unique cases)
+--
+create temp table tbl_ra(a int unique, b int);
+insert into tbl_ra select i, i%100 from generate_series(1,1000)i;
+create index on tbl_ra (b);
+analyze tbl_ra;
+set enable_hashjoin to off;
+set enable_nestloop to off;
+-- ensure we get a merge right anti join
+explain (costs off)
+select * from tbl_ra t1
+where not exists (select 1 from tbl_ra t2 where t2.b = t1.a) and t1.b < 2;
+ QUERY PLAN
+-------------------------------------------------------
+ Merge Right Anti Join
+ Merge Cond: (t2.b = t1.a)
+ -> Index Only Scan using tbl_ra_b_idx on tbl_ra t2
+ -> Sort
+ Sort Key: t1.a
+ -> Bitmap Heap Scan on tbl_ra t1
+ Recheck Cond: (b < 2)
+ -> Bitmap Index Scan on tbl_ra_b_idx
+ Index Cond: (b < 2)
+(9 rows)
+
+-- and check we get the expected results
+select * from tbl_ra t1
+where not exists (select 1 from tbl_ra t2 where t2.b = t1.a) and t1.b < 2;
+ a | b
+------+---
+ 100 | 0
+ 101 | 1
+ 200 | 0
+ 201 | 1
+ 300 | 0
+ 301 | 1
+ 400 | 0
+ 401 | 1
+ 500 | 0
+ 501 | 1
+ 600 | 0
+ 601 | 1
+ 700 | 0
+ 701 | 1
+ 800 | 0
+ 801 | 1
+ 900 | 0
+ 901 | 1
+ 1000 | 0
+(19 rows)
+
+reset enable_hashjoin;
+reset enable_nestloop;
+--
-- regression test for bug #13908 (hash join with skew tuples & nbatch increase)
--
set work_mem to '64kB';