1 # 2009 September 2 2 # 3 # The author disclaims copyright to this source code. In place of 4 # a legal notice, here is a blessing: 5 # 6 # May you do good and not evil. 7 # May you find forgiveness for yourself and forgive others. 8 # May you share freely, never taking more than you give. 9 # 10 #*********************************************************************** 11 # This file implements regression tests for SQLite library. 12 # 13 # This file implements tests to verify that ticket [d82e3f3721] has been 14 # fixed. 15 # 16 17 set testdir [file dirname $argv0] 18 source $testdir/tester.tcl 19 20 do_test tkt-d82e3-1.1 { 21 db eval { 22 CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b); 23 INSERT INTO t1 VALUES(null,'abc'); 24 INSERT INTO t1 VALUES(null,'def'); 25 DELETE FROM t1; 26 INSERT INTO t1 VALUES(null,'ghi'); 27 SELECT * FROM t1; 28 } 29 } {3 ghi} 30 do_test tkt-d82e3-1.2 { 31 db eval { 32 CREATE TEMP TABLE t2(a INTEGER PRIMARY KEY AUTOINCREMENT, b); 33 INSERT INTO t2 VALUES(null,'jkl'); 34 INSERT INTO t2 VALUES(null,'mno'); 35 DELETE FROM t2; 36 INSERT INTO t2 VALUES(null,'pqr'); 37 SELECT * FROM t2; 38 } 39 } {3 pqr} 40 do_test tkt-d82e3-1.3 { 41 db eval { 42 SELECT 'main', * FROM main.sqlite_sequence 43 UNION ALL 44 SELECT 'temp', * FROM temp.sqlite_sequence 45 ORDER BY 2 46 } 47 } {main t1 3 temp t2 3} 48 do_test tkt-d82e3-1.4 { 49 db eval { 50 VACUUM; 51 SELECT 'main', * FROM main.sqlite_sequence 52 UNION ALL 53 SELECT 'temp', * FROM temp.sqlite_sequence 54 ORDER BY 2 55 } 56 } {main t1 3 temp t2 3} 57 58 sqlite3 db2 test.db 59 do_test tkt-d82e3-2.1 { 60 db eval { 61 CREATE TEMP TABLE t3(x); 62 INSERT INTO t3 VALUES(1); 63 } 64 db2 eval { 65 CREATE TABLE t3(y,z); 66 INSERT INTO t3 VALUES(8,9); 67 } 68 db eval { 69 SELECT * FROM temp.t3 JOIN main.t3; 70 } 71 } {1 8 9} 72 do_test tkt-d82e3-2.2 { 73 db eval { 74 VACUUM; 75 SELECT * FROM temp.t3 JOIN main.t3; 76 } 77 } {1 8 9} 78 db2 close 79 80 finish_test 81