Disclosure: I build Schemity , a desktop ERD tool - this post is from our blog and uses it for the examples.
TL;DR: Ask the catalogue for foreign keys whose referenced table is yours: pg_constraint.confrelid in PostgreSQL, REFERENCED_TABLE_NAME in MySQL, sys.foreign_keys.referenced_object_id in SQL Server, and pragma_foreign_key_list across every table in SQLite. Then check two things the list does not tell you: whether a key appears once per partition, and whether it still enforces anything, because disabled and unvalidated keys are listed like the rest.
To find the tables that reference a table, ask the database's catalogue for foreign keys whose referenced table is yours. Every engine records that, but each stores it differently, and the answer it gives back has two traps: some engines list one foreign key several times, and most engines can list keys that enforce nothing.…