aboutsummaryrefslogtreecommitdiff
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.sql20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql
index 50dd37ec672..ea69186f107 100644
--- a/src/test/regress/sql/join.sql
+++ b/src/test/regress/sql/join.sql
@@ -908,6 +908,26 @@ explain (costs off)
select * from tenk1 a full join tenk1 b using(unique2) where unique2 = 42;
--
+-- test that quals attached to an outer join have correct semantics,
+-- specifically that they don't re-use expressions computed below the join;
+-- we force a mergejoin so that coalesce(b.q1, 1) appears as a join input
+--
+
+set enable_hashjoin to off;
+set enable_nestloop to off;
+
+explain (verbose, costs off)
+ select a.q2, b.q1
+ from int8_tbl a left join int8_tbl b on a.q2 = coalesce(b.q1, 1)
+ where coalesce(b.q1, 1) > 0;
+select a.q2, b.q1
+ from int8_tbl a left join int8_tbl b on a.q2 = coalesce(b.q1, 1)
+ where coalesce(b.q1, 1) > 0;
+
+reset enable_hashjoin;
+reset enable_nestloop;
+
+--
-- test join removal
--