Re: changing the last_value in a sequence

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: aagha(at)bigfoot(dot)com
Cc: PostgreSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: changing the last_value in a sequence
Date: 2003-02-18 19:51:14
Message-ID: 25486.1045597874@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Aurangzeb M. Agha" <aagha(at)bigfoot(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2003-02-18 20:14:42 Re: Anybody see the post?
Previous Message Jeff Deroshia 2003-02-18 19:47:44 null value in date field