Drop All Foreign Keys ? PostgreSQL 7.2.1

From: Bart <bart(at)sitenet(dot)pl>
To: pgsql-general(at)postgresql(dot)org
Subject: Drop All Foreign Keys ? PostgreSQL 7.2.1
Date: 2003-08-30 10:40:56
Message-ID: bipur9$2agb$1@foka1.acn.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

Sometimes i need to drop one of my tables. DROP TABLE removes all
foreign keys connected with that table. After this i need to recreate FK.

It is not easy to find dropped keys, so i have script to create all keys
in database (ALTER TABLE ... ). It works good, but when FK exists, it
will create another (exacly the same).

So when i run recreateFK script 4 times, i can find 4 exacly the same FK.

I think that script should first drop all FK and after this create all FK.

And there is my question. How to drop all FK from all tables in database ?

Greetings

Bart

Browse pgsql-general by date

  From Date Subject
Next Message Bo Lorentsen 2003-08-30 11:59:20 Commercial postgresql
Previous Message Paul Thomas 2003-08-30 09:46:08 Re: Multiple Connections