summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-06-13 18:01:33 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2023-06-13 18:01:33 -0400
commit63e4f13d2a78124c798165814a679b0534db87a5 (patch)
treed8f62020c51f63d2a2ad6b6c3f73512a24a26ceb /src/test
parent792213f2e9f6d321d5a463f4a0fc263c2b770ac3 (diff)
Fix "wrong varnullingrels" for Memoize's lateral references, too.
The issue fixed in commit bfd332b3f can also bite Memoize plans, because of the separate copies of lateral reference Vars made by paraminfo_get_equal_hashops. Apply the same hacky fix there. (In passing, clean up shaky grammar in the existing comments for this function.) Richard Guo Discussion: https://postgr.es/m/CAMbWs4-krwk0Wbd6WdufMAupuou_Ua73ijQ4XQCr1Mb5BaVtKQ@mail.gmail.com
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/join.out21
-rw-r--r--src/test/regress/sql/join.sql7
2 files changed, 28 insertions, 0 deletions
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out
index 4999c99f3bc..98b2667821e 100644
--- a/src/test/regress/expected/join.out
+++ b/src/test/regress/expected/join.out
@@ -2607,6 +2607,27 @@ select * from int8_tbl t1
Filter: (q1 = t2.q1)
(8 rows)
+explain (costs off)
+select * from onek t1
+ left join onek t2 on true
+ left join lateral
+ (select * from onek t3 where t3.two = t2.two offset 0) s
+ on t2.unique1 = 1;
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop Left Join
+ -> Seq Scan on onek t1
+ -> Materialize
+ -> Nested Loop Left Join
+ Join Filter: (t2.unique1 = 1)
+ -> Seq Scan on onek t2
+ -> Memoize
+ Cache Key: t2.two
+ Cache Mode: binary
+ -> Seq Scan on onek t3
+ Filter: (two = t2.two)
+(11 rows)
+
--
-- check a case where we formerly got confused by conflicting sort orders
-- in redundant merge join path keys
diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql
index 56ca759772b..7daa390b1d4 100644
--- a/src/test/regress/sql/join.sql
+++ b/src/test/regress/sql/join.sql
@@ -521,6 +521,13 @@ select * from int8_tbl t1
(select * from int8_tbl t3 where t3.q1 = t2.q1 offset 0) s
on t2.q1 = 1;
+explain (costs off)
+select * from onek t1
+ left join onek t2 on true
+ left join lateral
+ (select * from onek t3 where t3.two = t2.two offset 0) s
+ on t2.unique1 = 1;
+
--
-- check a case where we formerly got confused by conflicting sort orders
-- in redundant merge join path keys