Re: Migration problem - serial fields

From: Jeff Boes <jboes(at)nexcerpt(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Migration problem - serial fields
Date: 2002-03-05 17:32:08
Message-ID: a62v8g$1r7f$1@jupiter.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 04 Mar 2002 19:57:50 -0500, Lee Harr wrote:

> SELECT setval('your_seq_name', 654); -- set higher than highest record.

Even better:

SELECT setval('your_seq_name',max(your_seq_col)) from your_table;

You can get away with max, rather than max+1, because the next call to
the sequence will generate max() plus the interval (usually 1).

--
Jeff Boes vox 616.226.9550
Database Engineer fax 616.349.9076
Nexcerpt, Inc. jboes(at)nexcerpt(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Michel POURE 2002-03-05 17:35:39 Re: database problem..
Previous Message Vince Vielhaber 2002-03-05 17:27:32 Re: storing intermediate results in recursive plpgsql