1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Address portability issues in bfe16d1a5 test output.

This commit is contained in:
Andres Freund
2016-09-12 18:15:10 -07:00
parent bfe16d1a5d
commit 9f478b4f19
2 changed files with 19 additions and 26 deletions

View File

@ -130,38 +130,31 @@ SELECT few.dataa, count(*), min(id), max(id), unnest('{1,1,3}'::int[]) FROM few
(2 rows) (2 rows)
-- check HAVING works when GROUP BY does [not] reference SRF output -- check HAVING works when GROUP BY does [not] reference SRF output
SELECT dataa, generate_series(1,3), count(*) FROM few GROUP BY 1 HAVING count(*) > 1; SELECT dataa, generate_series(1,1), count(*) FROM few GROUP BY 1 HAVING count(*) > 1;
dataa | generate_series | count dataa | generate_series | count
-------+-----------------+------- -------+-----------------+-------
a | 1 | 2 a | 1 | 2
a | 2 | 2 (1 row)
a | 3 | 2
(3 rows)
SELECT dataa, generate_series(1,3), count(*) FROM few GROUP BY 1, 2 HAVING count(*) > 1; SELECT dataa, generate_series(1,1), count(*) FROM few GROUP BY 1, 2 HAVING count(*) > 1;
dataa | generate_series | count dataa | generate_series | count
-------+-----------------+------- -------+-----------------+-------
a | 1 | 2 a | 1 | 2
a | 2 | 2 (1 row)
a | 3 | 2
(3 rows)
-- it's weird to have GROUP BYs that increase the number of results -- it's weird to have GROUP BYs that increase the number of results
SELECT few.dataa, count(*), min(id), max(id) FROM few GROUP BY few.dataa; SELECT few.dataa, count(*) FROM few WHERE dataa = 'a' GROUP BY few.dataa ORDER BY 2;
dataa | count | min | max dataa | count
-------+-------+-----+----- -------+-------
b | 1 | 3 | 3 a | 2
a | 2 | 1 | 2 (1 row)
(2 rows)
SELECT few.dataa, count(*), min(id), max(id) FROM few GROUP BY few.dataa, unnest('{1,1,3}'::int[]); SELECT few.dataa, count(*) FROM few WHERE dataa = 'a' GROUP BY few.dataa, unnest('{1,1,3}'::int[]) ORDER BY 2;
dataa | count | min | max dataa | count
-------+-------+-----+----- -------+-------
b | 2 | 3 | 3 a | 2
a | 4 | 1 | 2 a | 4
b | 1 | 3 | 3 (2 rows)
a | 2 | 1 | 2
(4 rows)
-- SRFs are not allowed in aggregate arguments -- SRFs are not allowed in aggregate arguments
SELECT min(generate_series(1, 3)) FROM few; SELECT min(generate_series(1, 3)) FROM few;

View File

@ -37,12 +37,12 @@ SELECT few.dataa, count(*), min(id), max(id), unnest('{1,1,3}'::int[]) FROM few
SELECT few.dataa, count(*), min(id), max(id), unnest('{1,1,3}'::int[]) FROM few WHERE few.id = 1 GROUP BY few.dataa, 5; SELECT few.dataa, count(*), min(id), max(id), unnest('{1,1,3}'::int[]) FROM few WHERE few.id = 1 GROUP BY few.dataa, 5;
-- check HAVING works when GROUP BY does [not] reference SRF output -- check HAVING works when GROUP BY does [not] reference SRF output
SELECT dataa, generate_series(1,3), count(*) FROM few GROUP BY 1 HAVING count(*) > 1; SELECT dataa, generate_series(1,1), count(*) FROM few GROUP BY 1 HAVING count(*) > 1;
SELECT dataa, generate_series(1,3), count(*) FROM few GROUP BY 1, 2 HAVING count(*) > 1; SELECT dataa, generate_series(1,1), count(*) FROM few GROUP BY 1, 2 HAVING count(*) > 1;
-- it's weird to have GROUP BYs that increase the number of results -- it's weird to have GROUP BYs that increase the number of results
SELECT few.dataa, count(*), min(id), max(id) FROM few GROUP BY few.dataa; SELECT few.dataa, count(*) FROM few WHERE dataa = 'a' GROUP BY few.dataa ORDER BY 2;
SELECT few.dataa, count(*), min(id), max(id) FROM few GROUP BY few.dataa, unnest('{1,1,3}'::int[]); SELECT few.dataa, count(*) FROM few WHERE dataa = 'a' GROUP BY few.dataa, unnest('{1,1,3}'::int[]) ORDER BY 2;
-- SRFs are not allowed in aggregate arguments -- SRFs are not allowed in aggregate arguments
SELECT min(generate_series(1, 3)) FROM few; SELECT min(generate_series(1, 3)) FROM few;