Skip site navigation (1) Skip section navigation (2)

Re: [SQL] getting the oid for a new tuple in a BEFORE trigger

From: Francesco Casadei <f_casadei(at)libero(dot)it>
To: Markus Wagner <wagner(at)imsd(dot)uni-mainz(dot)de>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [SQL] getting the oid for a new tuple in a BEFORE trigger
Date: 2001-08-30 09:05:23
Message-ID: 20010830110523.A1627@goku.kasby (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackerspgsql-sql
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(at)postgresql(dot)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

In response to

pgsql-hackers by date

Next:From: Jon LaphamDate: 2001-08-30 12:39:56
Subject: Re: Odd rule behavior?
Previous:From: Zeugswetter Andreas SB SDDate: 2001-08-30 07:33:15
Subject: RE: Re: Toast,bytea, Text -blob all confusing

pgsql-sql by date

Next:From: Peter EisentrautDate: 2001-08-30 13:28:10
Subject: Re: getting the oid for a new tuple in a BEFORE trigger
Previous:From: Giorgio VolpeDate: 2001-08-30 08:12:53
Subject: Apache authentication with debian linux

pgsql-general by date

Next:From: Tilman SchweitzerDate: 2001-08-30 09:05:39
Subject: Re: Compaq iPAQ and Postgresql
Previous:From: Jacob Vennervald MadsenDate: 2001-08-30 09:04:39
Subject: RE: Default encoding in database

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group