Tom Lane wrote:
> I believe the behavior Elein wants can be had by writing
> ARRAY[ n_d_array , n_d_array ]
> (Joe, would you confirm that's true, and document it? I don't think
> either section 8.10 or section 4.2.8 makes clear that you can build
> arrays from smaller array values rather than just scalars.) As long as
> we have that alternative, it's not necessary that concatenation do the
> same thing.
Well this works:
regression=# select ARRAY[ARRAY[[1,2],[3,4]],ARRAY[[5,6],[7,8]]];
array
-------------------------------
{{{1,2},{3,4}},{{5,6},{7,8}}}
(1 row)
But I was disappointed that this doesn't:
regression=# select ARRAY['{{1,2},{3,4}}'::int[],'{{5,6},{7,8}}'::int[]];
ERROR: multidimensional ARRAY[] must be built from nested array expressions
Nor does this:
create table arr(f1 int[], f2 int[]);
insert into arr values (ARRAY[[1,2],[3,4]],ARRAY[[5,6],[7,8]]);
regression=# select ARRAY[f1,f2] from arr;
ERROR: multidimensional ARRAY[] must be built from nested array expressions
It does work for the element to array case:
create table els(f1 int, f2 int);
insert into els values (1,2);
regression=# select ARRAY[f1,f2] from els;
array
-------
{1,2}
(1 row)
Should I try to make the second and third cases work?
Joe