diff options
| author | Tom Lane | 2023-06-12 14:01:26 +0000 |
|---|---|---|
| committer | Tom Lane | 2023-06-12 14:01:26 +0000 |
| commit | bfd332b3fda5c73e28c05b7ba0aac6cf053cdf00 (patch) | |
| tree | 7d29b08446723d1ed812546bc092c768be087a5c /src/test | |
| parent | 548d7260309008b146bd9eaa66f3c5be0a8d725a (diff) | |
Fix "wrong varnullingrels" for subquery nestloop parameters.
If we apply outer join identity 3 when relation C is a subquery
having lateral references to relation B, then the lateral references
within C continue to bear the original syntactically-correct
varnullingrels marks, but that won't match what is available from
the outer side of the nestloop. Compensate for that in
process_subquery_nestloop_params(). This is a slightly hacky fix,
but we certainly don't want to re-plan C in toto for each possible
outer join order, so there's not a lot of better alternatives.
Richard Guo and Tom Lane, per report from Markus Winand
Discussion: https://postgr.es/m/DFBB2D25-DE97-49CA-A60E-07C881EA59A7@winand.at
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/join.out | 18 | ||||
| -rw-r--r-- | src/test/regress/sql/join.sql | 7 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index d04648df3fd..4999c99f3bc 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -2589,6 +2589,24 @@ on t2.q2 = 123; -> Seq Scan on int8_tbl t5 (12 rows) +explain (costs off) +select * from int8_tbl t1 + left join int8_tbl t2 on true + left join lateral + (select * from int8_tbl t3 where t3.q1 = t2.q1 offset 0) s + on t2.q1 = 1; + QUERY PLAN +------------------------------------------- + Nested Loop Left Join + -> Seq Scan on int8_tbl t1 + -> Materialize + -> Nested Loop Left Join + Join Filter: (t2.q1 = 1) + -> Seq Scan on int8_tbl t2 + -> Seq Scan on int8_tbl t3 + Filter: (q1 = t2.q1) +(8 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 0308258a917..56ca759772b 100644 --- a/src/test/regress/sql/join.sql +++ b/src/test/regress/sql/join.sql @@ -514,6 +514,13 @@ select * from int8_tbl t1 left join left join int8_tbl t5 on t2.q1 = t5.q1 on t2.q2 = 123; +explain (costs off) +select * from int8_tbl t1 + left join int8_tbl t2 on true + left join lateral + (select * from int8_tbl t3 where t3.q1 = t2.q1 offset 0) s + on t2.q1 = 1; + -- -- check a case where we formerly got confused by conflicting sort orders -- in redundant merge join path keys |
