mirror of
https://github.com/postgres/postgres.git
synced 2026-01-05 23:38:41 +03:00
Fix test case from a8ccf4e93
Commit a8ccf4e93 uses the same table name "distinct_tbl" in both
select_distinct.sql and select_distinct_on.sql, which could cause
conflicts when these two test scripts are run in parallel.
Fix by renaming the table in select_distinct_on.sql to
"distinct_on_tbl".
Per buildfarm (via Tom Lane)
Discussion: https://postgr.es/m/1572004.1732583549@sss.pgh.pa.us
This commit is contained in:
@@ -48,10 +48,10 @@ SELECT DISTINCT ON (four) four,hundred
|
||||
-- the input path's ordering
|
||||
--
|
||||
|
||||
CREATE TABLE distinct_tbl (x int, y int, z int);
|
||||
INSERT INTO distinct_tbl SELECT i%10, i%10, i%10 FROM generate_series(1, 1000) AS i;
|
||||
CREATE INDEX distinct_tbl_x_y_idx ON distinct_tbl (x, y);
|
||||
ANALYZE distinct_tbl;
|
||||
CREATE TABLE distinct_on_tbl (x int, y int, z int);
|
||||
INSERT INTO distinct_on_tbl SELECT i%10, i%10, i%10 FROM generate_series(1, 1000) AS i;
|
||||
CREATE INDEX distinct_on_tbl_x_y_idx ON distinct_on_tbl (x, y);
|
||||
ANALYZE distinct_on_tbl;
|
||||
|
||||
-- Produce results with sorting.
|
||||
SET enable_hashagg TO OFF;
|
||||
@@ -59,26 +59,26 @@ SET enable_hashagg TO OFF;
|
||||
-- Ensure we avoid the need to re-sort by reordering the distinctClause
|
||||
-- Pathkeys to match the ordering of the input path
|
||||
EXPLAIN (COSTS OFF)
|
||||
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl;
|
||||
|
||||
-- Ensure we leverage incremental-sort by reordering the distinctClause
|
||||
-- Pathkeys to partially match the ordering of the input path
|
||||
EXPLAIN (COSTS OFF)
|
||||
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_tbl ORDER BY x) s;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_tbl ORDER BY x) s;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_on_tbl ORDER BY x) s;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_on_tbl ORDER BY x) s;
|
||||
|
||||
-- Ensure we reorder the distinctClause Pathkeys to match the ordering of the
|
||||
-- input path even if there is ORDER BY clause
|
||||
EXPLAIN (COSTS OFF)
|
||||
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl ORDER BY y;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl ORDER BY y;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl ORDER BY y;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl ORDER BY y;
|
||||
|
||||
-- Ensure the resulting pathkey list matches the initial distinctClause Pathkeys
|
||||
EXPLAIN (COSTS OFF)
|
||||
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_tbl order by x, z, y) s ORDER BY y, x, z;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_tbl order by x, z, y) s ORDER BY y, x, z;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_on_tbl order by x, z, y) s ORDER BY y, x, z;
|
||||
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_on_tbl order by x, z, y) s ORDER BY y, x, z;
|
||||
|
||||
RESET enable_hashagg;
|
||||
|
||||
DROP TABLE distinct_tbl;
|
||||
DROP TABLE distinct_on_tbl;
|
||||
|
||||
Reference in New Issue
Block a user