unnest on multi-dimensional arrays

From: Zev Benjamin <zev-pgsql(at)strangersgate(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: unnest on multi-dimensional arrays
Date: 2013-11-28 07:06:08
Message-ID: 5296EB60.2010103@strangersgate.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It appears that unnest, when called on a multi-dimensional array,
effectively flattens the array first. For example:

=> select * from unnest(array[array[1, 2], array[2, 3]]);
unnest
--------
1
2
2
3
(4 rows)

while I would have expect something like the following:

=> select * from unnest(array[array[1, 2], array[2, 3]]);
unnest
--------
{1, 2}
{2, 3}
(2 rows)

Is there any way to get the latter behavior?

Zev

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2013-11-28 07:28:19 Re: unnest on multi-dimensional arrays
Previous Message Zev Benjamin 2013-11-28 07:05:10 unnest on multi-dimensional arrays