Index: src/vacuum.c ================================================================== --- src/vacuum.c +++ src/vacuum.c @@ -248,11 +248,13 @@ rc = sqlite3BtreeBeginTrans(pMain, pOut==0 ? 2 : 0, 0); if( rc!=SQLITE_OK ) goto end_of_vacuum; /* Do not attempt to change the page size for a WAL database */ if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain)) - ==PAGER_JOURNALMODE_WAL ){ + ==PAGER_JOURNALMODE_WAL + && pOut==0 + ){ db->nextPagesize = 0; } if( sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), nRes, 0) || (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0)) Index: test/vacuum-into.test ================================================================== --- test/vacuum-into.test +++ test/vacuum-into.test @@ -97,7 +97,38 @@ do_test vacuum-into-510 { db2 eval {SELECT name FROM sqlite_master ORDER BY 1} } {t1 t1b t2} db2 close db close + +# Change the page-size on a VACUUM INTO even if the original +# database is in WAL mode. +# +forcedelete test.db +forcedelete test.db2 +do_test vacuum-into-600 { + sqlite3 db test.db + db eval { + PRAGMA page_size=4096; + PRAGMA journal_mode=WAL; + CREATE TABLE t1(a); + INSERT INTO t1 VALUES(19); + CREATE INDEX t1a ON t1(a); + PRAGMA integrity_check; + } +} {wal ok} +do_execsql_test vacuum-into-610 { + PRAGMA page_size; +} {4096} +do_execsql_test vacuum-into-620 { + PRAGMA page_size=1024; + VACUUM INTO 'test.db2'; +} {} +do_test vacuum-into-630 { + sqlite3 db test.db2 + db eval { + PRAGMA page_size; + PRAGMA integrity_check; + } +} {1024 ok} finish_test