Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 0201E476D83 for ; Tue, 18 Jun 2002 13:59:09 -0400 (EDT) Received: from flamingo.mail.pas.earthlink.net (flamingo.mail.pas.earthlink.net [207.217.120.232]) by postgresql.org (Postfix) with ESMTP id 5CB8A4765F6 for ; Tue, 18 Jun 2002 13:15:00 -0400 (EDT) Received: from apx1-01-146.pdx.du.teleport.com ([216.26.60.146] helo=software1.logiplex.internal) by flamingo.mail.pas.earthlink.net with smtp (Exim 3.33 #2) id 17KMZH-0006le-00 for pgsql-admin@postgresql.org; Tue, 18 Jun 2002 10:15:00 -0700 Date: Tue, 18 Jun 2002 10:12:32 -0700 From: Cliff Wells To: pgsql-admin@postgresql.org Subject: Removing records that violate foreign key Message-Id: <20020618101232.04987af7.logiplexsoftware@earthlink.net> Organization: Logiplex Corporation X-Mailer: Sylpheed version 0.6.5 (GTK+ 1.2.9; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200206/122 X-Sequence-Number: 4557 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