Re: setval('myfunsequence', 0) - Mailing list pgsql-general

From scott.marlowe
Subject Re: setval('myfunsequence', 0)
Date
Msg-id Pine.LNX.4.33.0212060851020.19509-100000@css120.ihs.com
Whole thread Raw
In response to setval('myfunsequence', 0)  ("Ian Harding" <ianh@tpchd.org>)
List pgsql-general
On Fri, 6 Dec 2002, Ian Harding wrote:

> The subject statement does not work for automagically generated sequences (minvalue is 1 by default, it seems.)  I
needto reset a sequence to where nextval('myfunsequence') is 1, and the only way to do it (I think) is to
setval('myfunsequence',0). 
>
> I can just create this particular sequence with minvalue 0 start 1, but I am wondering what is the downside to this
beingthe default?  Alternatively, is there a way to make setval accept a value that is $start - $increment as seems to
happenon creation? 
>

Not true.  Take a look at:
http://developer.postgresql.org/docs/postgres/functions-sequence.html

And note near the bottom, that you can setval with a third boolean value,
like so:

SELECT setval('foo', 1, false);

and the next nextval() will return 1



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: the "/usr/local/pgsql/data" directory size
Next
From: "Ian Harding"
Date:
Subject: Re: setval('myfunsequence', 0)