I’ve a table that looks like:
id | t
----+-------
1 | {1,2}
2 | {5,2}
3 | {6,2}
4 | {1,7}
5 | {1,8}
6 | {1,9}
I’m looking for a SELECT query that will return me array of t like {{1,2}, {5,2}, ... {1,9}}.
Had t not been an array data type, it would have been easy like:
SELECT ARRAY (SELECT t from tbl_foo);
Can same be done if data type is int[]?
I don’t know if there is some simpler way (I hope so), but this works (PostgreSQL doesn’t have array of arrays, so
array_aggaproach doesn’t work here):Example:
EDIT:
Second solution is based on new aggregate function, called let’s say
array2_agg:I need that
array2_agg_cutFirstfunction (simply cutting first'{0, 0}'subarray), becauseINITCOND = '{{}}'is not allowable.