github.com/jdgcs/sqlite3@v1.12.1-0.20210908114423-bc5f96e4dd51/testdata/tcl/tkt-d82e3f3721.test (about) 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 ifcapable !compound { 21 finish_test 22 return 23 } 24 25 do_test tkt-d82e3-1.1 { 26 db eval { 27 CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b); 28 INSERT INTO t1 VALUES(null,'abc'); 29 INSERT INTO t1 VALUES(null,'def'); 30 DELETE FROM t1; 31 INSERT INTO t1 VALUES(null,'ghi'); 32 SELECT * FROM t1; 33 } 34 } {3 ghi} 35 do_test tkt-d82e3-1.2 { 36 db eval { 37 CREATE TEMP TABLE t2(a INTEGER PRIMARY KEY AUTOINCREMENT, b); 38 INSERT INTO t2 VALUES(null,'jkl'); 39 INSERT INTO t2 VALUES(null,'mno'); 40 DELETE FROM t2; 41 INSERT INTO t2 VALUES(null,'pqr'); 42 SELECT * FROM t2; 43 } 44 } {3 pqr} 45 do_test tkt-d82e3-1.3 { 46 db eval { 47 SELECT 'main', * FROM main.sqlite_sequence 48 UNION ALL 49 SELECT 'temp', * FROM temp.sqlite_sequence 50 ORDER BY 2 51 } 52 } {main t1 3 temp t2 3} 53 do_test tkt-d82e3-1.4 { 54 db eval { 55 VACUUM; 56 SELECT 'main', * FROM main.sqlite_sequence 57 UNION ALL 58 SELECT 'temp', * FROM temp.sqlite_sequence 59 ORDER BY 2 60 } 61 } {main t1 3 temp t2 3} 62 63 sqlite3 db2 test.db 64 do_test tkt-d82e3-2.1 { 65 db eval { 66 CREATE TEMP TABLE t3(x); 67 INSERT INTO t3 VALUES(1); 68 } 69 db2 eval { 70 CREATE TABLE t3(y,z); 71 INSERT INTO t3 VALUES(8,9); 72 } 73 db eval { 74 SELECT * FROM temp.t3 JOIN main.t3; 75 } 76 } {1 8 9} 77 do_test tkt-d82e3-2.2 { 78 db eval { 79 VACUUM; 80 SELECT * FROM temp.t3 JOIN main.t3; 81 } 82 } {1 8 9} 83 db2 close 84 85 finish_test