Re: PQendcopy:resetting connection Problem and Cannot insert a duplicate key into unique index

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: "Wang, Mary Y" <mary(dot)y(dot)wang(at)boeing(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: PQendcopy:resetting connection Problem and Cannot insert a duplicate key into unique index
Date: 2010-02-03 21:26:14
Message-ID: dcc563d11002031326w3e6b09a0w3e3e43af63ec9b75@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 3, 2010 at 2:16 PM, Wang, Mary Y <mary(dot)y(dot)wang(at)boeing(dot)com> wrote:
> Thanks Tom.
> I still couldn't find that particular line that caused that problem :-(.  Counting was very pain.
> Is there anyway that I can tell psql just to "ignore" (I mean don't insert it duplicate key into unique index users_pkey) and just keep going without doing the PQendcopy:resetting connection?

Not really directly. What I'd do is remove the unique constraint,
insert, then use something like

select max(row_id) from table t1 join table t2 on
t1.somefield=t2.somefield and t1.row_id<>r2.row_id;

to find dupes and remove them.

Then I'd dump the whole db and migrate to a more modern version of pgsql.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Landscheidt 2010-02-03 22:07:22 Re: JOIN Record returning Function
Previous Message Wang, Mary Y 2010-02-03 21:16:15 Re: PQendcopy:resetting connection Problem and Cannot insert a duplicate key into unique index