Re: resetting sequence to cur max value - Mailing list pgsql-general

From Tom Lane
Subject Re: resetting sequence to cur max value
Date
Msg-id 331.1165981690@sss.pgh.pa.us
Whole thread Raw
In response to Re: resetting sequence to cur max value  (Michael Fuhr <mike@fuhr.org>)
Responses Re: resetting sequence to cur max value  (Berend Tober <btober@seaworthysys.com>)
List pgsql-general
Michael Fuhr <mike@fuhr.org> writes:
> On Tue, Dec 12, 2006 at 12:19:56PM -0500, Tom Lane wrote:
>> Usually you do something like
>>   select setval('seq_name', (select max(idcol) from table) + 1);
>> after loading data into the table.

> Is "+ 1" necessary with the two-parameter form of setval()?

Given the docs you quoted, no --- I was just too lazy to look up whether
it set is_called or not.  With the +1 you don't have to think ;-)

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Statement timeout not working on broken connections with active queries
Next
From: Anton
Date:
Subject: Re: Why DISTINCT ... DESC is slow?