Re: can a trigger on insert -> update other tables?

From: brichard(at)cafod(dot)org(dot)uk (Bruce Richardson)
To: will trillich <will(at)serensoft(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: can a trigger on insert -> update other tables?
Date: 2001-03-03 14:08:18
Message-ID: 20010303140818.B25166@usb.cafod.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2001-03-03 17:07:45 Connection/closedown triggers for backends?
Previous Message Tomek Zielonka 2001-03-03 12:41:16 Re: Convert to upper