Re: interesting! a sequence clashes with data already in that table - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: interesting! a sequence clashes with data already in that table
Date
Msg-id 20041008132714.GA9830@wolff.to
Whole thread Raw
In response to interesting! a sequence clashes with data already in that table  (Miles Keaton <mileskeaton@gmail.com>)
List pgsql-general
On Fri, Oct 08, 2004 at 03:00:07 -0700,
  Miles Keaton <mileskeaton@gmail.com> wrote:
> I thought Postgres would be smart enough to make the clients_id_seq
> skip existing numbers, but I guess not!

It wouldn't be very efficient to do that.

> Do I, instead, have to be smart enough to set the sequence over the
> highest existing id# from my imported data, so that it can blindly
> increment without clashing?

That is normally what you want to do.

> If so, setval() would be best for that, right?

Yes.

pgsql-general by date:

Previous
From: David Garamond
Date:
Subject: Re: text + text
Next
From: David Garamond
Date:
Subject: Re: when to use NULL and when to NOT NULL DEFAULT ''