Re: OID's

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема Re: OID's
Дата
Msg-id 87k6tho3k5.fsf@asmodeus.mcnaught.org
обсуждение исходный текст
Ответ на Re: OID's  (Eddy Macnaghten <eddy@edlsystems.com>)
Список pgsql-general
Eddy Macnaghten <eddy@edlsystems.com> writes:

> The other thing to be aware of is if a large number of people are
> writing to the database concurrently it can go wrong (any method).  That
> is if you insert a record (using nextval for the sequence), then someone
> else quickly inserts a row too before you have a chance to get the
> sequence number at the next statement then the sequence number you get
> will be wrong (it would be of the new one, not yours).  This would be
> the case regardless of how the records are committed.

Not the case.  If you use currval(), it will always be the last value
the sequence took *in your session*, so it's immune to other sessions
inserting at the same time.  See the docs.

-Doug

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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Bug or stupidity
Следующее
От: "Leen Besselink"
Дата:
Сообщение: Re: OID's