change array dimension

From: Gerhard Heift <ml-postgresql-20081012-3518(at)gheift(dot)de>
To: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: change array dimension
Date: 2010-07-01 23:32:03
Message-ID: 20100701233203.GC1914@gheift.kawo1.RWTH-Aachen.DE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

is it possible to change the dimension of an array? I am looking for something
like this:

SELECT change_array_dims('[1:2][1:2]', '{1,2,3,4}'::int[]);
change_array_dims
-------------------
{{1,2},{3,4}}

and the other way around:

SELECT change_array_dims('[1:4]', '{{1,2},{3,4}}'::int[]);
change_array_dims
-------------------
{1,2,3,4}

Does such a function exist?

Thanks,
Gerhard

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Denne 2010-07-01 23:39:04 Help with pgAndroid Contest
Previous Message Tom Lane 2010-07-01 23:01:11 Re: Is full-row updates slower than single-value updates