1 -- To aggregate rows into 2 dimensional arrays see the following custom aggregate by Erwin Brandstetter
2 -- http://stackoverflow.com/questions/9832973/initial-array-in-function-to-aggregate-multi-dimensional-array
4 CREATE AGGREGATE public.array_agg_mult (anyarray) (
11 -- TEST=# SELECT array_agg_mult(ARRAY[ARRAY[a,b]])
12 -- FROM (SELECT 1 AS a, 2 AS b UNION SELECT 2 AS a, 4 AS b) t;