RECORD fields by name

Started by Erik Ronströmalmost 23 years ago2 messagesgeneral
Jump to latest
#1Erik Ronström
kvarken@yahoo.com

In a plpgsql function, is it possible to retrieve values from a RECORD
if the fieldname is not known when writing the function?

I'm writing a trigger function which takes a table name and a field
name as arguments and modifies NEW. The problem is that I can't figure
out how to access NEW.[fieldname], since [fieldname] cannot be a
variable.

Erik

__________________________________________________
Yahoo! Plus
For a better Internet experience
http://www.yahoo.co.uk/btoffer

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Erik Ronström (#1)
Re: RECORD fields by name

=?iso-8859-1?q?Erik=20Ronstr=F6m?= <kvarken@yahoo.com> writes:

In a plpgsql function, is it possible to retrieve values from a RECORD
if the fieldname is not known when writing the function?

No. Try pltcl instead ...

regards, tom lane