Atomic query and update of sequence generators

Поиск
Список
Период
Сортировка
От Jeffrey Tenny
Тема Atomic query and update of sequence generators
Дата
Msg-id 4005E425.2070706@comcast.net
обсуждение исходный текст
Ответы Re: Atomic query and update of sequence generators
Re: Atomic query and update of sequence generators
Список pgsql-sql
If I want to allocate a block of adjacent values from a sequence generator,
is the following statement atomic with respect to the time between
when the call to nextval() and setval()?

SELECT setval('foo', nextval()+20) ...

The goal is to get a sequence of 20 values that are all +1 from each other.

If the above isn't safe in concurrent environments, is there something 
else I can
do to achieve the effect safely?

I saw a similar unanswered question on one of the PostgreSQL newsgroups,
and have a need to do the same thing from my JDBC app.

Tips appreciated.











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

Предыдущее
От: A E
Дата:
Сообщение: REPOST[GENERAL] Quoting for a Select Into - Please Help
Следующее
От: Stuart Barbee
Дата:
Сообщение: Re: REPOST[GENERAL] Quoting for a Select Into - Please Help