Re: Suspend Referential Integrity?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Jim Jarrett <jarrett(at)rpa(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Suspend Referential Integrity?
Date: 2005-08-09 13:31:06
Message-ID: 20050809133106.GA10109@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, Aug 09, 2005 at 09:14:50AM -0400, Jim Jarrett wrote:
> Is there a way to temporarily suspend RI checking so I can load the data and
> then fix it later?

You could drop and then re-create the foreign key constraints with
ALTER TABLE, or you could create the constraints as DEFERRABLE and
defer them during the load with SET CONSTRAINTS (or make them
INITIALLY DEFERRED).

http://www.postgresql.org/docs/8.0/static/sql-altertable.html
http://www.postgresql.org/docs/8.0/static/sql-createtable.html
http://www.postgresql.org/docs/8.0/static/sql-set-constraints.html

--
Michael Fuhr

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Lance Arlaus 2005-08-09 23:13:17 Getting exception information (SQLERRM, SQLSTATE, etc.)
Previous Message Sean Davis 2005-08-09 13:27:52 Re: Suspend Referential Integrity?