Re: currval() race condition on server?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: currval() race condition on server?
Дата
Msg-id 8427.1161699501@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: currval() race condition on server?  (Adriaan Joubert <a.joubert@albourne.com>)
Ответы Re: currval() race condition on server?
Список pgsql-jdbc
Adriaan Joubert <a.joubert@albourne.com> writes:
> It feels an awful lot like a timing issue where the sequence
> number is retrieved, but there is a delay until currval can use it. I'm
> not sure how currval works.

There is no "timing issue" in currval --- the server is single-threaded
and it's simply not possible that currval wouldn't be aware of a
previous nextval.

The theory that sounds best to me is the one someone already mentioned
about your trigger having a code path that doesn't execute nextval.
Another straw to grasp at is connection pooling: are you using it,
if so is it conceivable that the SELECT is being issued on a different
connection than the UPDATE?

            regards, tom lane

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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: currval() race condition on server?
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: currval() race condition on server?