Re: skip duplicate key error during inserts

From: "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com>
To: "Ron Johnson" <ron(dot)l(dot)johnson(at)cox(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: skip duplicate key error during inserts
Date: 2006-10-27 10:10:47
Message-ID: 65937bea0610270310n2a95260ub0e5ddc4f7499b14@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/27/06, Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> wrote:

That doesn't help at all during multi-table transactions

What problem do you think you would face in multi-table scenario? I tried
the following and it worked for me; hope this is what you meant by
multi-table transactions:

postgres=# begin;
BEGIN
postgres=# create table t1 ( a int primary key );
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for
table "t1"
CREATE TABLE
postgres=# create table t2 ( a int primary key );
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t2_pkey" for
table "t2"
CREATE TABLE
postgres=# \set ON_ERROR_ROLLBACK on
postgres=# insert into t1 values ( 1 );
INSERT 0 1
postgres=# insert into t1 values ( 1 );
ERROR: duplicate key violates unique constraint "t1_pkey"
postgres=# insert into t2 values ( 1 );
INSERT 0 1
postgres=# insert into t2 values ( 1 );
ERROR: duplicate key violates unique constraint "t2_pkey"
postgres=# commit;
COMMIT
postgres=# select * from t1;
a
---
1
(1 row)

postgres=# select * from t2;
a
---
1
(1 row)

postgres=#

want the loader to kick duplicates out to an
> exception file.
>

Now you are asking for a completely new feature!!!

Regards,

--
gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | yahoo }.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2006-10-27 11:05:32 Re: skip duplicate key error during inserts
Previous Message Purusothaman A 2006-10-27 10:10:02 Re: what is the default username password for PostgreSQL, which was installed with FC5.