Re: getting the oid for a new tuple in a BEFORE trigger - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: getting the oid for a new tuple in a BEFORE trigger
Date
Msg-id Pine.LNX.4.30.0108301526590.679-100000@peter.localdomain
Whole thread Raw
In response to getting the oid for a new tuple in a BEFORE trigger  (Markus Wagner <wagner@imsd.uni-mainz.de>)
List pgsql-sql
Markus Wagner writes:

> 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'.

A less hackish way to do this might be using a sequence object for the
primary key and fetch the next sequence value manually.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



pgsql-sql by date:

Previous
From: Francesco Casadei
Date:
Subject: Re: getting the oid for a new tuple in a BEFORE trigger
Next
From: Giorgio Volpe
Date:
Subject: Apache authentication with debian linux