Re: [GENERAL] nextval skips values between consecutive calls

2011-10-29 Thread Gavin Flower
: 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

Re: [GENERAL] nextval skips values between consecutive calls

2011-10-28 Thread Merlin Moncure
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 >> >

Re: [GENERAL] nextval skips values between consecutive calls

2011-10-28 Thread depstein
> -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

Re: [GENERAL] nextval skips values between consecutive calls

2011-10-28 Thread Merlin Moncure
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

Re: [GENERAL] nextval skips values between consecutive calls

2011-10-28 Thread depstein
> -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

Re: [GENERAL] nextval skips values between consecutive calls

2011-10-28 Thread Tom Lane
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

[GENERAL] nextval skips values between consecutive calls

2011-10-28 Thread depstein
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