Given some input PK column, e.g. ani.animals.id
, I want to find all FK constraints names associated with that PK.
I also need table and schema's names where each particular FK constraint is located.
So basically I am looking for all tuples ( schema_name.table_name, FK_constraint_name )
such that FK_constraint_name
is referencing input PK.
As an example, the input PK ani.animals.id
has:
fk_vet_animal
in tableani.vets
fk_person_animal
in tableusr.people
Any ideas how to tackle it?
My ultimate goal is to, given some PK, drop all the found FK constraints, and re-create them with ON UPDATE CASCADE
.