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

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Markus Wagner <wagner(at)imsd(dot)uni-mainz(dot)de>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: getting the oid for a new tuple in a BEFORE trigger
Date: 2001-08-30 13:28:10
Message-ID: Pine.LNX.4.30.0108301526590.679-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers 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(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2001-08-30 13:35:30 --enable-syslog and Solaris 7
Previous Message Tod McQuillin 2001-08-30 12:34:24 Re: sub select

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2001-08-30 14:32:18 Re: Re: Toast,bytea, Text -blob all confusing
Previous Message Peter Eisentraut 2001-08-30 13:26:30 Re: Odd rule behavior?

Browse pgsql-sql by date

  From Date Subject
Next Message Giorgio Volpe 2001-08-30 13:35:51 Apache authentication with debian linux
Previous Message Francesco Casadei 2001-08-30 09:05:23 Re: [SQL] getting the oid for a new tuple in a BEFORE trigger