aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-11-29 00:39:46 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-11-29 00:39:46 +0000
commit0a2cdbcd7d7a994986a787e8b3e088dd64c90785 (patch)
tree1623b529d606602a29147190bd779d5b9b7f20e0
parentb651b2a5c257945ba0ef78df22948cf805ba2b57 (diff)
downloadpostgresql-0a2cdbcd7d7a994986a787e8b3e088dd64c90785.tar.gz
postgresql-0a2cdbcd7d7a994986a787e8b3e088dd64c90785.zip
Fix recently-added array_agg tests to ensure they produce stable results
regardless of plan changes. Per intermittent buildfarm failures on "pigeon" and others.
-rw-r--r--src/test/regress/expected/arrays.out18
-rw-r--r--src/test/regress/sql/arrays.sql7
2 files changed, 9 insertions, 16 deletions
diff --git a/src/test/regress/expected/arrays.out b/src/test/regress/expected/arrays.out
index aecc74c5c4b..ec2fd52c7f8 100644
--- a/src/test/regress/expected/arrays.out
+++ b/src/test/regress/expected/arrays.out
@@ -1125,22 +1125,22 @@ select c, cardinality(c), d, cardinality(d) from arrtest;
{foo,new_word} | 2 | {bar,foo} | 2
(3 rows)
-select array_agg(unique1) from tenk1 where unique1 < 15;
+select array_agg(unique1) from (select unique1 from tenk1 where unique1 < 15 order by unique1) ss;
array_agg
--------------------------------------
- {4,2,1,6,14,9,8,5,3,13,12,11,7,10,0}
+ {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}
(1 row)
-select array_agg(ten) from tenk1 where unique1 < 15;
+select array_agg(ten) from (select ten from tenk1 where unique1 < 15 order by unique1) ss;
array_agg
---------------------------------
- {4,2,1,6,4,9,8,5,3,3,2,1,7,0,0}
+ {0,1,2,3,4,5,6,7,8,9,0,1,2,3,4}
(1 row)
-select array_agg(nullif(ten, 4)) from tenk1 where unique1 < 15;
+select array_agg(nullif(ten, 4)) from (select ten from tenk1 where unique1 < 15 order by unique1) ss;
array_agg
---------------------------------------
- {NULL,2,1,6,NULL,9,8,5,3,3,2,1,7,0,0}
+ {0,1,2,3,NULL,5,6,7,8,9,0,1,2,3,NULL}
(1 row)
select cardinality(array_agg(unique1)) from tenk1 where unique1 < 15;
@@ -1149,12 +1149,6 @@ select cardinality(array_agg(unique1)) from tenk1 where unique1 < 15;
15
(1 row)
-select array_agg(unique1) from (select * from tenk1 order by unique1 asc) as tab where unique1 < 15;
- array_agg
---------------------------------------
- {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}
-(1 row)
-
select array_agg(unique1) from tenk1 where unique1 < -15;
array_agg
-----------
diff --git a/src/test/regress/sql/arrays.sql b/src/test/regress/sql/arrays.sql
index fc72f29f602..a4a91b034c9 100644
--- a/src/test/regress/sql/arrays.sql
+++ b/src/test/regress/sql/arrays.sql
@@ -396,11 +396,10 @@ select cardinality(array[1,2,3]);
select cardinality(array[[1,2,3], [4,5,6]]);
select c, cardinality(c), d, cardinality(d) from arrtest;
-select array_agg(unique1) from tenk1 where unique1 < 15;
-select array_agg(ten) from tenk1 where unique1 < 15;
-select array_agg(nullif(ten, 4)) from tenk1 where unique1 < 15;
+select array_agg(unique1) from (select unique1 from tenk1 where unique1 < 15 order by unique1) ss;
+select array_agg(ten) from (select ten from tenk1 where unique1 < 15 order by unique1) ss;
+select array_agg(nullif(ten, 4)) from (select ten from tenk1 where unique1 < 15 order by unique1) ss;
select cardinality(array_agg(unique1)) from tenk1 where unique1 < 15;
-select array_agg(unique1) from (select * from tenk1 order by unique1 asc) as tab where unique1 < 15;
select array_agg(unique1) from tenk1 where unique1 < -15;
select unnest(array[1,2,3]);