Re: proposal: FOREACH-IN-ARRAY (probably for 9.2?)

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: proposal: FOREACH-IN-ARRAY (probably for 9.2?)
Дата
Msg-id AANLkTinnF3U20M8inZy_1GWZTayMDu3mH1XuSpgm9mrM@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: FOREACH-IN-ARRAY (probably for 9.2?)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: proposal: FOREACH-IN-ARRAY (probably for 9.2?)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Fri, Dec 17, 2010 at 12:15 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Merlin Moncure <mmoncure@gmail.com> writes:
>> another way:
>
>> FOREACH scalar IN ARRAY arr_exp DIMS in dim_var
>
>> dim_var being int[], or possibly text, of length #dimensions, giving
>> per dimesion index.
>
> [ scratches head... ]  I don't follow what you envision this doing,
> exactly?
>
> I'm not thrilled with that specific syntax because it'd require making
> DIMS a reserved word, but right at the moment I'm more concerned about
> what semantics you have in mind.

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'

this provides alternate way of pulling slices, slower possibly, but
more abstract.

merlin


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: FOREACH-IN-ARRAY (probably for 9.2?)
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: proposal: FOREACH-IN-ARRAY (probably for 9.2?)