Re: BUG #16430: Sequence with cache > 1 makes it increment by number specified as cache

Поиск
Список
Период
Сортировка
От Sergei Kornilov
Тема Re: BUG #16430: Sequence with cache > 1 makes it increment by number specified as cache
Дата
Msg-id 1015851589297759@mail.yandex.ru
обсуждение исходный текст
Ответ на BUG #16430: Sequence with cache > 1 makes it increment by number specified as cache  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
Hello

In one DB connection:

=> CREATE SEQUENCE resource_surrogate_id_uniquifier_sequence
         AS integer
         START WITH 0
         INCREMENT BY 1
         MINVALUE 0
         MAXVALUE 79999
         CYCLE
         CACHE 5;
CREATE SEQUENCE
=> select nextval('resource_surrogate_id_uniquifier_sequence');
 nextval 
---------
       0
=> select nextval('resource_surrogate_id_uniquifier_sequence');
 nextval 
---------
       1
=> select nextval('resource_surrogate_id_uniquifier_sequence');
 nextval 
---------
       2
=> select nextval('resource_surrogate_id_uniquifier_sequence');
 nextval 
---------
       3

In another connection:

=> select nextval('resource_surrogate_id_uniquifier_sequence');
 nextval 
---------
       5
=> select nextval('resource_surrogate_id_uniquifier_sequence');
 nextval 
---------
       6

All as expected. This is how the sequence cache option works - we preallocate values for further use in current
connection.

regards, Sergei



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #16430: Sequence with cache > 1 makes it increment by number specified as cache
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #16430: Sequence with cache > 1 makes it increment by numberspecified as cache