From: | Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> |
---|---|
To: | Saravanan Nagarajan <n(dot)saravanan86(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: duplicate key value violates unique constraint "tableName_pk" |
Date: | 2012-11-08 02:19:56 |
Message-ID: | 509B16CC.5050905@ringerc.id.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 11/07/2012 07:21 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.
Typically you COPY into a temporary or UNLOGGED table, then merge the
data into the target table using appropriate `UPDATE ... FROM ... WHERE`
and `INSERT ... SELECT ... WHERE` statements.
--
Craig Ringer
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2012-11-08 08:33:42 | Re: [BUGS] BUG #7534: walreceiver takes long time to detect n/w breakdown |
Previous Message | Tianyin Xu | 2012-11-07 19:17:08 | Re: [BUGS] BUG #7642: Unchecked “stats_temp_directory” causes server hang to requests |