Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9846D47728C for ; Thu, 7 Nov 2002 11:13:18 -0500 (EST) Received: from rtlocal.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 549E2476CF4 for ; Thu, 7 Nov 2002 11:08:50 -0500 (EST) Received: (qmail 2355 invoked from network); 7 Nov 2002 15:56:52 -0000 Received: from news1.trade-india.com (HELO www.trade-india.com) (130.94.20.27) by infocom-236-129-del.trade-india.com with SMTP; 7 Nov 2002 15:56:52 -0000 Received: (qmail 20423 invoked by uid 99); 7 Nov 2002 16:08:45 -0000 Received: from 203.145.130.142 (SquirrelMail authenticated user mallah) by mail.trade-india.com with HTTP; Thu, 7 Nov 2002 21:38:45 +0530 (IST) Message-ID: <1101.203.145.130.142.1036685325.squirrel@mail.trade-india.com> Date: Thu, 7 Nov 2002 21:38:45 +0530 (IST) Subject: Re: insert trigger From: To: In-Reply-To: <000801c28478$2c97e810$6401a8c0@SUZIE> References: <000801c28478$2c97e810$6401a8c0@SUZIE> X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Cc: X-Mailer: SquirrelMail (version 1.2.6) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/89 X-Sequence-Number: 6277 Yes Roberto , Trigger are very relaible and are fired in intutive manner. (trigger is fired for every insert ) read documentation of create trigger regds mallah. regds mallah. > I have the following situation: > > when a new record is inserted in to a psql table, i want to be able to update certain > fields. the way i'm doing it right now..to find the last record inserted...is by sorting > the primary key (serial) in descending order and taking the first item in the list...the one > at the top should be the one i just entered...and of course, i then procede to update the > fieldsd i need to update.. > So, basically would like to know if this will always work. will the one at the top (the one w/ > the highest primary key [serial type]) always be the one i just entered. AND does psql ALWAYS > execute the trigger(s) after EVERY single record that is inerted. what would happen if [ n ] > different users try to insert records simultaniously? will psql insert one-execute the trigger, > insert the next-execute the trigger..and so on? or will it insert ALL [n] records AND THEN > execute the trigger? > > i would appreciate any advice--if this would work, or if there is a better way. > > thanks > rbenitez22@yahoo.com ----------------------------------------- Get your free web based email at trade-india.com. "India's Leading B2B eMarketplace.!" http://www.trade-india.com/