1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Fix a problem that could occur if a read-only connection switches its journal mode from "persist" to "off" or "memory" when the file-system contains a hot-journal created by a "PRAGMA journal_mode = wal" command.

FossilOrigin-Name: 85b5ed0253a84791dc263fa9fc672e340f223d785005e915e675c01054f90e0c
This commit is contained in:
dan
2024-10-30 11:21:15 +00:00
parent a2c52fcaca
commit a9a4c7870e
4 changed files with 42 additions and 8 deletions

View File

@@ -85,5 +85,33 @@ do_execsql_test 1.10 {
SELECT * FROM t1
} {1 2 3 4 5 6}
#---------------------------------------------------------
reset_db
do_execsql_test 2.1 {
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES('abc', 'def');
}
set ::delete_shall_fail 1
do_catchsql_test 2.2 {
PRAGMA journal_mode = wal;
} {1 {disk I/O error}}
do_test 2.3 {
sqlite3 db2 test.db -readonly 1
breakpoint
db2 eval {
PRAGMA journal_mode = persist;
PRAGMA journal_mode = off;
}
} {persist off}
do_test 2.4 {
db2 eval {
SELECT * FROM t1
}
} {abc def}
finish_test