From: Michael Fuhr <mike@fuhr.org>
To: Bart Degryse <Bart.Degryse@indicator.be>
Cc: pgsql-sql@postgresql.org
Subject: Re: plpgsql and triggers
Date: Sun, 5 Jun 2005 20:30:48 -0600
Message-ID: <20050606023048.GA92417@winnie.fuhr.org> (raw)
In-Reply-To: <s29f1053.094@webaccess.indicator.be>
References: <s29f1053.094@webaccess.indicator.be>
On Thu, Jun 02, 2005 at 01:57:26PM +0200, Bart Degryse wrote:
>
> 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';
As you've discovered, this doesn't work in PL/pgSQL: the above code
references the new row's TG_ARGV column, which doesn't exist. This
comes up frequently; see the list archives for past discussion. The
usual advice is to use a language like PL/Perl, PL/Tcl, PL/Python, etc.
that provides this capability.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mike@fuhr.org, Bart.Degryse@indicator.be
Subject: Re: plpgsql and triggers
In-Reply-To: <20050606023048.GA92417@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox