summaryrefslogtreecommitdiff
path: root/src/test/regress/sql/join.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/sql/join.sql')
-rw-r--r--src/test/regress/sql/join.sql25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql
index 27e7e741a15..ccbbe5454c5 100644
--- a/src/test/regress/sql/join.sql
+++ b/src/test/regress/sql/join.sql
@@ -625,6 +625,31 @@ LEFT JOIN (
WHERE d.f1 IS NULL;
--
+-- basic semijoin and antijoin recognition tests
+--
+
+explain (costs off)
+select a.* from tenk1 a
+where unique1 in (select unique2 from tenk1 b);
+
+-- sadly, this is not an antijoin
+explain (costs off)
+select a.* from tenk1 a
+where unique1 not in (select unique2 from tenk1 b);
+
+explain (costs off)
+select a.* from tenk1 a
+where exists (select 1 from tenk1 b where a.unique1 = b.unique2);
+
+explain (costs off)
+select a.* from tenk1 a
+where not exists (select 1 from tenk1 b where a.unique1 = b.unique2);
+
+explain (costs off)
+select a.* from tenk1 a left join tenk1 b on a.unique1 = b.unique2
+where b.unique2 is null;
+
+--
-- regression test for proper handling of outer joins within antijoins
--