mirror of
https://github.com/postgres/postgres.git
synced 2025-12-10 14:22:35 +03:00
Repair interaction between IN-join processing and subselect pullup that
I inadvertently broke a few days ago (per report from Sean Thomas). Add regression test case to try to catch any similar breakage in future.
This commit is contained in:
@@ -165,3 +165,39 @@ from int8_tbl group by q1 order by q1;
|
||||
4567890123456789 | 0.6
|
||||
(2 rows)
|
||||
|
||||
--
|
||||
-- Test cases to catch unpleasant interactions between IN-join processing
|
||||
-- and subquery pullup.
|
||||
--
|
||||
select count(*) from
|
||||
(select 1 from tenk1 a
|
||||
where unique1 IN (select hundred from tenk1 b)) ss;
|
||||
count
|
||||
-------
|
||||
100
|
||||
(1 row)
|
||||
|
||||
select count(distinct ss.ten) from
|
||||
(select ten from tenk1 a
|
||||
where unique1 IN (select hundred from tenk1 b)) ss;
|
||||
count
|
||||
-------
|
||||
10
|
||||
(1 row)
|
||||
|
||||
select count(*) from
|
||||
(select 1 from tenk1 a
|
||||
where unique1 IN (select distinct hundred from tenk1 b)) ss;
|
||||
count
|
||||
-------
|
||||
100
|
||||
(1 row)
|
||||
|
||||
select count(distinct ss.ten) from
|
||||
(select ten from tenk1 a
|
||||
where unique1 IN (select distinct hundred from tenk1 b)) ss;
|
||||
count
|
||||
-------
|
||||
10
|
||||
(1 row)
|
||||
|
||||
|
||||
@@ -75,3 +75,21 @@ SELECT '' AS eight, ss.f1 AS "Correlated Field", ss.f3 AS "Second Field"
|
||||
|
||||
select q1, float8(count(*)) / (select count(*) from int8_tbl)
|
||||
from int8_tbl group by q1 order by q1;
|
||||
|
||||
--
|
||||
-- Test cases to catch unpleasant interactions between IN-join processing
|
||||
-- and subquery pullup.
|
||||
--
|
||||
|
||||
select count(*) from
|
||||
(select 1 from tenk1 a
|
||||
where unique1 IN (select hundred from tenk1 b)) ss;
|
||||
select count(distinct ss.ten) from
|
||||
(select ten from tenk1 a
|
||||
where unique1 IN (select hundred from tenk1 b)) ss;
|
||||
select count(*) from
|
||||
(select 1 from tenk1 a
|
||||
where unique1 IN (select distinct hundred from tenk1 b)) ss;
|
||||
select count(distinct ss.ten) from
|
||||
(select ten from tenk1 a
|
||||
where unique1 IN (select distinct hundred from tenk1 b)) ss;
|
||||
|
||||
Reference in New Issue
Block a user