]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add tests to make sure statement journals are only opened when necessary. (CVS 2500)
authordrh <drh@noemail.net>
Tue, 7 Jun 2005 02:12:30 +0000 (02:12 +0000)
committerdrh <drh@noemail.net>
Tue, 7 Jun 2005 02:12:30 +0000 (02:12 +0000)
FossilOrigin-Name: 914d6e6549446a6ddf25e5da57d2fe9446750625

manifest
manifest.uuid
src/pager.c
src/test1.c
test/conflict.test

index 0a392805cb6be01ad1ef7b542010804cf73c6d49..bf3f6273185300626d7deae155b9637f6af0868b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Do\snot\sopen\sa\sstatement\sjournal\sunless\sabsolutely\snecessary.\s(CVS\s2499)
-D 2005-06-07T01:43:41
+C Add\stests\sto\smake\ssure\sstatement\sjournals\sare\sonly\sopened\swhen\snecessary.\s(CVS\s2500)
+D 2005-06-07T02:12:30
 F Makefile.in 8129e7f261d405db783676f9ca31e0841768c652
 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -53,7 +53,7 @@ F src/os_unix.c 443ca9d19945a08ba1e325f00e13633b3daa5bfa
 F src/os_unix.h 39a393252e69e72b06715c9958df05ddbc4aa971
 F src/os_win.c 2bbbe6fbb010763c3fa79d5e951afca9b138c6b5
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
-F src/pager.c f86d79d37eb4e30d8e2201dbe12497370719320c
+F src/pager.c 841a2cdddd4275de36cda26ed9dc54ae942660ce
 F src/pager.h 0d9153d6269d60d04af3dd84a0cc0a96253cf4a4
 F src/parse.y 72cd7553f05fbc7b63ea9476108d0da6237f2818
 F src/pragma.c 0ed94a1aa982802a9cf2a932c48d99b60683fa53
@@ -66,7 +66,7 @@ F src/sqlite.h.in f28f5b018f03a66aaf0bc1ab6985d8605d6b964f
 F src/sqliteInt.h 42b464cd380dd81bf7873476fc5974985a506d71
 F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
 F src/tclsqlite.c af0f002d9d6ab4f7f32b9bee5b57665946e76ad9
-F src/test1.c e9c26134a1c5f6de540dc604d70ac851dd5f6493
+F src/test1.c 2ba6be1ffd072792dcdd65f1306ff4e2320aee4e
 F src/test2.c 716c1809dba8e5be6093703e9cada99d627542dc
 F src/test3.c 683e1e3819152ffd35da2f201e507228921148d0
 F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
@@ -118,7 +118,7 @@ F test/collate3.test 51362bdfb43a72bd2b087d90b2623b0695538e7a
 F test/collate4.test daf498e294dcd596b961d425c3f2dda117e4717e
 F test/collate5.test 5a49cd169e7565e4f92b42695667d6d5db25670d
 F test/collate6.test 6c9470d1606ee3e564675b229653e320c49ec638
-F test/conflict.test 3c4ef047070ce495e15d7d267a7d791d6f4ffef5
+F test/conflict.test 3e7beba8c253095330c6853c00aaf6356e84cc68
 F test/corrupt.test 18c7a995b1af76a8c8600b996257f2c7b7bff083
 F test/corrupt2.test 88342570828f2b8cbbd8369eff3891f5c0bdd5ba
 F test/crash.test f38b980a0508655d08c957a6dd27d66bca776504
@@ -281,7 +281,7 @@ F www/tclsqlite.tcl 425be741b8ae664f55cb1ef2371aab0a75109cf9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
 F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b
-P e73d25c7419d580c47925494621df26d2fb9f27e
-R e5d64b9b0612e248c65fc146ea7ea4a7
+P 989573a53b58c1e959ad276119298ba2ea7448e6
+R 27f28696608fee7d814bb075f19fef66
 U drh
