nextval skips values between consecutive calls
От | |
---|---|
Тема | nextval skips values between consecutive calls |
Дата | |
Msg-id | 29F36C7C98AB09499B1A209D48EAA615BEF34B2487@mail2a.alliedtesting.com обсуждение исходный текст |
Ответы |
Re: nextval skips values between consecutive calls
|
Список | pgsql-general |
I just found an odd thing about nextval (PostgreSQL 9.0): When nextval is called together with a function returning a sequence,such as generate_series or unnest, it skips one value between consecutive calls: create sequence test_sequence; -- This works as expected select nextval(' test_sequence'); -- 1 select nextval(' test_sequence'); -- 2 -- This is rather surprising select nextval(' test_sequence'), generate_series(1, 1); -- 3, 1 select nextval(' test_sequence'), generate_series(1, 1); -- 5, 1 drop sequence test_sequence; Is there any explanation for why nextval skips a value in the second case? By the way, if the second query is rewritten as follows, nextval again generates consecutive values: select nextval(' test_sequence'), ind from (select generate_series(1, 1) ind) A; Is this a bug or a feature? Dmitry Epstein | Developer Allied Testing www.alliedtesting.com We Deliver Quality.
В списке pgsql-general по дате отправления: