SQLite Forum

Detecting mismatched WAL files
Login
Hello,

In WAL journaling mode, if a `-wal` file exists at the time the first database connection is opened, SQLite will attempt to integrate those changes. However, I couldn't find any documentation describing what happens if the WAL file is accidentally mismatched. For instance, a user could accidentally restore a backup of the main database file, but fail to remove an existing `-wal` file.

In my very limited testing, it seems to me that SQLite blindly accepts a `-wal` file without any sort of validation. Is this the expected behavior? And if so, is there a way to make SQLite validate and fail to checkpoint if the `-wal` file is somehow mismatched?

Thank you in advance.