How to get a list of all disabled foreign keys for all tables in PostgreSQL?
I have example: in MSSQL, it is done like this:
select * from sys.foreign_keys where is_disabled=1
You have to check if the system trigger that belongs to the foreign key constraint is disabled:
SELECT t.tgrelid::regclass AS table_name,
c.conname AS constraint
FROM pg_trigger AS t
JOIN pg_constraint AS c
ON t.tgconstraint = c.oid
WHERE t.tgenabled = 'D';