Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TW9Je-0005Rn-RO for pgsql-bugs@postgresql.org; Wed, 07 Nov 2012 17:21:26 +0000 Received: from mail-oa0-f46.google.com ([209.85.219.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TW9Jd-00033c-BC for pgsql-bugs@postgresql.org; Wed, 07 Nov 2012 17:21:26 +0000 Received: by mail-oa0-f46.google.com with SMTP id h16so1870673oag.19 for ; Wed, 07 Nov 2012 09:21:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=VAp7OeMy2g6oMbMU1uGy3/U8PczJ8cGWYPpu/flGMlE=; b=c0R9hzUXQ84iD+IEyHTkLH8vBV+ykHAgqTf+29iuyoEQ+o0pm0u+Mv+rHaTFy16d9v Mku5Oqq89gD3LpJrDJVmNiOt79+eKv+W+t2XD1tBVelFjpssY35cN1iS3V5gHnmYh2XA SOOCNjj9bKYjPyVSITr6UUvyaUM64o4oUZVk4w5fU6jaahSlyEDZFPKBJ/tEATudXnYD A1oZLBcKQk4yw3AmU7xgjP93O53J7GhnhRef+olPv26dLARuHeLLZgCaqYJFxxGDGnzR pQsqSvmVjvnKOcAi9RZdKh3o0qQ3eei1dc8INSFP/QpyhoVSqaHYj2HKBeCgFrGUqWTH 2PWQ== Received: by 10.182.132.112 with SMTP id ot16mr3296968obb.69.1352308883731; Wed, 07 Nov 2012 09:21:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.60.116.234 with HTTP; Wed, 7 Nov 2012 09:21:03 -0800 (PST) In-Reply-To: References: From: Pavan Deolasee Date: Wed, 7 Nov 2012 22:51:03 +0530 Message-ID: Subject: Re: duplicate key value violates unique constraint "tableName_pk" To: Saravanan Nagarajan Cc: Pg Bugs Content-Type: multipart/alternative; boundary=14dae93b5caaa432c204cdeaf23d X-Pg-Spam-Score: -1.7 (-) X-Archive-Number: 201211/28 X-Sequence-Number: 34586 --14dae93b5caaa432c204cdeaf23d Content-Type: text/plain; charset=ISO-8859-1 On Wed, Nov 7, 2012 at 4:51 PM, Saravanan Nagarajan wrote: > Hi , > > I am using "Copy From" while dumping bulk data into PGSQL DB from file. > While I am trying to insert the rows, if the primary key already exists, > the complete transaction terminated. > > Postgres cannot handle the constraint violations , i found it into > http://wiki.postgresql.org/wiki/COPY#Caveats_with_implementation . > > Is there any possible way to insert bulk data using "Copy From" with > REPLACE/IGNORE duplicates. > > Did you look at http://pgbulkload.projects.pgfoundry.org/pg_bulkload.html ? That advertises to have the features that you are looking for. I would expect pg_bulkload to also perform equal if not better than COPY command. Thanks, Pavan --14dae93b5caaa432c204cdeaf23d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On Wed, N= ov 7, 2012 at 4:51 PM, Saravanan Nagarajan <n.saravanan86@gmail.com<= /a>> wrote:
Hi ,

I am using "Copy From" w= hile dumping bulk data into PGSQL DB from file. While I am trying to insert= the rows, if the primary key already exists, the complete transaction term= inated.=A0


Is there any possible way to insert bulk data using &qu= ot;Copy From" with REPLACE/IGNORE duplicates.=A0

<= /blockquote>

Did you look at http://pgbulkload.projects.pgfou= ndry.org/pg_bulkload.html ? That advertises to have the features that y= ou are looking for. I would expect pg_bulkload to also perform equal if not= better than COPY command.

Thanks,
Pavan=A0
--14dae93b5caaa432c204cdeaf23d--