From d829335e42289d5f53bc183f85b75ef1d85240c8 Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Thu, 30 Apr 2009 09:10:37 +0000 Subject: [PATCH] When SQLite is configured to use in-memory temp files (either by setting SQLITE_TEMP_STORE during compilation or using the temp_store pragma at run time), store statement/savepoint journals in memory also. Ticket #3825. (CVS 6575) FossilOrigin-Name: 38f8c5a14cd221af9e115a0fea689f2ff39e30e5 --- manifest | 30 ++++++++++----------- manifest.uuid | 2 +- src/btree.c | 4 +-- src/main.c | 65 ++++++++++++++++++++++++++------------------- src/pager.c | 24 ++++++++++++++--- src/pager.h | 4 +-- src/sqliteInt.h | 4 ++- src/vdbe.c | 4 +-- test/conflict.test | 4 +-- test/exclusive.test | 10 +++---- test/tempdb.test | 33 ++++++++++++++++++++++- 11 files changed, 121 insertions(+), 63 deletions(-) diff --git a/manifest b/manifest index 3c290a81e7..d12a2c1f3b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\smemory\sleak\sintroduced\sin\sthe\sprevious\scheck-in.\s(CVS\s6574) -D 2009-04-30T05:40:34 +C When\sSQLite\sis\sconfigured\sto\suse\sin-memory\stemp\sfiles\s(either\sby\ssetting\sSQLITE_TEMP_STORE\sduring\scompilation\sor\susing\sthe\stemp_store\spragma\sat\srun\stime),\sstore\sstatement/savepoint\sjournals\sin\smemory\salso.\sTicket\s#3825.\s(CVS\s6575) +D 2009-04-30T09:10:38 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -106,7 +106,7 @@ F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627 F src/backup.c 0082d0e5a63f04e88faee0dff0a7d63d3e92a78d F src/bitvec.c ef370407e03440b0852d05024fb016b14a471d3d F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c -F src/btree.c 4ac764ea85af796a9fd4875edf07e7f208008871 +F src/btree.c 2b89d1f578c417d68befd801a1291836c923bd1e F src/btree.h 99fcc7e8c4a1e35afe271bcb38de1a698dfc904e F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5 F src/build.c dca0ad77c88cb00f6a11cc080a4f3285672cfa37 @@ -125,7 +125,7 @@ F src/insert.c cdb0f64e53c3d84949b96d50090cc31646fc2857 F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0 F src/legacy.c 2ad5b52df322d0f132f66817095e0e79c8942611 F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc -F src/main.c e5249f662cd2bff88baeee5c5dda3b4364b91a51 +F src/main.c 468258773bfcd01ca637d23743188e97ab28f77f F src/malloc.c a1f0f8ae110abb8eb546e259ab0eaea7e0f9b588 F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270 @@ -146,8 +146,8 @@ F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5 F src/os_unix.c 9ad9f45049a3c9eb0b0713b162ff0d7024ff7259 F src/os_win.c 725c38a524d168ce280446ad8761d731bc516405 -F src/pager.c 1c41ddee47a9f6c5e3431faac071ef705fb736f9 -F src/pager.h 0c9f3520c00d8a3b8e792ca56c9a11b6b02b4b0f +F src/pager.c 4c9c51dd73d778ba835a2f922b6c39b680a660d0 +F src/pager.h 73f481a308a873ccd626d97331c081db3b53e2e5 F src/parse.y b7e4341b21736a90b952aa6bb663ec98529b778e F src/pcache.c 395f752a13574120bd7513a400ba02a265aaa76d F src/pcache.h 9b927ccc5a538e31b4c3bc7eec4f976db42a1324 @@ -162,7 +162,7 @@ F src/select.c 40748e8044b79d41ba04ce1014ae45434ed452d3 F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7 F src/sqlite.h.in 2b7667d7912abe14af4ab84e7c4ed022e734f7ba F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 -F src/sqliteInt.h 61be3597d7dce6b3d360a7185c760c3e4e968a59 +F src/sqliteInt.h 004344b097e240b7c22a1755360b2c6ebd10c18c F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d @@ -203,7 +203,7 @@ F src/update.c 5062f0f042f67a4da0aff69949f145e2bc96e3cd F src/utf.c 9541d28f40441812c0b40f00334372a0542c00ff F src/util.c 828c552a22a1d5b650b8a5ea0009546715c45d93 F src/vacuum.c 07121a727beeee88f27d704a00313ad6a7c9bef0 -F src/vdbe.c b7a27b4c3de1d2df80f3f9ee5a206c4af2abeb5a +F src/vdbe.c 5fe07cce9f010cd052535463bd0348e8d513b448 F src/vdbe.h 35a648bc3279a120da24f34d9a25213ec15daf8a F src/vdbeInt.h 8726f7b4e3b55c8acf6d304a5b5f727ac1b6c5ab F src/vdbeapi.c 86aa27a5f3493aaffb8ac051782aa3b22670d7ed @@ -278,7 +278,7 @@ F test/collate9.test 3adcc799229545940df2f25308dd1ad65869145a F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6 F test/colmeta.test 087c42997754b8c648819832241daf724f813322 F test/colname.test 69fea30632d55862a012d3786c7d5fd1329f78db -F test/conflict.test bb29b052c60a1f7eb6382be77902061d1f305318 +F test/conflict.test 0ed68b11f22721052d880ee80bd528a0e0828236 F test/corrupt.test 5bcf7a986358123b8055dfa64b45fc2fb54dcaa9 F test/corrupt2.test a571e30ea4e82318f319a24b6cc55935ce862079 F test/corrupt3.test 263e8bb04e2728df832fddf6973cf54c91db0c32 @@ -317,7 +317,7 @@ F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398 F test/enc3.test 5c550d59ff31dccdba5d1a02ae11c7047d77c041 F test/eval.test bc269c365ba877554948441e91ad5373f9f91be3 -F test/exclusive.test cb991e44aa7cf744976143afce18586920f6696a +F test/exclusive.test c5f55add88f172cee113801c5463e64d85a1fb28 F test/exclusive2.test 6bdf254770a843c2933b54bee9ed239934f0a183 F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7 F test/expr.test 80f3cf99f786ffbac19d2b0083673e7fc797030f @@ -561,7 +561,7 @@ F test/sync.test ded6b39d8d8ca3c0c5518516c6371b3316d3e3a3 F test/table.test e47c9323396976389a15fa0cd22ce3a405433186 F test/tableapi.test 505031f15b18a750184d967d2c896cf88fcc969c F test/tclsqlite.test 8b1150d0486c4848c70d96422513a91c5342be0e -F test/tempdb.test b88ac8a19823cf771d742bf61eef93ef337c06b1 +F test/tempdb.test 5f03555be35edc56d2e1a2b31aa9ca81c964ddc4 F test/temptable.test 5d8ca46be28cc06c887c5a77df650843b7edbae1 F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05 F test/tester.tcl b22f925f3c6eea6283e29a81a7379091ca89ab40 @@ -725,7 +725,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P a6cb4002ada311b56fa2b7430b98b9a0fa698a01 -R 66a9f4fcfdc6b7afc02ad657124691ef -U drh -Z 1a309d6a333ba8af89e2e9af078bec90 +P f082bf36051fef92ddda0339777a00cd1f0ba988 +R 18faf906fa9b82f640353267c330ca5b +U danielk1977 +Z 5e9ac0bdebbeb1ca8a2fe56ff9ec8057 diff --git a/manifest.uuid b/manifest.uuid index 3061f83c6d..0e2a5f33af 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f082bf36051fef92ddda0339777a00cd1f0ba988 \ No newline at end of file +38f8c5a14cd221af9e115a0fea689f2ff39e30e5 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index a93b10f484..315991eb57 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.600 2009/04/30 01:22:41 drh Exp $ +** $Id: btree.c,v 1.601 2009/04/30 09:10:38 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. @@ -2213,7 +2213,7 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag){ if( pBt->readOnly ){ rc = SQLITE_READONLY; }else{ - rc = sqlite3PagerBegin(pBt->pPager, wrflag>1); + rc = sqlite3PagerBegin(pBt->pPager,wrflag>1,sqlite3TempInMemory(p->db)); if( rc==SQLITE_OK ){ rc = newDatabase(pBt); } diff --git a/src/main.c b/src/main.c index 555da89eb5..1a0c2b0892 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.542 2009/04/28 15:35:39 danielk1977 Exp $ +** $Id: main.c,v 1.543 2009/04/30 09:10:38 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -1165,6 +1165,38 @@ void *sqlite3_rollback_hook( return pRet; } +/* +** This function returns true if main-memory should be used instead of +** a temporary file for transient pager files and statement journals. +** The value returned depends on the value of db->temp_store (runtime +** parameter) and the compile time value of SQLITE_TEMP_STORE. The +** following table describes the relationship between these two values +** and this functions return value. +** +** SQLITE_TEMP_STORE db->temp_store Location of temporary database +** ----------------- -------------- ------------------------------ +** 0 any file (return 0) +** 1 1 file (return 0) +** 1 2 memory (return 1) +** 1 0 file (return 0) +** 2 1 file (return 0) +** 2 2 memory (return 1) +** 2 0 memory (return 1) +** 3 any memory (return 1) +*/ +int sqlite3TempInMemory(sqlite3 *db){ +#if SQLITE_TEMP_STORE==1 + return ( db->temp_store==2 ); +#endif +#if SQLITE_TEMP_STORE==2 + return ( db->temp_store!=1 ); +#endif +#if SQLITE_TEMP_STORE==3 + return 1; +#endif + return 0; +} + /* ** This routine is called to create a connection to a database BTree ** driver. If zFilename is the name of a file, then that file is @@ -1175,20 +1207,8 @@ void *sqlite3_rollback_hook( ** soon as the connection is closed. ** ** A virtual database can be either a disk file (that is automatically -** deleted when the file is closed) or it an be held entirely in memory, -** depending on the values of the SQLITE_TEMP_STORE compile-time macro and the -** db->temp_store variable, according to the following chart: -** -** SQLITE_TEMP_STORE db->temp_store Location of temporary database -** ----------------- -------------- ------------------------------ -** 0 any file -** 1 1 file -** 1 2 memory -** 1 0 file -** 2 1 file -** 2 2 memory -** 2 0 memory -** 3 any memory +** deleted when the file is closed) or it an be held entirely in memory. +** The sqlite3TempInMemory() function is used to determine which. */ int sqlite3BtreeFactory( const sqlite3 *db, /* Main database when opening aux otherwise 0 */ @@ -1209,22 +1229,11 @@ int sqlite3BtreeFactory( if( db->flags & SQLITE_NoReadlock ){ btFlags |= BTREE_NO_READLOCK; } - if( zFilename==0 ){ -#if SQLITE_TEMP_STORE==0 - /* Do nothing */ -#endif #ifndef SQLITE_OMIT_MEMORYDB -#if SQLITE_TEMP_STORE==1 - if( db->temp_store==2 ) zFilename = ":memory:"; -#endif -#if SQLITE_TEMP_STORE==2 - if( db->temp_store!=1 ) zFilename = ":memory:"; -#endif -#if SQLITE_TEMP_STORE==3 + if( zFilename==0 && sqlite3TempInMemory(db) ){ zFilename = ":memory:"; -#endif -#endif /* SQLITE_OMIT_MEMORYDB */ } +#endif if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (zFilename==0 || *zFilename==0) ){ vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB; diff --git a/src/pager.c b/src/pager.c index 001ed0844d..4f2954064f 100644 --- a/src/pager.c +++ b/src/pager.c @@ -18,7 +18,7 @@ ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.583 2009/04/28 05:27:20 danielk1977 Exp $ +** @(#) $Id: pager.c,v 1.584 2009/04/30 09:10:38 danielk1977 Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -229,6 +229,12 @@ struct PagerSavepoint { ** TODO: It might be easier to set this variable in writeJournalHdr() ** and writeMasterJournal() only. Change its meaning to "unsynced data ** has been written to the journal". +** +** subjInMemory +** +** This is a boolean variable. If true, then any required sub-journal +** is opened as an in-memory journal file. If false, then in-memory +** sub-journals are only used for in-memory pager files. */ struct Pager { sqlite3_vfs *pVfs; /* OS functions to use for IO */ @@ -262,6 +268,7 @@ struct Pager { u8 setMaster; /* True if a m-j name has been written to jrnl */ u8 doNotSync; /* Boolean. While true, do not spill the cache */ u8 dbSizeValid; /* Set when dbSize is correct */ + u8 subjInMemory; /* True to use in-memory sub-journals */ Pgno dbSize; /* Number of pages in the database */ Pgno dbOrigSize; /* dbSize before the current transaction */ Pgno dbFileSize; /* Number of pages in the database file */ @@ -3905,7 +3912,7 @@ void sqlite3PagerUnref(DbPage *pPg){ static int openSubJournal(Pager *pPager){ int rc = SQLITE_OK; if( isOpen(pPager->jfd) && !isOpen(pPager->sjfd) ){ - if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ){ + if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->subjInMemory ){ sqlite3MemJournalOpen(pPager->sjfd); }else{ rc = pagerOpentemp(pPager, pPager->sjfd, SQLITE_OPEN_SUBJOURNAL); @@ -4024,10 +4031,19 @@ static int pager_open_journal(Pager *pPager){ ** ** If the journal file is opened (or if it is already open), then a ** journal-header is written to the start of it. +** +** If the subjInMemory argument is non-zero, then any sub-journal opened +** within this transaction will be opened as an in-memory file. This +** has no effect if the sub-journal is already opened (as it may be when +** running in exclusive mode) or if the transaction does not require a +** sub-journal. If the subjInMemory argument is zero, then any required +** sub-journal is implemented in-memory if pPager is an in-memory database, +** or using a temporary file otherwise. */ -int sqlite3PagerBegin(Pager *pPager, int exFlag){ +int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){ int rc = SQLITE_OK; assert( pPager->state!=PAGER_UNLOCK ); + pPager->subjInMemory = subjInMemory; if( pPager->state==PAGER_SHARED ){ assert( pPager->pInJournal==0 ); assert( !MEMDB && !pPager->tempFile ); @@ -4112,7 +4128,7 @@ static int pager_write(PgHdr *pPg){ ** create it if it does not. */ assert( pPager->state!=PAGER_UNLOCK ); - rc = sqlite3PagerBegin(pPager, 0); + rc = sqlite3PagerBegin(pPager, 0, pPager->subjInMemory); if( rc!=SQLITE_OK ){ return rc; } diff --git a/src/pager.h b/src/pager.h index 011f91c403..a0110f8595 100644 --- a/src/pager.h +++ b/src/pager.h @@ -13,7 +13,7 @@ ** subsystem. The page cache subsystem reads and writes a file a page ** at a time and provides a journal for rollback. ** -** @(#) $Id: pager.h,v 1.100 2009/02/03 16:51:25 danielk1977 Exp $ +** @(#) $Id: pager.h,v 1.101 2009/04/30 09:10:38 danielk1977 Exp $ */ #ifndef _PAGER_H_ @@ -119,7 +119,7 @@ void *sqlite3PagerGetExtra(DbPage *); /* Functions used to manage pager transactions and savepoints. */ int sqlite3PagerPagecount(Pager*, int*); -int sqlite3PagerBegin(Pager*, int exFlag); +int sqlite3PagerBegin(Pager*, int exFlag, int); int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int); int sqlite3PagerSync(Pager *pPager); int sqlite3PagerCommitPhaseTwo(Pager*); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index e2b451b42e..758afafe20 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.862 2009/04/28 15:43:45 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.863 2009/04/30 09:10:38 danielk1977 Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -2765,6 +2765,8 @@ int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *); int sqlite3Reprepare(Vdbe*); void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*); CollSeq *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *); +int sqlite3TempInMemory(sqlite3 *); + /* diff --git a/src/vdbe.c b/src/vdbe.c index b2b3c57b5d..f7bf172d62 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.839 2009/04/22 17:15:03 drh Exp $ +** $Id: vdbe.c,v 1.840 2009/04/30 09:10:38 danielk1977 Exp $ */ #include "sqliteInt.h" #include "vdbeInt.h" @@ -2464,7 +2464,7 @@ case OP_Savepoint: { db->isTransactionSavepoint = 1; }else{ db->nSavepoint++; - } + } /* Link the new savepoint into the database handle's list. */ pNew->pNext = db->pSavepoint; diff --git a/test/conflict.test b/test/conflict.test index 8eb25b1112..44390d20f2 100644 --- a/test/conflict.test +++ b/test/conflict.test @@ -13,7 +13,7 @@ # This file implements tests for the conflict resolution extension # to SQLite. # -# $Id: conflict.test,v 1.31 2008/01/21 16:22:46 drh Exp $ +# $Id: conflict.test,v 1.32 2009/04/30 09:10:38 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -308,7 +308,7 @@ foreach {i conf1 cmd t0 t1 t2 t3 t4} { } { if {$t0} {set t1 {column a is not unique}} if {[info exists TEMP_STORE] && $TEMP_STORE>=2} { - set t3 $t4 + set t3 0 } else { set t3 [expr {$t3+$t4}] } diff --git a/test/exclusive.test b/test/exclusive.test index de25a08848..f4d70089b5 100644 --- a/test/exclusive.test +++ b/test/exclusive.test @@ -12,7 +12,7 @@ # of these tests is exclusive access mode (i.e. the thing activated by # "PRAGMA locking_mode = EXCLUSIVE"). # -# $Id: exclusive.test,v 1.11 2008/12/22 11:43:36 danielk1977 Exp $ +# $Id: exclusive.test,v 1.12 2009/04/30 09:10:38 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -417,7 +417,7 @@ do_test exclusive-5.1 { # Three files are open: The db, journal and statement-journal. set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds -} {3} +} [expr 3 - ($TEMP_STORE>=2)] do_test exclusive-5.2 { execsql { COMMIT; @@ -435,7 +435,7 @@ do_test exclusive-5.3 { # Two files open: the db and journal. set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds -} {2} +} [expr 3 - ($TEMP_STORE>=2)] do_test exclusive-5.4 { execsql { INSERT INTO abc SELECT a+10, b+10, c+10 FROM abc; @@ -443,7 +443,7 @@ do_test exclusive-5.4 { # Three files are open: The db, journal and statement-journal. set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds -} {3} +} [expr 3 - ($TEMP_STORE>=2)] do_test exclusive-5.5 { execsql { COMMIT; @@ -451,7 +451,7 @@ do_test exclusive-5.5 { # Three files are still open: The db, journal and statement-journal. set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds -} {3} +} [expr 3 - ($TEMP_STORE>=2)] do_test exclusive-5.6 { execsql { PRAGMA locking_mode = normal; diff --git a/test/tempdb.test b/test/tempdb.test index 5e4663fe0a..405ba2da4c 100644 --- a/test/tempdb.test +++ b/test/tempdb.test @@ -12,7 +12,7 @@ # The focus of this file is in making sure that rolling back # a statement journal works correctly. # -# $Id: tempdb.test,v 1.1 2008/04/15 00:02:00 drh Exp $ +# $Id: tempdb.test,v 1.2 2009/04/30 09:10:38 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -52,4 +52,35 @@ do_test tempdb-1.2 { } } {} +do_test tempdb-2.1 { + set default_in_memory [expr {$TEMP_STORE == 3}] + db close + sqlite3 db test.db +} {} +do_test tempdb-2.2 { + execsql { + CREATE TABLE t1 (a PRIMARY KEY, b, c); + CREATE TABLE t2 (a, b, c); + BEGIN; + INSERT INTO t1 VALUES(1, 2, 3); + INSERT INTO t1 VALUES(4, 5, 6); + INSERT INTO t2 SELECT * FROM t1; + } + catchsql { INSERT INTO t1 SELECT * FROM t2 } + set sqlite_open_file_count +} [expr 2 + (0==$default_in_memory)] +do_test tempdb-2.3 { + execsql { + PRAGMA temp_store = 'memory'; + ROLLBACK; + BEGIN; + INSERT INTO t1 VALUES(1, 2, 3); + INSERT INTO t1 VALUES(4, 5, 6); + INSERT INTO t2 SELECT * FROM t1; + } + catchsql { INSERT INTO t1 SELECT * FROM t2 } + set sqlite_open_file_count +} {2} + finish_test + -- 2.47.2