Re: Suspend Referential Integrity?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Jim Jarrett <jarrett(at)rpa(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Suspend Referential Integrity?
Date: 2005-08-15 17:31:19
Message-ID: 20050815173119.GA1211@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, Aug 08, 2005 at 09:49:38 -0400,
Jim Jarrett <jarrett(at)rpa(dot)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.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Sean Davis 2005-08-15 17:38:47 Re: Suspend Referential Integrity?
Previous Message Tom Lane 2005-08-15 17:22:19 Re: restart postgres 7.3.2 problem