Deleting conflicting rows when creating a foreign key

From: Igor Katson <descentspb(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Deleting conflicting rows when creating a foreign key
Date: 2009-02-10 13:55:43
Message-ID: 4991875F.4080508@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am doing an ALTER TABLE to create a foreign key, however with some
rows i get:

insert or update on table "name" violates foreign key constraint "name_fkey"

How can I just drop the conflicting rows while doing that?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Richardson 2009-02-10 14:09:16 Slow database creation
Previous Message SHARMILA JOTHIRAJAH 2009-02-10 12:10:43 Re: ora2pg or dbi_link ?