Received: from cyclone.stortek.com (cyclone.stortek.com [129.80.22.130]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2EIfex62395 for ; Wed, 14 Mar 2001 13:41:40 -0500 (EST) (envelope-from CreagRS@LOUISVILLE.STORTEK.COM) Received: from cyclone.stortek.com (localhost [127.0.0.1]) by cyclone.stortek.com (8.9.3/8.9.3) with ESMTP id LAA10964 for ; Wed, 14 Mar 2001 11:41:35 -0700 (MST) Received: from vinson-atm6.stortek.com (root@vinson.stortek.com [129.80.40.134] (may be forged)) by cyclone.stortek.com (8.9.3/8.9.3) with ESMTP id LAA10958 for ; Wed, 14 Mar 2001 11:41:34 -0700 (MST) Received: from lsv-bridge.stortek.com (lsv-bridge.stortek.com [129.80.5.131]) by vinson-atm6.stortek.com (8.9.3/8.9.3) with ESMTP id LAA09948 for ; Wed, 14 Mar 2001 11:41:34 -0700 (MST) Received: by lsv-bridge.stortek.com with Internet Mail Service (5.5.2653.19) id ; Wed, 14 Mar 2001 11:41:34 -0700 Message-ID: <10FE17AD5F7ED31188CE002048406DE8514D00@lsv-msg06.stortek.com> From: "Creager, Robert S" To: "'SQL - PGSQL'" Subject: RE: Rule/currval() issue Date: Wed, 14 Mar 2001 11:41:33 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Archive-Number: 200103/287 X-Sequence-Number: 1951 Tom, You indicate trigger, rather than rule. Going by Momjian's book, he indicates that rules are "...ideal for when the action affects other tables." Can you clarify why you would use a trigger for this? I'm asking because I have no clue how to use rules or triggers, but need one or the other to modify a second table on inserts/deletes to the first table. I'd like to make the best choice first if possible. Thanks, Rob > -----Original Message----- > From: Tom Lane [mailto:tgl@sss.pgh.pa.us] > Sent: Wednesday, March 14, 2001 11:09 AM > To: Tim Perdue > Cc: pgsql-sql@postgresql.org > Subject: Re: [SQL] Rule/currval() issue > > > Tim Perdue writes: > > This is related to the plpgsql project I was working on > this morning. I'm > > trying to create a rule, so that when a row is inserted > into a certain table, > > we also create a row over in a "counter table". The problem > lies in getting > > the primary key value (from the sequence) so it can be > inserted in that > > related table. > > You probably should be using a trigger, not a rule at all. > > regards, tom lane > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to > majordomo@postgresql.org) >