I want to make all foreign keys in my database deferrable. But there is no possibility to alter an existing constraint. So I need to drop and add again each foreign key. How to do it automatically?
PostgreSQL – Recreate All Foreign Keys as Deferrable in Batch
ddlforeign keypostgresql
Related Question
- SQL Server – How to Cascade Primary Key Update to All Referencing Foreign Keys
- SQL Server – How to Drop All Constraints from All Tables
- Oracle – Understanding Deferrable Foreign Key Constraints
- MySQL – How to Check Foreign Keys Related to a Table
- PostgreSQL Unit Test – Deferrable Foreign Key with PgTap
- MySQL – Multiple Foreign Keys Referencing Single Table in One Statement
Best Answer
You can do this by generating the necessary script.
Spool the output of the above statement into a file and then run that generated script.