sqlite-query-only · shipping · also PRAGMA query_only

SQLite query_only

SQLite query_only is a connection setting that rejects data-changing SQL without making its database handles truly read-only.

Related Observatory article: Read on hesela.com

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. [1]

In 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. [3]

In 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. [3]

query_only is not an evidence-preservation sandbox. On a read-write connection, a read in the constructed hot-journal fixture restored the main file to its committed bytes despite query_only being enabled. Both tested builds agreed; these process-exit observations do not establish physical durability. Preserve original evidence and inspect a separate working copy. [4]

Relations

related
SQLite immutable connection, SQLite WAL end mark, Database checkpoint

Citations

  1. SQLite: PRAGMA query_only (accessed 2026-10-17)
  2. Hesela: SQLite immutable-reader observations and provenance (accessed 2026-10-17)
  3. Hesela: two-build frozen SQLite crash-copy reader matrix, 400 constructed observations (accessed 2026-11-30)

Further reading

  1. Hesela: measured SQLite reader contracts, nine constructed schedules (accessed 2026-10-17)
  2. Hesela: native reproduction code, full observations, source receipts and checks (accessed 2026-11-30)
Sources & caveats
  • 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. [3]

JSON: /data/terms/sqlite-query-only.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. SQLite query_only. Hesela. 2026-11-30. https://hesela.dev/terms/sqlite-query-only/