hi,
Idon't know the best way but how about a quick insert in a temp table and 
adding 1 to the inserted oid column each time the trigger will run.!
regards
Omid
>From: Markus Wagner <wagner@imsd.uni-mainz.de>
>To: pgsql-general@postgresql.org, pgsql-sql@postgresql.org,   
>pgsql-hackers@postgresql.org
>Subject: [SQL] getting the oid for a new tuple in a BEFORE trigger
>Date: Wed, 29 Aug 2001 11:15:08 +0200
>
>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


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


Wed, 29 Aug 2001 10:11:16 
"omid omoomi" <oomoomi@hotmail.com>
Re: [SQL] getting the oid for a new tuple in a BEFORE trigger
On Wednesday 29 August 2001 20:05, you wrote:
> hi,
> Idon't know the best way but how about a quick insert in a temp table and
> adding 1 to the inserted oid column each time the trigger will run.!
> regards

As you don't know how many users access the server concurrently and in which 
order they will be served you will probably noty get what you want unless you 
work on a single user single client-server connection all the time.

Horst

Thu, 30 Aug 2001 13:40:49 +1000
Horst Herb <hherb@malleenet.net.au>
Re: Re: [SQL] getting the oid for a new tuple in a BEFORE trigger