temporarily disabling foreign keys - Mailing list pgsql-general

From Seb
Subject temporarily disabling foreign keys
Date
Msg-id 874o52ctmp.fsf@kolob.subpolar.dyndns.org
Whole thread Raw
Responses Re: temporarily disabling foreign keys  (Vick Khera <vivek@khera.org>)
Re: temporarily disabling foreign keys  (John R Pierce <pierce@hogranch.com>)
Re: temporarily disabling foreign keys  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
Hi,

I'm not sure how best to handle this situation.  The tables in a
database need to be completely cleared and copy'ed into about every few
months, as they are updated with new records and corrections from a
provider.  Because the tables have foreign key constraints with 'ON
UPDATE CASCADE ON DELETE RESTRICT', it's not possible to DELETE them
without violating these constraints.  I've been dropping the constraints
while doing these transactions and then recreating them once everything
is done, but this has gotten tedious.  Is there some way to "disable"
the foreign keys and enabling them after the transactions?  Thanks.

Cheers,

--
Seb

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: what is way to specify a DOCTYPE for output from SQL/XML
Next
From: Vick Khera
Date:
Subject: Re: temporarily disabling foreign keys