Re: proposal: FOREACH-IN-ARRAY (probably for 9.2?) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: proposal: FOREACH-IN-ARRAY (probably for 9.2?)
Date
Msg-id 2016.1292606810@sss.pgh.pa.us
Whole thread Raw
In response to Re: proposal: FOREACH-IN-ARRAY (probably for 9.2?)  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-hackers
Merlin Moncure <mmoncure@gmail.com> writes:
> On Fri, Dec 17, 2010 at 12:15 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> [ scratches head... ] �I don't follow what you envision this doing,
>> exactly?

> It's like _pg_expandarray but alterted support multiple dimensions:

> select * from unnest_dims(array[['a','b'],['c','d']]) returns
> [1,1], 'a'
> [1,2], 'b'
> [2,1], 'c'
> [2,2], 'd'

Oh, so that's an *output* not an input.  And IIUC what you are returning
is the subscripts associated with the current element, not the array's
dimensions.  Seems like it should go beside the normal target variable
then, not at the end.
FOREACH variable_for_value [, variable_for_subscripts ] IN ARRAY ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: proposal: FOREACH-IN-ARRAY (probably for 9.2?)
Next
From: Tom Lane
Date:
Subject: Re: proposal: FOREACH-IN-ARRAY (probably for 9.2?)