diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/attach.test | 15 | ||||
-rw-r--r-- | test/wal.test | 31 |
2 files changed, 46 insertions, 0 deletions
diff --git a/test/attach.test b/test/attach.test index 1e1d426a4..557201d65 100644 --- a/test/attach.test +++ b/test/attach.test @@ -910,4 +910,19 @@ do_execsql_test attach-12.1 { PRAGMA integrity_check; } {ok} +# 2021-03-10 Forum post https://sqlite.org/forum/forumpost/a006d86f72 +# +reset_db +do_test attach-13.1 { + sqlite3 db :memory: + db eval {CREATE TABLE base(x);} + for {set i 0} {$i<$SQLITE_MAX_ATTACHED} {incr i} { + db eval "ATTACH ':memory:' AS a$i" + } + set m "a[expr {$SQLITE_MAX_ATTACHED-1}]" + db eval "CREATE TABLE $m.t1(a INTEGER PRIMARY KEY, b);" + db eval "CREATE TABLE $m.t2(a INTEGER PRIMARY KEY, b);" + db eval {SELECT a FROM t1 WHERE b IN (SELECT a FROM t2);} +} {} + finish_test diff --git a/test/wal.test b/test/wal.test index acc278008..234668240 100644 --- a/test/wal.test +++ b/test/wal.test @@ -1515,5 +1515,36 @@ foreach mode {OFF MEMORY PERSIST DELETE TRUNCATE WAL} { db close } +# 2021-03-10 forum post https://sqlite.org/forum/forumpost/a006d86f72 +# +file delete test.db +sqlite3 db test.db +db eval {PRAGMA journal_mode=WAL} +for {set i 0} {$i<$SQLITE_MAX_ATTACHED} {incr i} { + do_test wal-26.1.$i { + file delete attached-$i.db + db eval "ATTACH 'attached-$i.db' AS a$i;" + db eval "PRAGMA a$i.journal_mode=WAL;" + db eval "CREATE TABLE a$i.t$i (x);" + db eval "INSERT INTO t$i VALUES(zeroblob(10000));" + db eval "DELETE FROM t$i;" + db eval "INSERT INTO t$i VALUES(randomblob(10000));" + expr {[file size attached-$i.db-wal]>10000} + } {1} +} +for {set i [expr {$SQLITE_MAX_ATTACHED-1}]} {$i>=0} {incr i -1} { + do_test wal-26.2.$i { + db eval "PRAGMA a$i.wal_checkpoint(TRUNCATE);" + file size attached-$i.db-wal + } {0} + for {set j 0} {$j<$i} {incr j} { + do_test wal-26.2.$i.$j { + expr {[file size attached-$j.db-wal]>10000} + } {1} + } +} +db close + + test_restore_config_pagecache finish_test |