Re: interesting! a sequence clashes with data already in that table

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Miles Keaton <mileskeaton(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: interesting! a sequence clashes with data already in that table
Date: 2004-10-08 13:27:14
Message-ID: 20041008132714.GA9830@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 08, 2004 at 03:00:07 -0700,
Miles Keaton <mileskeaton(at)gmail(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2004-10-08 13:31:31 Re: text + text
Previous Message David Garamond 2004-10-08 13:19:26 Re: when to use NULL and when to NOT NULL DEFAULT ''