Re: getting back autonumber just inserted

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: getting back autonumber just inserted
Дата
Msg-id 20050707224227.GB23230@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: getting back autonumber just inserted  (PFC <lists@boutiquenumerique.com>)
Ответы Re: getting back autonumber just inserted  (PFC <lists@boutiquenumerique.com>)
Список pgsql-sql
On Fri, Jul 08, 2005 at 12:26:30AM +0200, PFC wrote:
> 
> >That's a different issue than whether currval() is subject to
> >interference from other transactions.  And just wait until PostgreSQL
> >8.1 comes out and people start using lastval() -- then it could get
> >*really* confusing which sequence value you're getting.
> 
>     What happens if an INSERT trigger inserts something into another 
>     table  which also has a sequence ?

Using what, lastval()?  The app will get very confused, because it'll
get the value from the sequence used in the trigger.  Using currval
there is no problem, but you already knew that.

-- 
Alvaro Herrera (<alvherre[a]alvh.no-ip.org>)
"Hay quien adquiere la mala costumbre de ser infeliz" (M. A. Evans)


В списке pgsql-sql по дате отправления:

Предыдущее
От: PFC
Дата:
Сообщение: Re: getting back autonumber just inserted
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: getting back autonumber just inserted