Re: setval('myfunsequence', 0)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ian Harding" <ianh(at)tpchd(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: setval('myfunsequence', 0)
Date: 2002-12-06 16:57:25
Message-ID: 11053.1039193845@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Ian Harding" <ianh(at)tpchd(dot)org> writes:
> I can just create this particular sequence with minvalue 0 start 1, but I am wondering what is the downside to this being the default? Alternatively, is there a way to make setval accept a value that is $start - $increment as seems to happen on 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message valerian 2002-12-06 17:37:06 [7.3] can't connect with SSL
Previous Message Stephan Szabo 2002-12-06 16:53:09 Re: Order of execution of Constraints, Triggers and Rules