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 ?