Received: from redbox.venux.net (redbox.venux.net [216.47.238.10]) by hub.org (8.9.3/8.9.3) with ESMTP id LAA10021 for ; Tue, 4 Jan 2000 11:18:15 -0500 (EST) (envelope-from mitch@venux.net) Received: from inky (inky.venux.net [216.47.238.64]) by redbox.venux.net (Postfix) with SMTP id 561A02E20B; Tue, 4 Jan 2000 11:11:25 -0500 (EST) Message-ID: <012e01bf56cf$bfe777e0$40ee2fd8@venux.net> From: "Mitch Vincent" To: "Tom Lane" Cc: References: <21582.943985242@sss.pgh.pa.us> <00cc01bf56c5$03cd5e80$40ee2fd8@venux.net> <13258.947001311@sss.pgh.pa.us> Subject: Re: [SQL] Triggers Date: Tue, 4 Jan 2000 11:21:26 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Thanks for the reply Tom (as always).. I did try both AFTER and BEFORE, neither worked for the insert.. Can you see anything wrong with the syntax? I get no errors or anything in the postgres.log, I have debuging set fairly high too : StartTransactionCommand query: insert into invoice (invoice_number,agencycode,invoice_date,fee_membership,fee_logins,fee_conven tion,fee_prints,fee_hotlines,fee_postage,fee_ups,fee_late) values(17623,'PAHO-231','12-01-1999',0.000000,0.000000,5.000000,0.000000,0.0 00000,0.000000,95.000000,0.000000); ProcessQuery CommitTransactionCommand There is an example of one of the inserts, there are 312 done at a time, all look just like that. It doesn't look like that the trigger is ever getting called.. Would you agree? -Mitch ----- Original Message ----- From: Tom Lane To: Mitch Vincent Cc: Sent: Tuesday, January 04, 2000 10:55 AM Subject: Re: [SQL] Triggers > "Mitch Vincent" 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 >