@@ -1125,22 +1125,22 @@ select c, cardinality(c), d, cardinality(d) from arrtest;
1125
1125
{foo,new_word} | 2 | {bar,foo} | 2
1126
1126
(3 rows)
1127
1127
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 ;
1129
1129
array_agg
1130
1130
--------------------------------------
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 }
1132
1132
(1 row)
1133
1133
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 ;
1135
1135
array_agg
1136
1136
---------------------------------
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 }
1138
1138
(1 row)
1139
1139
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 ;
1141
1141
array_agg
1142
1142
---------------------------------------
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 }
1144
1144
(1 row)
1145
1145
1146
1146
select cardinality(array_agg(unique1)) from tenk1 where unique1 < 15;
@@ -1149,12 +1149,6 @@ select cardinality(array_agg(unique1)) from tenk1 where unique1 < 15;
1149
1149
15
1150
1150
(1 row)
1151
1151
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
-
1158
1152
select array_agg(unique1) from tenk1 where unique1 < -15;
1159
1153
array_agg
1160
1154
-----------
0 commit comments