Re: parameter in trigger function - Mailing list pgsql-general

From Tom Lane
Subject Re: parameter in trigger function
Date
Msg-id 18605.1060962028@sss.pgh.pa.us
Whole thread Raw
In response to parameter in trigger function  ("Jules Alberts" <jules.alberts@arbodienst-limburg.nl>)
List pgsql-general
"Jules Alberts" <jules.alberts@arbodienst-limburg.nl> writes:
> Code like this
> NEW.$1 := lower(NEW.$1)
> won't work, all I get is error messages :-(

Can't do that in plpgsql; it does not like run-time specification of
table or field names.  You could try using EXECUTE but I doubt that
will work either for an assignment to NEW.

I'd suggest using pltcl, which is more amenable to run-time
determination of field names.

> mostly says the opposite. Is this possible at all? How do I read the
> TriggerData structure from whithin a pl/pgsql function?

You are looking for TG_ARGV[], though this is not your biggest
problem...

            regards, tom lane

pgsql-general by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: tsearch2 in 7.4beta1 compile problem
Next
From: Jan Wieck
Date:
Subject: Re: parameter in trigger function