Thread: BUG #6087: Unnest with multidimensional arrays

BUG #6087: Unnest with multidimensional arrays

From
"Maxim Boguk"
Date:
The following bug has been logged online:

Bug reference:      6087
Logged by:          Maxim Boguk
Email address:      Maxim.Boguk@gmail.com
PostgreSQL version: 9.0
Operating system:   Linux
Description:        Unnest with multidimensional arrays
Details:

I not sure is it actual bug or intended behaviour.
In documentation unnest described as:
"expand an array to a set of rows".

However in case of multidimensional arrays documentation is misleading or
actual behaviour is wrong.

Test case:

postgres=# select unnest(array[[1,2], [3,4], [5,6]]);
 unnest
--------
      1
      2
      3
      4
      5
      6
(6 rows)

I think correct result must be:
unnest
------------
{1,2}
{3,4}
{5,6}

Re: BUG #6087: Unnest with multidimensional arrays

From
Merlin Moncure
Date:
On Thu, Jun 30, 2011 at 5:44 AM, Maxim Boguk <Maxim.Boguk@gmail.com> wrote:
>
> The following bug has been logged online:
>
> Bug reference: =A0 =A0 =A06087
> Logged by: =A0 =A0 =A0 =A0 =A0Maxim Boguk
> Email address: =A0 =A0 =A0Maxim.Boguk@gmail.com
> PostgreSQL version: 9.0
> Operating system: =A0 Linux
> Description: =A0 =A0 =A0 =A0Unnest with multidimensional arrays
> Details:
>
> I not sure is it actual bug or intended behaviour.
> In documentation unnest described as:
> "expand an array to a set of rows".
>
> However in case of multidimensional arrays documentation is misleading or
> actual behaviour is wrong.
>
> Test case:
>
> postgres=3D# select unnest(array[[1,2], [3,4], [5,6]]);
> =A0unnest
> --------
> =A0 =A0 =A01
> =A0 =A0 =A02
> =A0 =A0 =A03
> =A0 =A0 =A04
> =A0 =A0 =A05
> =A0 =A0 =A06
> (6 rows)
>
> I think correct result must be:
> unnest
> ------------
> {1,2}
> {3,4}
> {5,6}

not a bug.  however if you'd like to submit a patch to clarify that,
feel free...
do you need to be able to cut up arrays like that?

merlin