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

Commit 0a2cdbc

Browse files
committed
Fix recently-added array_agg tests to ensure they produce stable results
regardless of plan changes. Per intermittent buildfarm failures on "pigeon" and others.
1 parent b651b2a commit 0a2cdbc

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

src/test/regress/expected/arrays.out

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,22 +1125,22 @@ select c, cardinality(c), d, cardinality(d) from arrtest;
11251125
{foo,new_word} | 2 | {bar,foo} | 2
11261126
(3 rows)
11271127

1128-
select array_agg(unique1) from tenk1 where unique1 < 15;
1128+
select array_agg(unique1) from (select unique1 from tenk1 where unique1 < 15 order by unique1) ss;
11291129
array_agg
11301130
--------------------------------------
1131-
{4,2,1,6,14,9,8,5,3,13,12,11,7,10,0}
1131+
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}
11321132
(1 row)
11331133

1134-
select array_agg(ten) from tenk1 where unique1 < 15;
1134+
select array_agg(ten) from (select ten from tenk1 where unique1 < 15 order by unique1) ss;
11351135
array_agg
11361136
---------------------------------
1137-
{4,2,1,6,4,9,8,5,3,3,2,1,7,0,0}
1137+
{0,1,2,3,4,5,6,7,8,9,0,1,2,3,4}
11381138
(1 row)
11391139

1140-
select array_agg(nullif(ten, 4)) from tenk1 where unique1 < 15;
1140+
select array_agg(nullif(ten, 4)) from (select ten from tenk1 where unique1 < 15 order by unique1) ss;
11411141
array_agg
11421142
---------------------------------------
1143-
{NULL,2,1,6,NULL,9,8,5,3,3,2,1,7,0,0}
1143+
{0,1,2,3,NULL,5,6,7,8,9,0,1,2,3,NULL}
11441144
(1 row)
11451145

11461146
select cardinality(array_agg(unique1)) from tenk1 where unique1 < 15;
@@ -1149,12 +1149,6 @@ select cardinality(array_agg(unique1)) from tenk1 where unique1 < 15;
11491149
15
11501150
(1 row)
11511151

1152-
select array_agg(unique1) from (select * from tenk1 order by unique1 asc) as tab where unique1 < 15;
1153-
array_agg
1154-
--------------------------------------
1155-
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}
1156-
(1 row)
1157-
11581152
select array_agg(unique1) from tenk1 where unique1 < -15;
11591153
array_agg
11601154
-----------

src/test/regress/sql/arrays.sql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,10 @@ select cardinality(array[1,2,3]);
396396
select cardinality(array[[1,2,3], [4,5,6]]);
397397
select c, cardinality(c), d, cardinality(d) from arrtest;
398398

399-
select array_agg(unique1) from tenk1 where unique1 < 15;
400-
select array_agg(ten) from tenk1 where unique1 < 15;
401-
select array_agg(nullif(ten, 4)) from tenk1 where unique1 < 15;
399+
select array_agg(unique1) from (select unique1 from tenk1 where unique1 < 15 order by unique1) ss;
400+
select array_agg(ten) from (select ten from tenk1 where unique1 < 15 order by unique1) ss;
401+
select array_agg(nullif(ten, 4)) from (select ten from tenk1 where unique1 < 15 order by unique1) ss;
402402
select cardinality(array_agg(unique1)) from tenk1 where unique1 < 15;
403-
select array_agg(unique1) from (select * from tenk1 order by unique1 asc) as tab where unique1 < 15;
404403
select array_agg(unique1) from tenk1 where unique1 < -15;
405404

406405
select unnest(array[1,2,3]);

0 commit comments

Comments
 (0)