From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | elein <elein(at)varlena(dot)com>, Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: join of array |
Date: | 2003-08-15 18:12:54 |
Message-ID: | 3F3D22A6.5020709@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-patches |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Johnson | 2003-08-15 18:13:52 | Arrays and "goodness" in RDBMSs (was Re: join of array) |
Previous Message | Dennis Gearon | 2003-08-15 18:04:26 | Re: Why the duplicate messages to pgsql-general? |
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Johnson | 2003-08-15 18:13:52 | Arrays and "goodness" in RDBMSs (was Re: join of array) |
Previous Message | Tom Lane | 2003-08-15 17:58:35 | Re: join of array |