summaryrefslogtreecommitdiff
path: root/src/test/regress/expected/join.out
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-11-05 15:24:36 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-11-05 15:24:36 -0400
commitff8fa0bf7eb9001f321c2af4bbe9c0f2bd5c1bf8 (patch)
tree7cadb5dc4c18bee125ac600864bf7c2c5bbd9fa5 /src/test/regress/expected/join.out
parentc3652cd84ac8aa60dd09a9743d4db6f20e985a2f (diff)
downloadpostgresql-ff8fa0bf7eb9001f321c2af4bbe9c0f2bd5c1bf8.tar.gz
Handle SubPlan cases in find_nonnullable_rels/vars.
We can use some variants of SubPlan to deduce that Vars appearing in the testexpr must be non-null. Richard Guo Discussion: https://postgr.es/m/CAMbWs4-jV=199A2Y_6==99dYnpnmaO_Wz_RGkRTTaCB=Pihw2w@mail.gmail.com
Diffstat (limited to 'src/test/regress/expected/join.out')
-rw-r--r--src/test/regress/expected/join.out28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out
index b901d7299f..9358371072 100644
--- a/src/test/regress/expected/join.out
+++ b/src/test/regress/expected/join.out
@@ -4651,6 +4651,34 @@ select a.q2, b.q1
reset enable_hashjoin;
reset enable_nestloop;
--
+-- test join strength reduction with a SubPlan providing the proof
+--
+explain (costs off)
+select a.unique1, b.unique2
+ from onek a left join onek b on a.unique1 = b.unique2
+ where b.unique2 = any (select q1 from int8_tbl c where c.q1 < b.unique1);
+ QUERY PLAN
+----------------------------------------------------------
+ Hash Join
+ Hash Cond: (b.unique2 = a.unique1)
+ -> Seq Scan on onek b
+ Filter: (SubPlan 1)
+ SubPlan 1
+ -> Seq Scan on int8_tbl c
+ Filter: (q1 < b.unique1)
+ -> Hash
+ -> Index Only Scan using onek_unique1 on onek a
+(9 rows)
+
+select a.unique1, b.unique2
+ from onek a left join onek b on a.unique1 = b.unique2
+ where b.unique2 = any (select q1 from int8_tbl c where c.q1 < b.unique1);
+ unique1 | unique2
+---------+---------
+ 123 | 123
+(1 row)
+
+--
-- test join removal
--
begin;