diff options
| author | Tom Lane | 2019-03-14 16:16:09 +0000 |
|---|---|---|
| committer | Tom Lane | 2019-03-14 16:16:36 +0000 |
| commit | 0a9d7e1f6d814799e6cd5046513702dd1fe38929 (patch) | |
| tree | 8d7b24ba757fcfe6926b98173dee832477c62062 /src/test | |
| parent | 2455ab48844c90419714e27eafd235a85de23232 (diff) | |
Ensure dummy paths have correct required_outer if rel is parameterized.
The assertions added by commits 34ea1ab7f et al found another problem:
set_dummy_rel_pathlist and mark_dummy_rel were failing to label
the dummy paths they create with the correct outer_relids, in case
the relation is necessarily parameterized due to having lateral
references in its tlist. It's likely that this has no user-visible
consequences in production builds, at the moment; but still an assertion
failure is a bad thing, so back-patch the fix.
Per bug #15694 from Roman Zharkov (via Alexander Lakhin)
and an independent report by Tushar Ahuja.
Discussion: https://postgr.es/m/15694-74f2ca97e7044f7f@postgresql.org
Discussion: https://postgr.es/m/7d72ab20-c725-3ce2-f99d-4e64dd8a0de6@enterprisedb.com
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/join.out | 29 | ||||
| -rw-r--r-- | src/test/regress/sql/join.sql | 8 |
2 files changed, 37 insertions, 0 deletions
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index 593aec2f7d0..88fcd52ae1b 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -5380,6 +5380,35 @@ select * from Output: 3 (11 rows) +-- check dummy rels with lateral references (bug #15694) +explain (verbose, costs off) +select * from int8_tbl i8 left join lateral + (select *, i8.q2 from int4_tbl where false) ss on true; + QUERY PLAN +-------------------------------------- + Nested Loop Left Join + Output: i8.q1, i8.q2, f1, (i8.q2) + -> Seq Scan on public.int8_tbl i8 + Output: i8.q1, i8.q2 + -> Result + Output: f1, i8.q2 + One-Time Filter: false +(7 rows) + +explain (verbose, costs off) +select * from int8_tbl i8 left join lateral + (select *, i8.q2 from int4_tbl i1, int4_tbl i2 where false) ss on true; + QUERY PLAN +----------------------------------------- + Nested Loop Left Join + Output: i8.q1, i8.q2, f1, f1, (i8.q2) + -> Seq Scan on public.int8_tbl i8 + Output: i8.q1, i8.q2 + -> Result + Output: f1, f1, i8.q2 + One-Time Filter: false +(7 rows) + -- check handling of nested appendrels inside LATERAL select * from ((select 2 as v) union all (select 3 as v)) as q1 diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql index 34d21d029f0..c247509a567 100644 --- a/src/test/regress/sql/join.sql +++ b/src/test/regress/sql/join.sql @@ -1783,6 +1783,14 @@ select * from select * from (select 3 as z offset 0) z where z.z = x.x ) zz on zz.z = y.y; +-- check dummy rels with lateral references (bug #15694) +explain (verbose, costs off) +select * from int8_tbl i8 left join lateral + (select *, i8.q2 from int4_tbl where false) ss on true; +explain (verbose, costs off) +select * from int8_tbl i8 left join lateral + (select *, i8.q2 from int4_tbl i1, int4_tbl i2 where false) ss on true; + -- check handling of nested appendrels inside LATERAL select * from ((select 2 as v) union all (select 3 as v)) as q1 |
