diff options
| author | Tom Lane | 2023-02-08 19:08:46 +0000 |
|---|---|---|
| committer | Tom Lane | 2023-02-08 19:08:46 +0000 |
| commit | 798c0176342150c8fe1404b0007b299db2e73ce0 (patch) | |
| tree | 3463c781263358e7ea19f6736ac784dfc0d81be0 /src/test | |
| parent | b7e84c65d5b2d694a669ae1db8ab1d6c51ef8596 (diff) | |
remove_rel_from_query() must clean up PlaceHolderVar.phrels fields.
While we got away with this sloppiness before, it's not okay now
that fee7b77b9 caused build_joinrel_tlist() to make use of phrels.
Per report from Robins Tharakan.
Richard Guo (some cosmetic tweaks by me)
Discussion: https://postgr.es/m/CAMbWs4_ngw9sKxpTE8hqk=-ooVX_CQP3DarA4HzkRMz_JKpTrA@mail.gmail.com
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/join.out | 16 | ||||
| -rw-r--r-- | src/test/regress/sql/join.sql | 7 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index 18b5e8f750..75f03fcf30 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -5052,6 +5052,22 @@ from int4_tbl as t1 One-Time Filter: false (5 rows) +-- per further discussion of bug #17781 +explain (costs off) +select ss1.x +from (select f1/2 as x from int4_tbl i4 left join a on a.id = i4.f1) ss1 + right join int8_tbl i8 on true +where current_user is not null; -- this is to add a Result node + QUERY PLAN +----------------------------------------------- + Result + One-Time Filter: (CURRENT_USER IS NOT NULL) + -> Nested Loop Left Join + -> Seq Scan on int8_tbl i8 + -> Materialize + -> Seq Scan on int4_tbl i4 +(6 rows) + -- check that join removal works for a left join when joining a subquery -- that is guaranteed to be unique by its GROUP BY clause explain (costs off) diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql index 7806c910b4..2e764cdd51 100644 --- a/src/test/regress/sql/join.sql +++ b/src/test/regress/sql/join.sql @@ -1813,6 +1813,13 @@ from int4_tbl as t1 on t5.q1 = t7.q2) on false; +-- per further discussion of bug #17781 +explain (costs off) +select ss1.x +from (select f1/2 as x from int4_tbl i4 left join a on a.id = i4.f1) ss1 + right join int8_tbl i8 on true +where current_user is not null; -- this is to add a Result node + -- check that join removal works for a left join when joining a subquery -- that is guaranteed to be unique by its GROUP BY clause explain (costs off) |
