Re: Sequence behaviour.

From: Grant <grant(at)conprojan(dot)com(dot)au>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Sequence behaviour.
Date: 2001-06-19 23:04:05
Message-ID: Pine.LNX.4.21.0106200901270.17073-100000@webster.conprojan.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> > binary_data=# create sequence test;
> > CREATE
> > binary_data=# select nextval('test');
> > NOTICE: test.nextval: sequence was re-created
>
> Um, how did you get that NOTICE? I don't see it.

This is version 7.0.3. I deleted the sequence first.

> Anyway, the answer to your question is that there's another bit of
> state in a sequence: the is_called flag is initially false and is
> set true during the first-ever nextval(). This allows nextval to
> deliver the specified start value on the first call, rather than
> the one after that. In 7.1 setval() takes an optional third
> argument to reset the value of is_called...

Ok. Still a bit weird to me anyhow.

Thanks.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jie Liang 2001-06-20 04:44:08 log file
Previous Message David Brown 2001-06-19 17:05:33 arguments for query files