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

From Tom Lane
Subject Re: setval('myfunsequence', 0)
Date
Msg-id 11053.1039193845@sss.pgh.pa.us
Whole thread Raw
In response to setval('myfunsequence', 0)  ("Ian Harding" <ianh@tpchd.org>)
List pgsql-general
"Ian Harding" <ianh@tpchd.org> writes:
> 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? 

There's a separate bit in the sequence state that causes it not to
advance on first call; this allows the initial state to be $start
and not $start - $increment (which might underflow).

In recent PG versions you can manipulate the no-advance flag with
a 3-parameter setval() call.

            regards, tom lane

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Order of execution of Constraints, Triggers and Rules
Next
From: valerian
Date:
Subject: [7.3] can't connect with SSL