Thread: Drop All Foreign Keys ? PostgreSQL 7.2.1

Drop All Foreign Keys ? PostgreSQL 7.2.1

From
Bart
Date:
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