Re: changing the last_value in a sequence - Mailing list pgsql-general

From Tom Lane
Subject Re: changing the last_value in a sequence
Date
Msg-id 25486.1045597874@sss.pgh.pa.us
Whole thread Raw
In response to changing the last_value in a sequence  ("Aurangzeb M. Agha" <aagha@bigfoot.com>)
List pgsql-general
"Aurangzeb M. Agha" <aagha@bigfoot.com> writes:
> I quickly figured out that I can't update the last_value in my sequence
> table.

You can use setval().  However, if you're using a sequence to generate
IDs then it's fundamentally broken to assume there will be no gaps in
the assigned IDs.  (You'll get a gap anytime an inserting transaction
fails after having done nextval().)  I suggest rethinking your assumption
that there must be a consecutive sequence of TODO numbers ...

            regards, tom lane

pgsql-general by date:

Previous
From: Jean-Luc Lachance
Date:
Subject: Re: Table Partitioning in Postgres:
Next
From: Jan Wieck
Date:
Subject: Re: Anybody see the post?