plpgsql and triggers

From: "Bart Degryse" <Bart(dot)Degryse(at)indicator(dot)be>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: plpgsql and triggers
Date: 2005-06-02 11:57:26
Message-ID: s29f1053.094@webaccess.indicator.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 ?

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message KÖPFERL Robert 2005-06-02 12:08:54 Re: [SQL] index row size 2728 exceeds btree maximum, 27
Previous Message Ramakrishnan Muralidharan 2005-06-02 11:13:33 Re: [SQL] index row size 2728 exceeds btree maximum, 2713