Index: src/alter.c ================================================================== --- src/alter.c +++ src/alter.c @@ -1415,14 +1415,16 @@ if( sParse.nErr ) rc = sParse.rc; sqlite3WalkSelect(&sWalker, pTab->pSelect); }else{ /* Modify any FK definitions to point to the new table. */ #ifndef SQLITE_OMIT_FOREIGN_KEY - FKey *pFKey; - for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ - if( sqlite3_stricmp(pFKey->zTo, zOld)==0 ){ - renameTokenFind(&sParse, &sCtx, (void*)pFKey->zTo); + if( db->flags & SQLITE_ForeignKeys ){ + FKey *pFKey; + for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ + if( sqlite3_stricmp(pFKey->zTo, zOld)==0 ){ + renameTokenFind(&sParse, &sCtx, (void*)pFKey->zTo); + } } } #endif /* If this is the table being altered, fix any table refs in CHECK Index: test/mmap1.test ================================================================== --- test/mmap1.test +++ test/mmap1.test @@ -282,10 +282,11 @@ # forcedelete test2.db sqlite3 db2 test2.db do_test 6.0 { db2 eval { + PRAGMA auto_vacuum = 0; PRAGMA page_size = 4096; } } {} do_test 6.1 { db2 eval { Index: test/resetdb.test ================================================================== --- test/resetdb.test +++ test/resetdb.test @@ -211,10 +211,11 @@ db2 close reset_db do_execsql_test 700 { PRAGMA page_size=512; + PRAGMA auto_vacuum = 0; CREATE TABLE t1(a,b,c); CREATE INDEX t1a ON t1(a); CREATE INDEX t1bc ON t1(b,c); WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<10) INSERT INTO t1(a,b,c) SELECT x, randomblob(100),randomblob(100) FROM c;