Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a9d7e1

Browse files
committed
Ensure dummy paths have correct required_outer if rel is parameterized.
The assertions added by commits34ea1ab et al found another problem:set_dummy_rel_pathlist and mark_dummy_rel were failing to labelthe dummy paths they create with the correct outer_relids, in casethe relation is necessarily parameterized due to having lateralreferences in its tlist. It's likely that this has no user-visibleconsequences in production builds, at the moment; but still an assertionfailure 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.orgDiscussion:https://postgr.es/m/7d72ab20-c725-3ce2-f99d-4e64dd8a0de6@enterprisedb.com
1 parent2455ab4 commit0a9d7e1

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

‎src/backend/optimizer/path/allpaths.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,8 @@ set_dummy_rel_pathlist(RelOptInfo *rel)
19731973
rel->partial_pathlist=NIL;
19741974

19751975
/* Set up the dummy path */
1976-
add_path(rel, (Path*)create_append_path(NULL,rel,NIL,NIL,NULL,
1976+
add_path(rel, (Path*)create_append_path(NULL,rel,NIL,NIL,
1977+
rel->lateral_relids,
19771978
0, false,NIL,-1));
19781979

19791980
/*

‎src/backend/optimizer/path/joinrels.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,8 @@ mark_dummy_rel(RelOptInfo *rel)
12641264
rel->partial_pathlist=NIL;
12651265

12661266
/* Set up the dummy path */
1267-
add_path(rel, (Path*)create_append_path(NULL,rel,NIL,NIL,NULL,
1267+
add_path(rel, (Path*)create_append_path(NULL,rel,NIL,NIL,
1268+
rel->lateral_relids,
12681269
0, false,NIL,-1));
12691270

12701271
/* Set or update cheapest_total_path and related fields */

‎src/test/regress/expected/join.out

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5380,6 +5380,35 @@ select * from
53805380
Output: 3
53815381
(11 rows)
53825382

5383+
-- check dummy rels with lateral references (bug #15694)
5384+
explain (verbose, costs off)
5385+
select * from int8_tbl i8 left join lateral
5386+
(select *, i8.q2 from int4_tbl where false) ss on true;
5387+
QUERY PLAN
5388+
--------------------------------------
5389+
Nested Loop Left Join
5390+
Output: i8.q1, i8.q2, f1, (i8.q2)
5391+
-> Seq Scan on public.int8_tbl i8
5392+
Output: i8.q1, i8.q2
5393+
-> Result
5394+
Output: f1, i8.q2
5395+
One-Time Filter: false
5396+
(7 rows)
5397+
5398+
explain (verbose, costs off)
5399+
select * from int8_tbl i8 left join lateral
5400+
(select *, i8.q2 from int4_tbl i1, int4_tbl i2 where false) ss on true;
5401+
QUERY PLAN
5402+
-----------------------------------------
5403+
Nested Loop Left Join
5404+
Output: i8.q1, i8.q2, f1, f1, (i8.q2)
5405+
-> Seq Scan on public.int8_tbl i8
5406+
Output: i8.q1, i8.q2
5407+
-> Result
5408+
Output: f1, f1, i8.q2
5409+
One-Time Filter: false
5410+
(7 rows)
5411+
53835412
-- check handling of nested appendrels inside LATERAL
53845413
select * from
53855414
((select 2 as v) union all (select 3 as v)) as q1

‎src/test/regress/sql/join.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,14 @@ select * from
17831783
select*from (select3as z offset0) zwherez.z=x.x
17841784
) zzonzz.z=y.y;
17851785

1786+
-- check dummy rels with lateral references (bug #15694)
1787+
explain (verbose, costs off)
1788+
select*from int8_tbl i8left join lateral
1789+
(select*,i8.q2from int4_tblwhere false) sson true;
1790+
explain (verbose, costs off)
1791+
select*from int8_tbl i8left join lateral
1792+
(select*,i8.q2from int4_tbl i1, int4_tbl i2where false) sson true;
1793+
17861794
-- check handling of nested appendrels inside LATERAL
17871795
select*from
17881796
((select2as v)union all (select3as v))as q1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp