- Default in SQLite: SQLite does not do checksums by default. If there is disk corruption, the database or application won't be able to know. A single bit flip can cause issues due to faulty disk, disk driver bug, or other application modifying database files.
- Demonstration Script: A simple script was created to show this. It creates a sample bank database and adds a row for Alice with $83K. Then a single bit is flipped by a specific
ddcommand, and Alice's balance becomes zero. It still passesPRAGMA integrity_check. - WAL and Checksums: SQLite has checksums for WAL frames. But when it detects a corrupt frame, it silently ignores it and subsequent frames without raising an error.
- Checksum VFS Shim: Can be used but with an important caveat. Checksumming only works on databases with a reserve bytes value of exactly 8. The documentation of reserve bytes explains its use by extensions. If using an extension that uses reserve bytes, the Checksum shim can't be used.
- Edit: A follow-up post was written.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用。你还可以使用@来通知其他用户。