Indirect access to NEW or OLD records - Mailing list pgsql-general

From Dmitry Koterov
Subject Indirect access to NEW or OLD records
Date
Msg-id d7df81620809251042r54318b24lc70cbe9b3f553b3@mail.gmail.com
Whole thread Raw
Responses Re: Indirect access to NEW or OLD records  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Reg Me Please
Date:
Subject: Dynamically created cursors vanish in PLPgSQL
Next
From: Tom Lane
Date:
Subject: Re: Counting rows in a PL/PgSQL CURSOR without fetching?