Re: Cannot insert dup id in pk - Mailing list pgsql-sql

From Scott Cain
Subject Re: Cannot insert dup id in pk
Date
Msg-id 1058287652.1444.8.camel@localhost.localdomain
Whole thread Raw
In response to Re: Cannot insert dup id in pk  (Dmitry Tkach <dmitry@openratings.com>)
List 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@cshl.org
GMOD Coordinator (http://www.gmod.org/)                     216-392-3087
Cold Spring Harbor Laboratory



pgsql-sql by date:

Previous
From: "Viorel Dragomir"
Date:
Subject: Re: summing tables
Next
From: Stuart
Date:
Subject: Re: Count dates distinct within an interval