Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 34BA3632830 for ; Sun, 16 May 2010 15:38:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 30617-03 for ; Sun, 16 May 2010 18:38:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mmp1.nems.noaa.gov (mmp1.nems.noaa.gov [140.90.121.156]) by mail.postgresql.org (Postfix) with ESMTP id 6C8FB632CB1 for ; Sun, 16 May 2010 15:38:04 -0300 (ADT) Received: from [198.206.42.50] by mmp1.nems.noaa.gov (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPSA id <0L2I009WGZRE6W50@mmp1.nems.noaa.gov> for pgsql-sql@postgresql.org; Sun, 16 May 2010 14:38:03 -0400 (EDT) Date: Sun, 16 May 2010 14:38:01 -0400 From: Mark Fenbers Subject: import ignoring duplicates To: pgsql-sql@postgresql.org Message-id: <4BF03B89.9020908@noaa.gov> Organization: DOC/NOAA/NWS/OHRFC MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_dnzgno6UmjkmX0Lxy8BtHQ)" User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.311 tagged_above=-5 required=5 tests=BAYES_20=-0.001, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/72 X-Sequence-Number: 34120 This is a multi-part message in MIME format. --Boundary_(ID_dnzgno6UmjkmX0Lxy8BtHQ) Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT I am using psql's \copy command to add records to a database from a file. The file has over 100,000 lines. Occasionally, there is a duplicate, and the import ceases and an internal rollback is performed. In other words, no data is imported even if the first error occurs near the end of the file. I am looking for an option/switch to tell psql (or the \copy command) to skip over any duplicate key constraint viloations and continue to load any data that doesn't violate a duplicate key constraint. Is there such an option? Mark --Boundary_(ID_dnzgno6UmjkmX0Lxy8BtHQ) Content-type: text/x-vcard; charset=utf-8; name=Mark_Fenbers.vcf Content-transfer-encoding: 7BIT Content-disposition: attachment; filename=Mark_Fenbers.vcf begin:vcard fn:Mark Fenbers n:Fenbers;Mark org:National Weather Service;Ohio River Forecast Center adr:;;1901 South OH-134;Wilmington;OH;45177-1908;USA email;internet:Mark.Fenbers@noaa.gov title:Sr. HAS Meteorologist tel;work:937-383-0430 tel;fax:937-383-0033 note:"HAS" is an acronym for Hydrometeorological Analysis and Support x-mozilla-html:TRUE url:http://weather.gov/ohrfc version:2.1 end:vcard --Boundary_(ID_dnzgno6UmjkmX0Lxy8BtHQ)--