{
  "slug": "sqlite-query-only",
  "term": "SQLite query_only",
  "aliases": [
    "PRAGMA query_only"
  ],
  "definition": "SQLite query_only is a connection setting that rejects data-changing SQL without making its database handles truly read-only.",
  "note": "With query_only enabled, CREATE, DELETE, DROP, INSERT and UPDATE return SQLITE_READONLY. Checkpoint and COMMIT operations remain possible, and sqlite3_db_readonly is unaffected. The setting therefore does not certify zero filesystem writes. [sqlite-pragma]\n\nIn two constructed schedules, query_only readers rejected a main-table update but observed later committed generations through normal reads in both DELETE and WAL modes. Read permission, transaction snapshot lifetime and the immutable file promise are separate boundaries. [hesela-data]\n\nIn a third schedule, that same SQL-restricting setting allowed TRUNCATE checkpoint: the main-file hash changed and the WAL shrank from 8,272 bytes to zero. All records still matched generation 2. SQL write rejection did not prevent these file-state changes. [hesela-data]",
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "provenance": [
    "The nine-case experiment used SQLite 3.45.1 and sequential calls. File hashes and lengths were observed through the operating system, without syscall tracing, power cuts or proof of stable-media persistence. [hesela-data]"
  ],
  "related": [
    "sqlite-immutable",
    "sqlite-wal-end-mark",
    "database-checkpoint"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "citations": [
    {
      "id": "sqlite-pragma",
      "title": "SQLite: PRAGMA query_only",
      "url": "https://www.sqlite.org/pragma.html#pragma_query_only",
      "accessed": "2026-10-17"
    },
    {
      "id": "hesela-readers",
      "title": "Hesela: measured SQLite reader contracts, nine constructed schedules",
      "url": "https://hesela.com/analyses/sqlite-wal-checkpoint-starvation/#immutable-readers",
      "accessed": "2026-10-17"
    },
    {
      "id": "hesela-data",
      "title": "Hesela: SQLite immutable-reader observations and provenance",
      "url": "https://hesela.dev/research/sqlite-immutable-readers.json",
      "accessed": "2026-10-17"
    }
  ],
  "updated": "2026-10-17"
}
