pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mitch Vincent <mitch@venux.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Triggers
Date: Tue, 04 Jan 2000 10:55:11 -0500
Message-ID: <13258.947001311@sss.pgh.pa.us> (raw)
In-Reply-To: <00cc01bf56c5$03cd5e80$40ee2fd8@venux.net>
References: <21582.943985242@sss.pgh.pa.us>
	<00cc01bf56c5$03cd5e80$40ee2fd8@venux.net>

"Mitch Vincent" <mitch@venux.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



view thread (34+ messages)  latest in thread

Message-ID: <13258.947001311@sss.pgh.pa.us>
Permalink:  ../13258.947001311@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13258.947001311@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, mitch@venux.net
  Subject: Re: [SQL] Triggers
  In-Reply-To: <13258.947001311@sss.pgh.pa.us>

* 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