Re: proposal: plpgsql - iteration over fields of rec or row variable

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: proposal: plpgsql - iteration over fields of rec or row variable
Дата
Msg-id 27600.1289242331@sss.pgh.pa.us
обсуждение исходный текст
Ответ на proposal: plpgsql - iteration over fields of rec or row variable  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: proposal: plpgsql - iteration over fields of rec or row variable  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes:
> FOR varname OVER [row | rec variable]
> LOOP
>    {{body}}
> END LOOP

> this syntax isn't final. The real type of control variable is
> specified in runtime and can be changed between iterations.

If you don't know the type or even the name of the field that varname
currently represents, how is the loop body going to do anything useful?

> This variable should be
> writeable - so we are able to change any field of record.

And that is just plain horrid.  The loop variable is a separate
variable, not a modifiable alias for a field, in every existing form
of plpgsql loop.

The idea of multiple instances of the loop body code seems like a mess
anyway.  I think this is basically hacking plpgsql beyond recognition
to solve problems that are better solved in plperl or pltcl.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: How to share the result data of separated plan
Следующее
От: Bernd Helmle
Дата:
Сообщение: Re: How can we tell how far behind the standby is?