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

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: getting the oid for a new tuple in a BEFORE trigger
Дата
Msg-id Pine.LNX.4.30.0108301526590.679-100000@peter.localdomain
обсуждение исходный текст
Ответ на getting the oid for a new tuple in a BEFORE trigger  (Markus Wagner <wagner@imsd.uni-mainz.de>)
Список 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 по дате отправления:

Предыдущее
От: Francesco Casadei
Дата:
Сообщение: Re: getting the oid for a new tuple in a BEFORE trigger
Следующее
От: Giorgio Volpe
Дата:
Сообщение: Apache authentication with debian linux