Index: src/vdbeaux.c ================================================================== --- src/vdbeaux.c +++ src/vdbeaux.c @@ -3374,11 +3374,11 @@ /* Release the locks */ sqlite3VdbeLeave(p); } /* We have successfully halted and closed the VM. Record this fact. */ - db->nVdbeActive--; + if( (--db->nVdbeActive)==0 && db->autoCommit ) db->txnTime = 0; if( !p->readOnly ) db->nVdbeWrite--; if( p->bIsReader ) db->nVdbeRead--; assert( db->nVdbeActive>=db->nVdbeRead ); assert( db->nVdbeRead>=db->nVdbeWrite ); assert( db->nVdbeWrite>=0 ); @@ -3392,11 +3392,10 @@ ** by connection db have now been released. Call sqlite3ConnectionUnlocked() ** to invoke any required unlock-notify callbacks. */ if( db->autoCommit ){ sqlite3ConnectionUnlocked(db); - db->txnTime = 0; } assert( db->nVdbeActive>0 || db->autoCommit==0 || db->nStatement==0 ); return (p->rc==SQLITE_BUSY ? SQLITE_BUSY : SQLITE_OK); } Index: test/date.test ================================================================== --- test/date.test +++ test/date.test @@ -554,10 +554,21 @@ time()=$x(ct2), datetime()=$x(cs2); } } {1 1 1 0 0} db eval {COMMIT} + +reset_db +do_test date-15.11 { + db eval {CREATE TABLE t1(x);} + db eval {VALUES(1),(2),(3)} { + db eval {INSERT INTO t1(x) VALUES(julianday('txn'))} + after 10 + } + db eval {SELECT count(x), count(DISTINCT x) FROM t1} +} {3 1} + # Tests of extreme values in date/time functions. Run with UBSan or the # equivalent to verify no signed interger overflow warnings. # datetest 16.1 {date(147483649)} NULL