mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 02:37:31 +03:00
create_unique_plan() should not discard existing output columns of the
subplan it starts with, as they may be needed at upper join levels. See comments added to code for the non-obvious reason why. Per bug report from Robert Creager.
This commit is contained in:
@@ -2127,6 +2127,18 @@ on (x1 = xx1) where (xx2 is not null);
|
||||
4 | 44 | 4 | | 4 | 44
|
||||
(3 rows)
|
||||
|
||||
--
|
||||
-- regression test: check for bug with propagation of implied equality
|
||||
-- to outside an IN
|
||||
--
|
||||
select count(*) from tenk1 a where unique1 in
|
||||
(select unique1 from tenk1 b join tenk1 c using (unique1)
|
||||
where b.unique2 = 42);
|
||||
count
|
||||
-------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
--
|
||||
-- Clean up
|
||||
--
|
||||
|
||||
@@ -330,6 +330,14 @@ on (x1 = xx1) where (y2 is not null);
|
||||
select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2)
|
||||
on (x1 = xx1) where (xx2 is not null);
|
||||
|
||||
--
|
||||
-- regression test: check for bug with propagation of implied equality
|
||||
-- to outside an IN
|
||||
--
|
||||
select count(*) from tenk1 a where unique1 in
|
||||
(select unique1 from tenk1 b join tenk1 c using (unique1)
|
||||
where b.unique2 = 42);
|
||||
|
||||
|
||||
--
|
||||
-- Clean up
|
||||
|
||||
Reference in New Issue
Block a user