Re: Indirect access to NEW or OLD records

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Indirect access to NEW or OLD records
Дата
Msg-id 9644.1222366138@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Indirect access to NEW or OLD records  ("Dmitry Koterov" <dmitry@koterov.ru>)
Ответы Re: Indirect access to NEW or OLD records  ("Dmitry Koterov" <dmitry@koterov.ru>)
Список pgsql-general
"Dmitry Koterov" <dmitry@koterov.ru> writes:
> I have a variable with a field name and want to extract this field
> value from NEW record:

> DECLARE
>     field VARCHAR = 'some_field';
> BEGIN
>     ...
>     value := NEW.{field};  -- ???
> END;

> Is it possible in pl/pgsql?

No.  Quite aside from the lack of syntax for that, plpgsql would be
unhappy if the data type wasn't the same on successive executions.

Use one of the less strongly typed PLs instead.  I believe this is
pretty easy in plperl or pltcl.  (Maybe plpython too, but I don't know
that language.)

            regards, tom lane

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

Предыдущее
От: "zach cruise"
Дата:
Сообщение: ease of use sync
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to select rows that are the max for each subcategory?