Received: from mailrelay3.inwind.it (mailrelay3.inwind.it [212.141.54.103]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7U97hf44351 for ; Thu, 30 Aug 2001 05:07:44 -0400 (EDT) (envelope-from _casadei@libero.it) Received: from [62.98.218.240] (62.98.218.240) by mailrelay3.inwind.it (5.5.029) id 3B83AF650023766A for pgsql-general@postgresql.org; Thu, 30 Aug 2001 11:07:40 +0200 Received: (qmail 1667 invoked by uid 1000); 30 Aug 2001 09:05:23 -0000 Date: Thu, 30 Aug 2001 11:05:23 +0200 From: Francesco Casadei To: Markus Wagner Cc: pgsql-general@postgresql.org, pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [SQL] getting the oid for a new tuple in a BEFORE trigger Message-ID: <20010830110523.A1627@goku.kasby> References: <01082911150802.01558@jumbo> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <01082911150802.01558@jumbo>; from wagner@imsd.uni-mainz.de on Wed, Aug 29, 2001 at 11:15:08AM +0200 X-Operating-System: FreeBSD 4.4-RC i386 X-Archive-Number: 200108/1015 X-Sequence-Number: 14431 On Wed, Aug 29, 2001 at 11:15:08AM +0200, Markus Wagner wrote: > Hi, > > we need to control database changes within BEFORE triggers. > There is no problem with triggers called by update, but there is > a problem with triggers called by insert. > > We strongly need to know the oid of a newly inserted tuple. In this case, we > use tg_newtuple of the TriggerData structure passed to thetrigger function, > and its t_data -> t_oid will have the value '0'. > > Using BEFORE and AFTER triggers would make our lives much harder. > > Is there any way (even hack) to get the oid the newly inserted tuple will > receive? > > Thank you very much, > > Markus > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > end of the original message Read section 24.2.5.4 'Obtaining other results status' of the Programmer's Guide. This is for the PL/pgSQL language, though. Francesco Casadei