Re: triggers and TriggerData - Mailing list pgsql-general

From Michael Fuhr
Subject Re: triggers and TriggerData
Date
Msg-id 20070122150437.GA65433@winnie.fuhr.org
Whole thread Raw
In response to Re: triggers and TriggerData  (Alan Hodgson <ahodgson@simkin.ca>)
Responses Re: triggers and TriggerData  (Alan Hodgson <ahodgson@simkin.ca>)
List pgsql-general
On Sun, Jan 21, 2007 at 09:05:30PM -0800, Alan Hodgson wrote:
> On Sunday 21 January 2007 15:56, gustavo halperin <ggh.develop@gmail.com> wrote:
> > I have another question about triggers, how can I pass arguments ?? I
> > read about some struct TriggerData *CurrentTriggerData, but I didn't
> > found any explanation or example about how to use it in postgres SQL.
> > My problem is that  for any INSERT row in table 'B' I need to pass
> > to the function trigger two values  of this row.  Do you know how to
> > do so or where are examples of how to do it ??
>
> You cannot pass values to a trigger.

You can pass literal string arguments to a trigger function.  See
the CREATE TRIGGER documentation and, for PL/pgSQL, TG_ARGV and
TG_NARGS.  For C see "Writing Trigger Functions in C"; search for
tgnargs and tgargs.

http://www.postgresql.org/docs/8.2/interactive/sql-createtrigger.html
http://www.postgresql.org/docs/8.2/interactive/plpgsql-trigger.html
http://www.postgresql.org/docs/8.2/interactive/trigger-interface.html

(These links are to the 8.2 documentation but earlier versions also
support arguments to trigger functions.)

--
Michael Fuhr

pgsql-general by date:

Previous
From: "Moritz Bayer"
Date:
Subject: Re: Loop in loop
Next
From: "A. Kretschmer"
Date:
Subject: Re: Loop in loop