Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e15e567

Browse files
author
Richard Guo
committed
Fix test case from a8ccf4e
Commit a8ccf4e 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
1 parent 91f5a4a commit e15e567

File tree

2 files changed

+39
-39
lines changed

2 files changed

+39
-39
lines changed

src/test/regress/expected/select_distinct_on.out

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,23 @@ SELECT DISTINCT ON (four) four,hundred
125125
-- Test the planner's ability to reorder the distinctClause Pathkeys to match
126126
-- the input path's ordering
127127
--
128-
CREATE TABLE distinct_tbl (x int, y int, z int);
129-
INSERT INTO distinct_tbl SELECT i%10, i%10, i%10 FROM generate_series(1, 1000) AS i;
130-
CREATE INDEX distinct_tbl_x_y_idx ON distinct_tbl (x, y);
131-
ANALYZE distinct_tbl;
128+
CREATE TABLE distinct_on_tbl (x int, y int, z int);
129+
INSERT INTO distinct_on_tbl SELECT i%10, i%10, i%10 FROM generate_series(1, 1000) AS i;
130+
CREATE INDEX distinct_on_tbl_x_y_idx ON distinct_on_tbl (x, y);
131+
ANALYZE distinct_on_tbl;
132132
-- Produce results with sorting.
133133
SET enable_hashagg TO OFF;
134134
-- Ensure we avoid the need to re-sort by reordering the distinctClause
135135
-- Pathkeys to match the ordering of the input path
136136
EXPLAIN (COSTS OFF)
137-
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl;
138-
QUERY PLAN
139-
------------------------------------------------------------------
137+
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl;
138+
QUERY PLAN
139+
------------------------------------------------------------------------
140140
Unique
141-
-> Index Only Scan using distinct_tbl_x_y_idx on distinct_tbl
141+
-> Index Only Scan using distinct_on_tbl_x_y_idx on distinct_on_tbl
142142
(2 rows)
143143

144-
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl;
144+
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl;
145145
x | y
146146
---+---
147147
0 | 0
@@ -159,18 +159,18 @@ SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl;
159159
-- Ensure we leverage incremental-sort by reordering the distinctClause
160160
-- Pathkeys to partially match the ordering of the input path
161161
EXPLAIN (COSTS OFF)
162-
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_tbl ORDER BY x) s;
163-
QUERY PLAN
164-
------------------------------------------------------------------------------
162+
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_on_tbl ORDER BY x) s;
163+
QUERY PLAN
164+
------------------------------------------------------------------------------------
165165
Unique
166166
-> Incremental Sort
167167
Sort Key: s.x, s.y
168168
Presorted Key: s.x
169169
-> Subquery Scan on s
170-
-> Index Only Scan using distinct_tbl_x_y_idx on distinct_tbl
170+
-> Index Only Scan using distinct_on_tbl_x_y_idx on distinct_on_tbl
171171
(6 rows)
172172

173-
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_tbl ORDER BY x) s;
173+
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_on_tbl ORDER BY x) s;
174174
x | y
175175
---+---
176176
0 | 0
@@ -188,16 +188,16 @@ SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_tbl ORDER BY x) s;
188188
-- Ensure we reorder the distinctClause Pathkeys to match the ordering of the
189189
-- input path even if there is ORDER BY clause
190190
EXPLAIN (COSTS OFF)
191-
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl ORDER BY y;
192-
QUERY PLAN
193-
------------------------------------------------------------------------
191+
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl ORDER BY y;
192+
QUERY PLAN
193+
------------------------------------------------------------------------------
194194
Sort
195195
Sort Key: y
196196
-> Unique
197-
-> Index Only Scan using distinct_tbl_x_y_idx on distinct_tbl
197+
-> Index Only Scan using distinct_on_tbl_x_y_idx on distinct_on_tbl
198198
(4 rows)
199199

200-
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl ORDER BY y;
200+
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl ORDER BY y;
201201
x | y
202202
---+---
203203
0 | 0
@@ -214,9 +214,9 @@ SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl ORDER BY y;
214214

215215
-- Ensure the resulting pathkey list matches the initial distinctClause Pathkeys
216216
EXPLAIN (COSTS OFF)
217-
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_tbl order by x, z, y) s ORDER BY y, x, z;
218-
QUERY PLAN
219-
------------------------------------------------------------------------------------
217+
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_on_tbl order by x, z, y) s ORDER BY y, x, z;
218+
QUERY PLAN
219+
---------------------------------------------------------------------------------------------
220220
Sort
221221
Sort Key: s.y, s.x, s.z
222222
-> Unique
@@ -225,11 +225,11 @@ SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_tbl order by x, z, y
225225
Presorted Key: s.x
226226
-> Subquery Scan on s
227227
-> Sort
228-
Sort Key: distinct_tbl.x, distinct_tbl.z, distinct_tbl.y
229-
-> Seq Scan on distinct_tbl
228+
Sort Key: distinct_on_tbl.x, distinct_on_tbl.z, distinct_on_tbl.y
229+
-> Seq Scan on distinct_on_tbl
230230
(10 rows)
231231

232-
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_tbl order by x, z, y) s ORDER BY y, x, z;
232+
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_on_tbl order by x, z, y) s ORDER BY y, x, z;
233233
x | y
234234
---+---
235235
0 | 0
@@ -245,4 +245,4 @@ SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_tbl order by x, z, y
245245
(10 rows)
246246

247247
RESET enable_hashagg;
248-
DROP TABLE distinct_tbl;
248+
DROP TABLE distinct_on_tbl;

src/test/regress/sql/select_distinct_on.sql

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,37 +48,37 @@ SELECT DISTINCT ON (four) four,hundred
4848
-- the input path's ordering
4949
--
5050

51-
CREATE TABLE distinct_tbl (x int, y int, z int);
52-
INSERT INTO distinct_tbl SELECT i%10, i%10, i%10 FROM generate_series(1, 1000) AS i;
53-
CREATE INDEX distinct_tbl_x_y_idx ON distinct_tbl (x, y);
54-
ANALYZE distinct_tbl;
51+
CREATE TABLE distinct_on_tbl (x int, y int, z int);
52+
INSERT INTO distinct_on_tbl SELECT i%10, i%10, i%10 FROM generate_series(1, 1000) AS i;
53+
CREATE INDEX distinct_on_tbl_x_y_idx ON distinct_on_tbl (x, y);
54+
ANALYZE distinct_on_tbl;
5555

5656
-- Produce results with sorting.
5757
SET enable_hashagg TO OFF;
5858

5959
-- Ensure we avoid the need to re-sort by reordering the distinctClause
6060
-- Pathkeys to match the ordering of the input path
6161
EXPLAIN (COSTS OFF)
62-
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl;
63-
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl;
62+
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl;
63+
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl;
6464

6565
-- Ensure we leverage incremental-sort by reordering the distinctClause
6666
-- Pathkeys to partially match the ordering of the input path
6767
EXPLAIN (COSTS OFF)
68-
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_tbl ORDER BY x) s;
69-
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_tbl ORDER BY x) s;
68+
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_on_tbl ORDER BY x) s;
69+
SELECT DISTINCT ON (y, x) x, y FROM (SELECT * FROM distinct_on_tbl ORDER BY x) s;
7070

7171
-- Ensure we reorder the distinctClause Pathkeys to match the ordering of the
7272
-- input path even if there is ORDER BY clause
7373
EXPLAIN (COSTS OFF)
74-
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl ORDER BY y;
75-
SELECT DISTINCT ON (y, x) x, y FROM distinct_tbl ORDER BY y;
74+
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl ORDER BY y;
75+
SELECT DISTINCT ON (y, x) x, y FROM distinct_on_tbl ORDER BY y;
7676

7777
-- Ensure the resulting pathkey list matches the initial distinctClause Pathkeys
7878
EXPLAIN (COSTS OFF)
79-
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_tbl order by x, z, y) s ORDER BY y, x, z;
80-
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_tbl order by x, z, y) s ORDER BY y, x, z;
79+
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_on_tbl order by x, z, y) s ORDER BY y, x, z;
80+
SELECT DISTINCT ON (y, x) x, y FROM (select * from distinct_on_tbl order by x, z, y) s ORDER BY y, x, z;
8181

8282
RESET enable_hashagg;
8383

84-
DROP TABLE distinct_tbl;
84+
DROP TABLE distinct_on_tbl;

0 commit comments

Comments
 (0)