Thursday, September 25, 2008

Re: [GENERAL] Indirect access to NEW or OLD records

"Dmitry Koterov" <> writes:
> I have a variable with a field name and want to extract this field
> value from NEW record:

> field VARCHAR = 'some_field';
> ...
> 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

Sent via pgsql-general mailing list (
To make changes to your subscription:

No comments: