{
  "slug": "sqlite-foreign-key-check",
  "term": "SQLite foreign_key_check",
  "aliases": [
    "PRAGMA foreign_key_check"
  ],
  "definition": "SQLite foreign_key_check reports violations of foreign-key references declared in a database schema.",
  "note": "Validation and enforcement are separate operations. Enabling foreign_keys inside a transaction does not change enforcement; query its effective value outside the transaction. [pragma]\n\nA nullable reference can contain NULL without violating its foreign key. A reference to an unintended but existing parent also passes the measured schema while failing the fixture's owner requirement. [rules] [experiment]",
  "related": [
    "sqlite-integrity-check",
    "backup-verification",
    "sqlite-online-backup"
  ],
  "citations": [
    {
      "id": "pragma",
      "title": "SQLite PRAGMA foreign_keys and foreign_key_check",
      "url": "https://www.sqlite.org/pragma.html#pragma_foreign_key_check",
      "accessed": "2026-10-17"
    },
    {
      "id": "rules",
      "title": "SQLite Foreign Key Support",
      "url": "https://www.sqlite.org/foreignkeys.html",
      "accessed": "2026-10-17"
    },
    {
      "id": "experiment",
      "title": "Hesela: executed SQLite validation-boundary cases",
      "url": "https://hesela.com/analyses/backup-verification-is-not-a-restore-test/#sqlite-validation-boundaries",
      "accessed": "2026-10-17"
    }
  ],
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-17",
  "provenance": [
    "Ten designed cases using SQLite 3.45.1 with DELETE/WAL sources and read-only reopened destinations; no crash, failure-rate or full-application recovery claim."
  ]
}
