Removing records that violate foreign key

From: Cliff Wells <logiplexsoftware(at)earthlink(dot)net>
To: pgsql-admin(at)postgresql(dot)org
Subject: Removing records that violate foreign key
Date: 2002-06-18 17:12:32
Message-ID: 20020618101232.04987af7.logiplexsoftware@earthlink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello,

I'm porting an application's data from a proprietary format into PostgreSQL
7.2.1. I'm using ecpg and I basically follow this process:

create tables
create indexes
import data
add foreign key constraints

I have to add the foreign key constraint last as otherwise the import will fail
as the records being referenced won't necessarily exist in PostgreSQL yet. The
problem is that now I'd like to delete any records that violate the constraint.
Any suggestions on a quick way to do this?

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Stephan Szabo 2002-06-18 19:47:28 Re: Removing records that violate foreign key
Previous Message Jean-Christophe ARNU (JX) 2002-06-18 17:02:14 index keeps on growing