X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 44476CB571 for ; Tue, 15 Jul 2003 16:47:15 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 56072-03 for ; Tue, 15 Jul 2003 16:47:33 +0000 (GMT) Received: from mail-3.zoominternet.net (mail-3.zoominternet.net [63.67.120.3]) by svr1.postgresql.org (Postfix) with SMTP id DA81ECC41A for ; Tue, 15 Jul 2003 13:47:03 -0300 (ADT) Received: (qmail 8895 invoked from network); 15 Jul 2003 16:47:29 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-3.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 15 Jul 2003 16:47:29 -0000 Subject: Re: Cannot insert dup id in pk From: Scott Cain To: Dmitry Tkach Cc: pgsql-sql@postgresql.org In-Reply-To: <3F1412F6.2020100@openratings.com> References: <1058274025.1451.6.camel@localhost.localdomain> <3F1412F6.2020100@openratings.com> Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1058287652.1444.8.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 15 Jul 2003 12:47:32 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/188 X-Sequence-Number: 14302 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