{
  "id": 22714797,
  "title": "Which Tables Reference This Table? Finding Incoming Foreign Keys in PostgreSQL, MySQL, SQL Server and SQLite",
  "url": "https://urgent.news/2026/11/30/which-tables-reference-this-table-finding-incoming-foreign-keys-in",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-30T02:50:19.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/tbson87/which-tables-reference-this-table-finding-incoming-foreign-keys-in-postgresql-mysql-sql-server-2pgg"
  },
  "original_language": null,
  "account": "To discover which tables reference a specific table, you need to query the database's catalog for foreign keys whose target table matches the table you're interested in. Each database management system (DBMS) stores this information differently, but they all provide a way to perform this lookup. In SQLite, since it stores foreign keys only in the CREATE TABLE statement of the table declaring them, you must scan every table's list to find incoming foreign keys.",
  "summary": "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…",
  "summary_source": "publisher",
  "key_points": [
    "SQLite stores foreign keys in CREATE TABLE statement",
    "Need to scan every table's list in SQLite",
    "Query catalog for foreign keys in other DBMS"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}