Re: [SQL] Triggers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Mitch Vincent" <mitch(at)venux(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Triggers
Date: 2000-01-04 15:55:11
Message-ID: 13258.947001311@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Mitch Vincent" <mitch(at)venux(dot)net> writes:
> I'm using this funtion via a trigger to total up amounts in several fields
> (and adding that value into a total field)..

> CREATE TRIGGER invoice_total_trigger AFTER INSERT OR UPDATE ON invoice
> FOR EACH ROW EXECUTE PROCEDURE invoice_total_trigger();

> It works for updating but not when you insert a new row. Am I doing it
> wrong?

Er, don't you want BEFORE INSERT OR UPDATE?

I wouldn't think an AFTER trigger could modify the already-inserted-or-
updated row...

regards, tom lane

In response to

  • Triggers at 2000-01-04 15:04:35 from Mitch Vincent

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Mitch Vincent 2000-01-04 16:21:26 Re: [SQL] Triggers
Previous Message Mitch Vincent 2000-01-04 15:04:35 Triggers