4 Just a couple of functions and an aggregate for working with multidimensional (2 dimensional) arrays in PostgreSQL.
10 TEST=# select unnest_element(ARRAY[ARRAY[1,2,3],ARRAY[4,5,6]],3);
17 TEST=# select unnest_first(ARRAY[ARRAY[1,2,3],ARRAY[4,5,6]]);
24 -- (Ref http://stackoverflow.com/questions/9832973/initial-array-in-function-to-aggregate-multi-dimensional-array)
25 TEST=# SELECT array_agg_mult(ARRAY[ARRAY[a,b]])
26 FROM (SELECT 1 AS a, 2 AS b UNION SELECT 2 AS a, 4 AS b) t;