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

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 (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-generalpgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-sql by date

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

pgsql-general by date

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

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