Re: SERIAL Field

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SERIAL Field
Дата
Msg-id 18254.1020716191@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: SERIAL Field  (Joel Stevenson <jstevenson@bearriver.com>)
Ответы Re: SERIAL Field  (Joel Stevenson <jstevenson@bearriver.com>)
Список pgsql-admin
Joel Stevenson <jstevenson@bearriver.com> writes:
> Though, if you have multiple clients inserting into the table, there
> is a chance that between client A inserting the record and then
> calling currval(), client B could have performed an insert, in which
> case client A gets the value of client B's record.  'nextval() +
> write' avoids this possible overlap.

People who have not studied the documentation frequently make that
claim.  *There is no such risk* (unless A and B are interleaving their
commands on a single database connection, in which case they have lots
worse risks of conflicts than this one).  See
http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/functions-sequence.html

            regards, tom lane

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

Предыдущее
От: Joel Stevenson
Дата:
Сообщение: Re: SERIAL Field
Следующее
От: Joel Stevenson
Дата:
Сообщение: Re: SERIAL Field