Index: test/malloc_common.tcl ================================================================== --- test/malloc_common.tcl +++ test/malloc_common.tcl @@ -87,12 +87,14 @@ # with the handle [db]. # catch {db close} catch {file delete -force test.db} catch {file delete -force test.db-journal} + catch {file delete -force test.db-wal} catch {file delete -force test2.db} catch {file delete -force test2.db-journal} + catch {file delete -force test2.db-wal} if {[info exists ::mallocopts(-testdb)]} { file copy $::mallocopts(-testdb) test.db } catch { sqlite3 db test.db } if {[info commands db] ne ""} { Index: test/walfault.test ================================================================== --- test/walfault.test +++ test/walfault.test @@ -23,8 +23,34 @@ PRAGMA journal_mode = WAL; CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 2); PRAGMA checkpoint; } + +do_malloc_test walfault-oom-2 -tclprep { + execsql { + PRAGMA journal_mode = WAL; + BEGIN; + CREATE TABLE x(y, z, UNIQUE(y, z)); + INSERT INTO x VALUES(randomblob(100), randomblob(100)); + COMMIT; + PRAGMA wal_checkpoint; + + INSERT INTO x SELECT randomblob(100), randomblob(100) FROM x; + INSERT INTO x SELECT randomblob(100), randomblob(100) FROM x; + INSERT INTO x SELECT randomblob(100), randomblob(100) FROM x; + } + file copy -force test.db testX.db + file copy -force test.db-wal testX.db-wal + db close + file rename -force testX.db test.db + file rename -force testX.db-wal test.db-wal + + sqlite3 db test.db + sqlite3_extended_result_codes db 1 + sqlite3_db_config_lookaside db 0 0 0 +} -sqlbody { + SELECT count(*) FROM x; +} finish_test