plpgsql and triggers - Mailing list pgsql-sql

From Bart Degryse
Subject plpgsql and triggers
Date
Msg-id s29f1053.094@webaccess.indicator.be
Whole thread Raw
Responses Re: plpgsql and triggers
List pgsql-sql
I'm looking for a way to use a parameter given to a trigger function as fieldname. It should be something like
create function f_makeupper() returns trigger as '
begin
    NEW.TG_ARGV[0] := upper(NEW.TG_ARGV[0]);
    RETURN NEW;
end;
' language 'plpgsql';
create trigger "TRIG_tbltest" before insert on tbltest for each row execute procedure f_makeupper("fieldname");
 
I can create both the function and the trigger, but on inserting a new record I get an error telling me that "record 'new' has no field 'tg_argv'"
 
What am I doing wrong ?
 

pgsql-sql by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: [GENERAL] index row size 2728 exceeds btree maximum, 2713
Next
From: Marc Wrubleski
Date:
Subject: Returning a Cross Tab record set from a function