: Re: [GENERAL] nextval skips values between consecutive calls
On Fri, Oct 28, 2011 at 10:28 AM, wrote:
-Original Message-
From: Tom Lane [mailto:t...@sss.pgh.pa.us]
Sent: Friday, October 28, 2011 7:22 PM
To: Dmitry Epstein
Cc: pgsql-general@postgresql.org; Peter Gagarinov
Subject: Re
PM
>> >> To: Dmitry Epstein
>> >> Cc: pgsql-general@postgresql.org; Peter Gagarinov
>> >> Subject: Re: [GENERAL] nextval skips values between consecutive calls
>> >>
>> >> writes:
>> >> > -- This is rather surprising
>> >
> -Original Message-
> From: Merlin Moncure [mailto:mmonc...@gmail.com]
> Sent: Friday, October 28, 2011 8:29 PM
> To: Dmitry Epstein
> Cc: t...@sss.pgh.pa.us; pgsql-general@postgresql.org; Peter Gagarinov
> Subject: Re: [GENERAL] nextval skips values between consecutive
On Fri, Oct 28, 2011 at 10:28 AM, wrote:
>> -Original Message-
>> From: Tom Lane [mailto:t...@sss.pgh.pa.us]
>> Sent: Friday, October 28, 2011 7:22 PM
>> To: Dmitry Epstein
>> Cc: pgsql-general@postgresql.org; Peter Gagarinov
>> Subject: Re: [G
> -Original Message-
> From: Tom Lane [mailto:t...@sss.pgh.pa.us]
> Sent: Friday, October 28, 2011 7:22 PM
> To: Dmitry Epstein
> Cc: pgsql-general@postgresql.org; Peter Gagarinov
> Subject: Re: [GENERAL] nextval skips values between consecutive calls
>
> write
writes:
> -- This is rather surprising
> select nextval(' test_sequence'), generate_series(1, 1); -- 3, 1
> select nextval(' test_sequence'), generate_series(1, 1); -- 5, 1
> Is there any explanation for why nextval skips a value in the second case?
The targetlist is evaluated twice because of t
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_sequenc