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

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proposal: plpgsql - iteration over fields of rec or row variable
Дата
Msg-id AANLkTinqTZZ65qxScvaxpZtj4SkQc3oUKYP7vQCUihYK@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: plpgsql - iteration over fields of rec or row variable  ("David E. Wheeler" <david@kineticode.com>)
Список pgsql-hackers
2010/11/9 David E. Wheeler <david@kineticode.com>:
> On Nov 9, 2010, at 9:34 AM, Tom Lane wrote:
>
>> I think there's a fairly fundamental contradiction involved here.
>> One of the basic design attributes of plpgsql is that it's strongly
>> typed.  Sometimes that's a blessing, and sometimes it's not, but
>> it's a fact.  There really isn't a good way to deal with run-time
>> field selection while still maintaining strong typing.  I do not
>> believe that the answer to that problem is "so let's break strong
>> typing".  Rather, the answer is that if that's what you need, you
>> need to use a different tool.  There's a reason we support multiple
>> PLs.
>
> Yeah, I think that Pavel wants to get at the record values with their types in tact. Not sure how that'd work though,
really.If you know the type of the record columns already, you can just get them. But I'm not sure how you could
introspectthe column names and their types, and then get those types out without casting, except perhaps via EXECUTE… 

every variable in plpgsql has known type descriptor. So it's not a
problem. The problem is a access to fields in cycle - and then you
need a simple trick like polymorphic parameters.

Pavel

>
> Best,
>
> David
>
>


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: plpgsql - iteration over fields of rec or row variable
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: plpgsql - iteration over fields of rec or row variable