-Z e7a36c84aa3464810f6e632e99f01c3c
+Z ebb11158767e3ff2d46645452c3e830b
index 5b41353f755f47512c47db13c79c7d195867b056..7f9dd61140cc533d8c346fdc462c6acd6c931f07 100644 (file)
@@ -1 +1 @@
-989573a53b58c1e959ad276119298ba2ea7448e6
\ No newline at end of file
+914d6e6549446a6ddf25e5da57d2fe9446750625
\ No newline at end of file
index 239232e514e973de8e6cf7662f7812600c1c5ec4..d1b5779d46e173f036421dc96d7c0be00319574b 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.206 2005/05/22 20:30:39 drh Exp $
+** @(#) $Id: pager.c,v 1.207 2005/06/07 02:12:30 drh Exp $
 */
 #ifndef SQLITE_OMIT_DISKIO
 #include "sqliteInt.h"
@@ -1539,8 +1539,15 @@ void sqlite3pager_set_safety_level(Pager *pPager, int level){
 #endif
 
 /*
-** Open a temporary file.  Write the name of the file into zName
-** (zName must be at least SQLITE_TEMPNAME_SIZE bytes long.)  Write
+** The following global variable is incremented whenever the library
+** attempts to open a temporary file.  This information is used for
+** testing and analysis only.  
+*/
+int sqlite3_opentemp_count = 0;
+
+/*
+** Open a temporary file.  Write the name of the file into zFile
+** (zFile must be at least SQLITE_TEMPNAME_SIZE bytes long.)  Write
 ** the file descriptor into *fd.  Return SQLITE_OK on success or some
 ** other error code if we fail.
 **
@@ -1550,6 +1557,7 @@ void sqlite3pager_set_safety_level(Pager *pPager, int level){
 static int sqlite3pager_opentemp(char *zFile, OsFile *fd){
   int cnt = 8;
   int rc;
+  sqlite3_opentemp_count++;  /* Used for testing and analysis only */
   do{
     cnt--;
     sqlite3OsTempFileName(zFile);
index 6764e57d8ece5cd59df8839866a919177f46ec0f..695a34e876fd1b478641f5783385cdc8f1dabf84 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test1.c,v 1.141 2005/06/06 17:54:56 drh Exp $
+** $Id: test1.c,v 1.142 2005/06/07 02:12:30 drh Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -3074,6 +3074,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
   int i;
   extern int sqlite3_os_trace;
   extern int sqlite3_sync_count, sqlite3_fullsync_count;
+  extern int sqlite3_opentemp_count;
  
 
   for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){
@@ -3095,6 +3096,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
       (char*)&sqlite3_current_time, TCL_LINK_INT);
   Tcl_LinkVar(interp, "sqlite_os_trace",
       (char*)&sqlite3_os_trace, TCL_LINK_INT);
+  Tcl_LinkVar(interp, "sqlite_opentemp_count",
+      (char*)&sqlite3_opentemp_count, TCL_LINK_INT);
   Tcl_LinkVar(interp, "sqlite_static_bind_value",
       (char*)&sqlite_static_bind_value, TCL_LINK_STRING);
   Tcl_LinkVar(interp, "sqlite_temp_directory",
index 7470f043201d4228deb833f7e08e256068777997..cc30c17f6a68b8cbfab17214f5bbb096904f8935 100644 (file)
@@ -13,7 +13,7 @@
 # This file implements tests for the conflict resolution extension
 # to SQLite.
 #
-# $Id: conflict.test,v 1.23 2005/03/20 19:10:13 drh Exp $
+# $Id: conflict.test,v 1.24 2005/06/07 02:12:30 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -31,40 +31,37 @@ do_test conflict-1.0 {
 # Six columns of configuration data as follows:
 #
 #   i      The reference number of the test
-#   conf   The conflict resolution algorithm on the BEGIN statement
 #   cmd    An INSERT or REPLACE command to execute against table t1
 #   t0     True if there is an error from $cmd
 #   t1     Content of "c" column of t1 assuming no error in $cmd
 #   t2     Content of "x" column of t2
+#   t3     Number of temporary files created by this test
 #
-foreach {i conf cmd t0 t1 t2} {
-  1 {}       INSERT                  1 {}  1
-  2 {}       {INSERT OR IGNORE}      0 3   1
-  3 {}       {INSERT OR REPLACE}     0 4   1
-  4 {}       REPLACE                 0 4   1
-  5 {}       {INSERT OR FAIL}        1 {}  1
-  6 {}       {INSERT OR ABORT}       1 {}  1
-  7 {}       {INSERT OR ROLLBACK}    1 {}  {}
+foreach {i cmd t0 t1 t2 t3} {
+  1 INSERT                  1 {}  1  0
+  2 {INSERT OR IGNORE}      0 3   1  0
+  3 {INSERT OR REPLACE}     0 4   1  0
+  4 REPLACE                 0 4   1  0
+  5 {INSERT OR FAIL}        1 {}  1  0
+  6 {INSERT OR ABORT}       1 {}  1  0
+  7 {INSERT OR ROLLBACK}    1 {}  {} 0
 } {
-  if { $conf=={} } {
-
   do_test conflict-1.$i {
-    if {$conf!=""} {set conf "ON CONFLICT $conf"}
+    set ::sqlite_opentemp_count 0
     set r0 [catch {execsql [subst {
       DELETE FROM t1;
       DELETE FROM t2;
       INSERT INTO t1 VALUES(1,2,3);
-      BEGIN $conf;
+      BEGIN;
       INSERT INTO t2 VALUES(1); 
       $cmd INTO t1 VALUES(1,2,4);
     }]} r1]
     catch {execsql {COMMIT}}
     if {$r0} {set r1 {}} {set r1 [execsql {SELECT c FROM t1}]}
     set r2 [execsql {SELECT x FROM t2}]
-    list $r0 $r1 $r2
-  } [list $t0 $t1 $t2]
-
-  }
+    set r3 $::sqlite_opentemp_count
+    list $r0 $r1 $r2 $r3
+  } [list $t0 $t1 $t2 $t3]
 }
 
 # Create tables for the first group of tests.
@@ -82,28 +79,26 @@ do_test conflict-2.0 {
 # Six columns of configuration data as follows:
 #
 #   i      The reference number of the test
-#   conf   The conflict resolution algorithm on the BEGIN statement
 #   cmd    An INSERT or REPLACE command to execute against table t1
 #   t0     True if there is an error from $cmd
 #   t1     Content of "c" column of t1 assuming no error in $cmd
 #   t2     Content of "x" column of t2
 #
-foreach {i conf cmd t0 t1 t2} {
-  1 {}       INSERT                  1 {}  1
-  2 {}       {INSERT OR IGNORE}      0 3   1
-  3 {}       {INSERT OR REPLACE}     0 4   1
-  4 {}       REPLACE                 0 4   1
-  5 {}       {INSERT OR FAIL}        1 {}  1
-  6 {}       {INSERT OR ABORT}       1 {}  1
-  7 {}       {INSERT OR ROLLBACK}    1 {}  {}
+foreach {i cmd t0 t1 t2} {
+  1 INSERT                  1 {}  1
+  2 {INSERT OR IGNORE}      0 3   1
+  3 {INSERT OR REPLACE}     0 4   1
+  4 REPLACE                 0 4   1
+  5 {INSERT OR FAIL}        1 {}  1
+  6 {INSERT OR ABORT}       1 {}  1
+  7 {INSERT OR ROLLBACK}    1 {}  {}
 } {
   do_test conflict-2.$i {
-    if {$conf!=""} {set conf "ON CONFLICT $conf"}
     set r0 [catch {execsql [subst {
       DELETE FROM t1;
       DELETE FROM t2;
       INSERT INTO t1 VALUES(1,2,3);
-      BEGIN $conf;
+      BEGIN;
       INSERT INTO t2 VALUES(1); 
       $cmd INTO t1 VALUES(1,2,4);
     }]} r1]
@@ -129,28 +124,26 @@ do_test conflict-3.0 {
 # Six columns of configuration data as follows:
 #
 #   i      The reference number of the test
-#   conf   The conflict resolution algorithm on the BEGIN statement
 #   cmd    An INSERT or REPLACE command to execute against table t1
 #   t0     True if there is an error from $cmd
 #   t1     Content of "c" column of t1 assuming no error in $cmd
 #   t2     Content of "x" column of t2
 #
-foreach {i conf cmd t0 t1 t2} {
-  1 {}       INSERT                  1 {}  1
-  2 {}       {INSERT OR IGNORE}      0 3   1
-  3 {}       {INSERT OR REPLACE}     0 4   1
-  4 {}       REPLACE                 0 4   1
-  5 {}       {INSERT OR FAIL}        1 {}  1
-  6 {}       {INSERT OR ABORT}       1 {}  1
-  7 {}       {INSERT OR ROLLBACK}    1 {}  {}
+foreach {i cmd t0 t1 t2} {
+  1 INSERT                  1 {}  1
+  2 {INSERT OR IGNORE}      0 3   1
+  3 {INSERT OR REPLACE}     0 4   1
+  4 REPLACE                 0 4   1
+  5 {INSERT OR FAIL}        1 {}  1
+  6 {INSERT OR ABORT}       1 {}  1
+  7 {INSERT OR ROLLBACK}    1 {}  {}
 } {
   do_test conflict-3.$i {
-    if {$conf!=""} {set conf "ON CONFLICT $conf"}
     set r0 [catch {execsql [subst {
       DELETE FROM t1;
       DELETE FROM t2;
       INSERT INTO t1 VALUES(1,2,3);
-      BEGIN $conf;
+      BEGIN;
       INSERT INTO t2 VALUES(1); 
       $cmd INTO t1 VALUES(1,2,4);
     }]} r1]
@@ -173,34 +166,32 @@ do_test conflict-4.0 {
 #
 #   i      The reference number of the test
 #   conf1  The conflict resolution algorithm on the UNIQUE constraint
-#   conf2  The conflict resolution algorithm on the BEGIN statement
 #   cmd    An INSERT or REPLACE command to execute against table t1
 #   t0     True if there is an error from $cmd
 #   t1     Content of "c" column of t1 assuming no error in $cmd
 #   t2     Content of "x" column of t2
 #
-foreach {i conf1 conf2 cmd t0 t1 t2} {
-  1 {}       {}       INSERT                  1 {}  1
-  2 REPLACE  {}       INSERT                  0 4   1
-  3 IGNORE   {}       INSERT                  0 3   1
-  4 FAIL     {}       INSERT                  1 {}  1
-  5 ABORT    {}       INSERT                  1 {}  1
-  6 ROLLBACK {}       INSERT                  1 {}  {}
-  7 REPLACE  {}       {INSERT OR IGNORE}      0 3   1
-  8 IGNORE   {}       {INSERT OR REPLACE}     0 4   1
-  9 FAIL     {}       {INSERT OR IGNORE}      0 3   1
- 10 ABORT    {}       {INSERT OR REPLACE}     0 4   1
- 11 ROLLBACK {}       {INSERT OR IGNORE }     0 3   1
+foreach {i conf1 cmd t0 t1 t2} {
+  1 {}       INSERT                  1 {}  1
+  2 REPLACE  INSERT                  0 4   1
+  3 IGNORE   INSERT                  0 3   1
+  4 FAIL     INSERT                  1 {}  1
+  5 ABORT    INSERT                  1 {}  1
+  6 ROLLBACK INSERT                  1 {}  {}
+  7 REPLACE  {INSERT OR IGNORE}      0 3   1
+  8 IGNORE   {INSERT OR REPLACE}     0 4   1
+  9 FAIL     {INSERT OR IGNORE}      0 3   1
+ 10 ABORT    {INSERT OR REPLACE}     0 4   1
+ 11 ROLLBACK {INSERT OR IGNORE }     0 3   1
 } {
   do_test conflict-4.$i {
     if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
-    if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"}
     set r0 [catch {execsql [subst {
       DROP TABLE t1;
       CREATE TABLE t1(a,b,c,UNIQUE(a,b) $conf1);
       DELETE FROM t2;
       INSERT INTO t1 VALUES(1,2,3);
-      BEGIN $conf2;
+      BEGIN;
       INSERT INTO t2 VALUES(1); 
       $cmd INTO t1 VALUES(1,2,4);
     }]} r1]
@@ -223,39 +214,37 @@ do_test conflict-5.0 {
 #
 #   i      The reference number of the test
 #   conf1  The conflict resolution algorithm on the NOT NULL constraint
-#   conf2  The conflict resolution algorithm on the BEGIN statement
 #   cmd    An INSERT or REPLACE command to execute against table t1
 #   t0     True if there is an error from $cmd
 #   t1     Content of "c" column of t1 assuming no error in $cmd
 #   t2     Content of "x" column of t2
 #
-foreach {i conf1 conf2 cmd t0 t1 t2} {
-  1 {}       {}       INSERT                  1 {}  1
-  2 REPLACE  {}       INSERT                  0 5   1
-  3 IGNORE   {}       INSERT                  0 {}  1
-  4 FAIL     {}       INSERT                  1 {}  1
-  5 ABORT    {}       INSERT                  1 {}  1
-  6 ROLLBACK {}       INSERT                  1 {}  {}
-  7 REPLACE  {}       {INSERT OR IGNORE}      0 {}  1
-  8 IGNORE   {}       {INSERT OR REPLACE}     0 5   1
-  9 FAIL     {}       {INSERT OR IGNORE}      0 {}  1
- 10 ABORT    {}       {INSERT OR REPLACE}     0 5   1
- 11 ROLLBACK {}       {INSERT OR IGNORE}      0 {}  1
- 12 {}       {}       {INSERT OR IGNORE}      0 {}  1
- 13 {}       {}       {INSERT OR REPLACE}     0 5   1
- 14 {}       {}       {INSERT OR FAIL}        1 {}  1
- 15 {}       {}       {INSERT OR ABORT}       1 {}  1
- 16 {}       {}       {INSERT OR ROLLBACK}    1 {}  {}
+foreach {i conf1 cmd t0 t1 t2} {
+  1 {}       INSERT                  1 {}  1
+  2 REPLACE  INSERT                  0 5   1
+  3 IGNORE   INSERT                  0 {}  1
+  4 FAIL     INSERT                  1 {}  1
+  5 ABORT    INSERT                  1 {}  1
+  6 ROLLBACK INSERT                  1 {}  {}
+  7 REPLACE  {INSERT OR IGNORE}      0 {}  1
+  8 IGNORE   {INSERT OR REPLACE}     0 5   1
+  9 FAIL     {INSERT OR IGNORE}      0 {}  1
+ 10 ABORT    {INSERT OR REPLACE}     0 5   1
+ 11 ROLLBACK {INSERT OR IGNORE}      0 {}  1
+ 12 {}       {INSERT OR IGNORE}      0 {}  1
+ 13 {}       {INSERT OR REPLACE}     0 5   1
+ 14 {}       {INSERT OR FAIL}        1 {}  1
+ 15 {}       {INSERT OR ABORT}       1 {}  1
+ 16 {}       {INSERT OR ROLLBACK}    1 {}  {}
 } {
   if {$t0} {set t1 {t1.c may not be NULL}}
   do_test conflict-5.$i {
     if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
-    if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"}
     set r0 [catch {execsql [subst {
       DROP TABLE t1;
       CREATE TABLE t1(a,b,c NOT NULL $conf1 DEFAULT 5);
       DELETE FROM t2;
-      BEGIN $conf2;
+      BEGIN;
       INSERT INTO t2 VALUES(1); 
       $cmd INTO t1 VALUES(1,2,NULL);
     }]} r1]
@@ -284,40 +273,42 @@ do_test conflict-6.0 {
 #
 #   i      The reference number of the test
 #   conf1  The conflict resolution algorithm on the UNIQUE constraint
-#   conf2  The conflict resolution algorithm on the BEGIN statement
 #   cmd    An UPDATE command to execute against table t1
 #   t0     True if there is an error from $cmd
 #   t1     Content of "b" column of t1 assuming no error in $cmd
 #   t2     Content of "x" column of t3
+#   t3     Number of temporary files created
 #
-foreach {i conf1 conf2 cmd t0 t1 t2} {
-  1 {}       {}       UPDATE                  1 {6 7 8 9}  1
-  2 REPLACE  {}       UPDATE                  0 {7 6 9}    1
-  3 IGNORE   {}       UPDATE                  0 {6 7 3 9}  1
-  4 FAIL     {}       UPDATE                  1 {6 7 3 4}  1
-  5 ABORT    {}       UPDATE                  1 {1 2 3 4}  1
-  6 ROLLBACK {}       UPDATE                  1 {1 2 3 4}  0
-  7 REPLACE  {}       {UPDATE OR IGNORE}      0 {6 7 3 9}  1
-  8 IGNORE   {}       {UPDATE OR REPLACE}     0 {7 6 9}    1
-  9 FAIL     {}       {UPDATE OR IGNORE}      0 {6 7 3 9}  1
- 10 ABORT    {}       {UPDATE OR REPLACE}     0 {7 6 9}    1
- 11 ROLLBACK {}       {UPDATE OR IGNORE}      0 {6 7 3 9}   1
- 12 {}       {}       {UPDATE OR IGNORE}      0 {6 7 3 9}  1
- 13 {}       {}       {UPDATE OR REPLACE}     0 {7 6 9}    1
- 14 {}       {}       {UPDATE OR FAIL}        1 {6 7 3 4}  1
- 15 {}       {}       {UPDATE OR ABORT}       1 {1 2 3 4}  1
- 16 {}       {}       {UPDATE OR ROLLBACK}    1 {1 2 3 4}  0
+foreach {i conf1 cmd t0 t1 t2 t3} {
+  1 {}       UPDATE                  1 {6 7 8 9}  1 1
+  2 REPLACE  UPDATE                  0 {7 6 9}    1 0
+  3 IGNORE   UPDATE                  0 {6 7 3 9}  1 0
+  4 FAIL     UPDATE                  1 {6 7 3 4}  1 0
+  5 ABORT    UPDATE                  1 {1 2 3 4}  1 1
+  6 ROLLBACK UPDATE                  1 {1 2 3 4}  0 0
+  7 REPLACE  {UPDATE OR IGNORE}      0 {6 7 3 9}  1 0
+  8 IGNORE   {UPDATE OR REPLACE}     0 {7 6 9}    1 0
+  9 FAIL     {UPDATE OR IGNORE}      0 {6 7 3 9}  1 0
+ 10 ABORT    {UPDATE OR REPLACE}     0 {7 6 9}    1 0
+ 11 ROLLBACK {UPDATE OR IGNORE}      0 {6 7 3 9}  1 0
+ 12 {}       {UPDATE OR IGNORE}      0 {6 7 3 9}  1 0
+ 13 {}       {UPDATE OR REPLACE}     0 {7 6 9}    1 0
+ 14 {}       {UPDATE OR FAIL}        1 {6 7 3 4}  1 0
+ 15 {}       {UPDATE OR ABORT}       1 {1 2 3 4}  1 1
+ 16 {}       {UPDATE OR ROLLBACK}    1 {1 2 3 4}  0 0
 } {
   if {$t0} {set t1 {column a is not unique}}
   do_test conflict-6.$i {
+    db close
+    sqlite3 db test.db 
     if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
-    if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"}
+    set ::sqlite_opentemp_count 0
     set r0 [catch {execsql [subst {
       DROP TABLE t1;
       CREATE TABLE t1(a,b,c, UNIQUE(a) $conf1);
       INSERT INTO t1 SELECT * FROM t2;
       UPDATE t3 SET x=0;
-      BEGIN $conf2;
+      BEGIN;
       $cmd t3 SET x=1;
       $cmd t1 SET b=b*2;
       $cmd t1 SET a=c+5;
@@ -325,8 +316,8 @@ foreach {i conf1 conf2 cmd t0 t1 t2} {
     catch {execsql {COMMIT}}
     if {!$r0} {set r1 [execsql {SELECT a FROM t1 ORDER BY b}]}
     set r2 [execsql {SELECT x FROM t3}]
-    list $r0 $r1 $r2
-  } [list $t0 $t1 $t2]
+    list $r0 $r1 $r2 $::sqlite_opentemp_count
+  } [list $t0 $t1 $t2 $t3]
 }
 
 # Test to make sure a lot of IGNOREs don't cause a stack overflow