Re: Last inserted id

Поиск
Список
Период
Сортировка
От David Horwitz
Тема Re: Last inserted id
Дата
Msg-id 3BEF91F1.259781BC@ched.uct.ac.za
обсуждение исходный текст
Ответ на Re: Last inserted id  (Dave Page <dpage@vale-housing.co.uk>)
Ответы Re: Last inserted id  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-odbc
Him

> Unless I'm missing something, option B _is_ multi-user safe.
> currval() doesn't return the "current" value of the sequence (like
> "select * from my_seq" would) -- it returns the last value that
> nextval() gave that session (hence, it isn't defined until that
> session does a nextval()).
>

Actually the issue is b) is multi-user safe
*if*  you have an exclusive lock on the table. If you don't it is quite
possible for a user to insert an other record between your insertion and the
currval() call

David
--
****************************************************
David Horwitz                   University of Cape Town
IT Officer                      Private Bag
Multimedia Education Group      Rondebosch
            7701
dhorwitz@ched.uct.ac.za          SOUTH AFRICA
Tel:+27 21 650 3841              Fax:+27 21 650 5045
http://www.meg.uct.ac.za
PGP key: http://www.meg.uct.ac.za/dhorwitz/david_horwitz.acs
*************************************************



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

Предыдущее
От: Dave Page
Дата:
Сообщение: Re: Last inserted id
Следующее
От: Jean-Michel POURE
Дата:
Сообщение: Re: Last inserted id