fix: use SqliteConnectOptions for reliable WAL mode database opening#80
Merged
debba merged 2 commits intodebba:mainfrom Mar 9, 2026
Merged
fix: use SqliteConnectOptions for reliable WAL mode database opening#80debba merged 2 commits intodebba:mainfrom
debba merged 2 commits intodebba:mainfrom
Conversation
Opening SQLite databases in WAL journal mode fails with "unable to open database file" (code 14) because the bare URL connection doesn't configure journal mode handling. Switch to SqliteConnectOptions (consistent with the PostgreSQL driver pattern) with read_only(true) and explicit WAL journal mode, fixing the issue on Windows and when -wal/-shm files are present.
src-tauri/src/pool_manager.rs
Outdated
| let url = format!("sqlite://{}", params.database); | ||
| SqliteConnectOptions::from_str(&url) | ||
| .unwrap_or_else(|_| SqliteConnectOptions::new().filename(¶ms.database)) | ||
| .read_only(true) |
There was a problem hiding this comment.
CRITICAL: .read_only(true) prevents all write operations on SQLite databases
This setting makes SQLite connections read-only, which means users cannot:
- Create tables or indexes
- Insert, update, or delete data
- Execute any DDL or DML write operations
For a database management tool, this breaks core functionality.
Suggested change
| .read_only(true) | |
| .read_only(false) |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Review NotesThe PR changes SQLite connection handling from using a simple URL string to using Changes verified:
Previously reported issue resolved: Files Reviewed (1 file)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.connect(&url)toSqliteConnectOptionswith.connect_with(options)— consistent with how PostgreSQL connections are already handledread_only(true)since Tabularis is a database viewer/browserjournal_mode(Wal)explicitly so sqlx handles WAL journal files (-wal,-shm) correctlyProblem
Opening a SQLite database that uses WAL journal mode fails with:
This happens because the bare
sqlite://URL connection doesn't configure journal mode handling. On Windows especially, if-waland-shmsidecar files exist, the default connection mode can fail to open the database.Test plan
-waland-shmfiles alongside the.dbfile)