Re: can a trigger on insert -> update other tables? - Mailing list pgsql-general

From brichard@cafod.org.uk (Bruce Richardson)
Subject Re: can a trigger on insert -> update other tables?
Date
Msg-id 20010303140818.B25166@usb.cafod.org.uk
Whole thread Raw
In response to can a trigger on insert -> update other tables?  (will trillich <will@serensoft.com>)
Responses Re: can a trigger on insert -> update other tables?
List pgsql-general
On Fri, Mar 02, 2001 at 03:13:19PM -0600, will trillich wrote:
> i've got a "_rating" table that, when a new record is added,
> i'd like to have propagate through some other tables to update
> running totals:
>
> CREATE FUNCTION _rating_propagate( _rating ) RETURNS OPAQUE AS '

Trigger functions shouldn't have parameters.  And you don't need the NEW
in this line:
>     FOR EACH ROW EXECUTE PROCEDURE _rating_propagate( NEW );

The new variable is automatically made available to the trigger
function.

And remember to do
    RETURN new
somewhere.


--
Bruce

pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Trigger Blunder
Next
From: "Richard Huxton"
Date:
Subject: Connection/closedown triggers for backends?