Indirect access to NEW or OLD records

Поиск
Список
Период
Сортировка
От Dmitry Koterov
Тема Indirect access to NEW or OLD records
Дата
Msg-id d7df81620809251042r54318b24lc70cbe9b3f553b3@mail.gmail.com
обсуждение исходный текст
Ответы Re: Indirect access to NEW or OLD records
Список pgsql-general
Hello.

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?

I have found one speed-inefficient solution: convert NEW to string and
then - use EXECURE with customly-build query to extract a value from
that constant string. But it is too slow. Is there better solution?

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

Предыдущее
От: Reg Me Please
Дата:
Сообщение: Dynamically created cursors vanish in PLPgSQL
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Counting rows in a PL/PgSQL CURSOR without fetching?