Re: Cannot insert dup id in pk

From: Scott Cain <cain(at)cshl(dot)org>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Cannot insert dup id in pk
Date: 2003-07-15 16:47:32
Message-ID: 1058287652.1444.8.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 2003-07-15 at 10:43, Dmitry Tkach wrote:
> You must have your sequence out of date with the content of the table
> (so that the next value in the sequence has already been inserted).
> One way to get into a situation like that is loading the table data with
> COPY (the input contains the pks, and the COPY command does not update
> the sequence, you have to do that manually after the copy is done).

Yes, this is exactly what happened. I had no idea that copy didn't
update the sequence. I suspect I've got users who are being bitten by
this and don't realize it. I'll have to change my "bulk loading" script
to update the sequence after the load is done.

Thanks much,
Scott

--
------------------------------------------------------------------------
Scott Cain, Ph. D. cain(at)cshl(dot)org
GMOD Coordinator (http://www.gmod.org/) 216-392-3087
Cold Spring Harbor Laboratory

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stuart 2003-07-15 17:31:31 Re: Count dates distinct within an interval
Previous Message floyds 2003-07-15 16:13:56 column doesn't get calculated