Re: Suspend Referential Integrity? - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: Suspend Referential Integrity?
Date
Msg-id 20050815173119.GA1211@wolff.to
Whole thread Raw
In response to Suspend Referential Integrity?  (Jim Jarrett <jarrett@rpa.net>)
Responses Re: Suspend Referential Integrity?  (Sean Davis <sdavis2@mail.nih.gov>)
List pgsql-novice
On Mon, Aug 08, 2005 at 09:49:38 -0400,
  Jim Jarrett <jarrett@rpa.net> wrote:
> I'm trying to load a database ported from Oracle.  The commands I was given to
> load data into the table are in alphabetical order; when I run them, I get
> errors because I'm violating RI rules (eg. table "CUSTOMER" has RI to "SOURCE",
> but CUSTOMER attempts to load before SOURCE).
>
> Certainly, I could try to reorder the load statements, but that would be just a
> huge PITA.  Is there a way to temporarily suspend RI on a PostgreSQL
> database/schema, and then "fix it later?" Either delete the rows that break
> rules or add rows to fix the violations?

For an initial load the best thing is probably to not include the foreign key
constraints in the initial table definitions and add them at the end of the
load using alter table commands.

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: restart postgres 7.3.2 problem
Next
From: Sean Davis
Date:
Subject: Re: Suspend Referential Integrity?