sl@0: # 2001 September 15. sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # This file implements regression tests for SQLite library. sl@0: # sl@0: # This file implements tests for miscellanous features that were sl@0: # left out of other test files. sl@0: # sl@0: # $Id: misc1.test,v 1.42 2007/11/05 14:58:23 drh Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: # Mimic the SQLite 2 collation type NUMERIC. sl@0: db collate numeric numeric_collate sl@0: proc numeric_collate {lhs rhs} { sl@0: if {$lhs == $rhs} {return 0} sl@0: return [expr ($lhs>$rhs)?1:-1] sl@0: } sl@0: sl@0: # Mimic the SQLite 2 collation type TEXT. sl@0: db collate text text_collate sl@0: proc numeric_collate {lhs rhs} { sl@0: return [string compare $lhs $rhs] sl@0: } sl@0: sl@0: # Test the creation and use of tables that have a large number sl@0: # of columns. sl@0: # sl@0: do_test misc1-1.1 { sl@0: set cmd "CREATE TABLE manycol(x0 text" sl@0: for {set i 1} {$i<=99} {incr i} { sl@0: append cmd ",x$i text" sl@0: } sl@0: append cmd ")"; sl@0: execsql $cmd sl@0: set cmd "INSERT INTO manycol VALUES(0" sl@0: for {set i 1} {$i<=99} {incr i} { sl@0: append cmd ",$i" sl@0: } sl@0: append cmd ")"; sl@0: execsql $cmd sl@0: execsql "SELECT x99 FROM manycol" sl@0: } 99 sl@0: do_test misc1-1.2 { sl@0: execsql {SELECT x0, x10, x25, x50, x75 FROM manycol} sl@0: } {0 10 25 50 75} sl@0: do_test misc1-1.3.1 { sl@0: for {set j 100} {$j<=1000} {incr j 100} { sl@0: set cmd "INSERT INTO manycol VALUES($j" sl@0: for {set i 1} {$i<=99} {incr i} { sl@0: append cmd ",[expr {$i+$j}]" sl@0: } sl@0: append cmd ")" sl@0: execsql $cmd sl@0: } sl@0: execsql {SELECT x50 FROM manycol ORDER BY x80+0} sl@0: } {50 150 250 350 450 550 650 750 850 950 1050} sl@0: do_test misc1-1.3.2 { sl@0: execsql {SELECT x50 FROM manycol ORDER BY x80} sl@0: } {1050 150 250 350 450 550 650 750 50 850 950} sl@0: do_test misc1-1.4 { sl@0: execsql {SELECT x75 FROM manycol WHERE x50=350} sl@0: } 375 sl@0: do_test misc1-1.5 { sl@0: execsql {SELECT x50 FROM manycol WHERE x99=599} sl@0: } 550 sl@0: do_test misc1-1.6 { sl@0: execsql {CREATE INDEX manycol_idx1 ON manycol(x99)} sl@0: execsql {SELECT x50 FROM manycol WHERE x99=899} sl@0: } 850 sl@0: do_test misc1-1.7 { sl@0: execsql {SELECT count(*) FROM manycol} sl@0: } 11 sl@0: do_test misc1-1.8 { sl@0: execsql {DELETE FROM manycol WHERE x98=1234} sl@0: execsql {SELECT count(*) FROM manycol} sl@0: } 11 sl@0: do_test misc1-1.9 { sl@0: execsql {DELETE FROM manycol WHERE x98=998} sl@0: execsql {SELECT count(*) FROM manycol} sl@0: } 10 sl@0: do_test misc1-1.10 { sl@0: execsql {DELETE FROM manycol WHERE x99=500} sl@0: execsql {SELECT count(*) FROM manycol} sl@0: } 10 sl@0: do_test misc1-1.11 { sl@0: execsql {DELETE FROM manycol WHERE x99=599} sl@0: execsql {SELECT count(*) FROM manycol} sl@0: } 9 sl@0: sl@0: # Check GROUP BY expressions that name two or more columns. sl@0: # sl@0: do_test misc1-2.1 { sl@0: execsql { sl@0: BEGIN TRANSACTION; sl@0: CREATE TABLE agger(one text, two text, three text, four text); sl@0: INSERT INTO agger VALUES(1, 'one', 'hello', 'yes'); sl@0: INSERT INTO agger VALUES(2, 'two', 'howdy', 'no'); sl@0: INSERT INTO agger VALUES(3, 'thr', 'howareya', 'yes'); sl@0: INSERT INTO agger VALUES(4, 'two', 'lothere', 'yes'); sl@0: INSERT INTO agger VALUES(5, 'one', 'atcha', 'yes'); sl@0: INSERT INTO agger VALUES(6, 'two', 'hello', 'no'); sl@0: COMMIT sl@0: } sl@0: execsql {SELECT count(*) FROM agger} sl@0: } 6 sl@0: do_test misc1-2.2 { sl@0: execsql {SELECT sum(one), two, four FROM agger sl@0: GROUP BY two, four ORDER BY sum(one) desc} sl@0: } {8 two no 6 one yes 4 two yes 3 thr yes} sl@0: do_test misc1-2.3 { sl@0: execsql {SELECT sum((one)), (two), (four) FROM agger sl@0: GROUP BY (two), (four) ORDER BY sum(one) desc} sl@0: } {8 two no 6 one yes 4 two yes 3 thr yes} sl@0: sl@0: # Here's a test for a bug found by Joel Lucsy. The code below sl@0: # was causing an assertion failure. sl@0: # sl@0: do_test misc1-3.1 { sl@0: set r [execsql { sl@0: CREATE TABLE t1(a); sl@0: INSERT INTO t1 VALUES('hi'); sl@0: PRAGMA full_column_names=on; sl@0: SELECT rowid, * FROM t1; sl@0: }] sl@0: lindex $r 1 sl@0: } {hi} sl@0: sl@0: # Here's a test for yet another bug found by Joel Lucsy. The code sl@0: # below was causing an assertion failure. sl@0: # sl@0: do_test misc1-4.1 { sl@0: execsql { sl@0: BEGIN; sl@0: CREATE TABLE t2(a); sl@0: INSERT INTO t2 VALUES('This is a long string to use up a lot of disk -'); sl@0: UPDATE t2 SET a=a||a||a||a; sl@0: INSERT INTO t2 SELECT '1 - ' || a FROM t2; sl@0: INSERT INTO t2 SELECT '2 - ' || a FROM t2; sl@0: INSERT INTO t2 SELECT '3 - ' || a FROM t2; sl@0: INSERT INTO t2 SELECT '4 - ' || a FROM t2; sl@0: INSERT INTO t2 SELECT '5 - ' || a FROM t2; sl@0: INSERT INTO t2 SELECT '6 - ' || a FROM t2; sl@0: COMMIT; sl@0: SELECT count(*) FROM t2; sl@0: } sl@0: } {64} sl@0: sl@0: # Make sure we actually see a semicolon or end-of-file in the SQL input sl@0: # before executing a command. Thus if "WHERE" is misspelled on an UPDATE, sl@0: # the user won't accidently update every record. sl@0: # sl@0: do_test misc1-5.1 { sl@0: catchsql { sl@0: CREATE TABLE t3(a,b); sl@0: INSERT INTO t3 VALUES(1,2); sl@0: INSERT INTO t3 VALUES(3,4); sl@0: UPDATE t3 SET a=0 WHEREwww b=2; sl@0: } sl@0: } {1 {near "WHEREwww": syntax error}} sl@0: do_test misc1-5.2 { sl@0: execsql { sl@0: SELECT * FROM t3 ORDER BY a; sl@0: } sl@0: } {1 2 3 4} sl@0: sl@0: # Certain keywords (especially non-standard keywords like "REPLACE") can sl@0: # also be used as identifiers. The way this works in the parser is that sl@0: # the parser first detects a syntax error, the error handling routine sl@0: # sees that the special keyword caused the error, then replaces the keyword sl@0: # with "ID" and tries again. sl@0: # sl@0: # Check the operation of this logic. sl@0: # sl@0: do_test misc1-6.1 { sl@0: catchsql { sl@0: CREATE TABLE t4( sl@0: abort, asc, begin, cluster, conflict, copy, delimiters, desc, end, sl@0: explain, fail, ignore, key, offset, pragma, replace, temp, sl@0: vacuum, view sl@0: ); sl@0: } sl@0: } {0 {}} sl@0: do_test misc1-6.2 { sl@0: catchsql { sl@0: INSERT INTO t4 sl@0: VALUES(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19); sl@0: } sl@0: } {0 {}} sl@0: do_test misc1-6.3 { sl@0: execsql { sl@0: SELECT * FROM t4 sl@0: } sl@0: } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19} sl@0: do_test misc1-6.4 { sl@0: execsql { sl@0: SELECT abort+asc,max(key,pragma,temp) FROM t4 sl@0: } sl@0: } {3 17} sl@0: sl@0: # Test for multi-column primary keys, and for multiple primary keys. sl@0: # sl@0: do_test misc1-7.1 { sl@0: catchsql { sl@0: CREATE TABLE error1( sl@0: a TYPE PRIMARY KEY, sl@0: b TYPE PRIMARY KEY sl@0: ); sl@0: } sl@0: } {1 {table "error1" has more than one primary key}} sl@0: do_test misc1-7.2 { sl@0: catchsql { sl@0: CREATE TABLE error1( sl@0: a INTEGER PRIMARY KEY, sl@0: b TYPE PRIMARY KEY sl@0: ); sl@0: } sl@0: } {1 {table "error1" has more than one primary key}} sl@0: do_test misc1-7.3 { sl@0: execsql { sl@0: CREATE TABLE t5(a,b,c,PRIMARY KEY(a,b)); sl@0: INSERT INTO t5 VALUES(1,2,3); sl@0: SELECT * FROM t5 ORDER BY a; sl@0: } sl@0: } {1 2 3} sl@0: do_test misc1-7.4 { sl@0: catchsql { sl@0: INSERT INTO t5 VALUES(1,2,4); sl@0: } sl@0: } {1 {columns a, b are not unique}} sl@0: do_test misc1-7.5 { sl@0: catchsql { sl@0: INSERT INTO t5 VALUES(0,2,4); sl@0: } sl@0: } {0 {}} sl@0: do_test misc1-7.6 { sl@0: execsql { sl@0: SELECT * FROM t5 ORDER BY a; sl@0: } sl@0: } {0 2 4 1 2 3} sl@0: sl@0: do_test misc1-8.1 { sl@0: catchsql { sl@0: SELECT *; sl@0: } sl@0: } {1 {no tables specified}} sl@0: do_test misc1-8.2 { sl@0: catchsql { sl@0: SELECT t1.*; sl@0: } sl@0: } {1 {no such table: t1}} sl@0: sl@0: execsql { sl@0: DROP TABLE t1; sl@0: DROP TABLE t2; sl@0: DROP TABLE t3; sl@0: DROP TABLE t4; sl@0: } sl@0: sl@0: # 64-bit integers are represented exactly. sl@0: # sl@0: do_test misc1-9.1 { sl@0: catchsql { sl@0: CREATE TABLE t1(a unique not null, b unique not null); sl@0: INSERT INTO t1 VALUES('a',1234567890123456789); sl@0: INSERT INTO t1 VALUES('b',1234567891123456789); sl@0: INSERT INTO t1 VALUES('c',1234567892123456789); sl@0: SELECT * FROM t1; sl@0: } sl@0: } {0 {a 1234567890123456789 b 1234567891123456789 c 1234567892123456789}} sl@0: sl@0: # A WHERE clause is not allowed to contain more than 99 terms. Check to sl@0: # make sure this limit is enforced. sl@0: # sl@0: # 2005-07-16: There is no longer a limit on the number of terms in a sl@0: # WHERE clause. But keep these tests just so that we have some tests sl@0: # that use a large number of terms in the WHERE clause. sl@0: # sl@0: do_test misc1-10.0 { sl@0: execsql {SELECT count(*) FROM manycol} sl@0: } {9} sl@0: do_test misc1-10.1 { sl@0: set ::where {WHERE x0>=0} sl@0: for {set i 1} {$i<=99} {incr i} { sl@0: append ::where " AND x$i<>0" sl@0: } sl@0: catchsql "SELECT count(*) FROM manycol $::where" sl@0: } {0 9} sl@0: do_test misc1-10.2 { sl@0: catchsql "SELECT count(*) FROM manycol $::where AND rowid>0" sl@0: } {0 9} sl@0: do_test misc1-10.3 { sl@0: regsub "x0>=0" $::where "x0=0" ::where sl@0: catchsql "DELETE FROM manycol $::where" sl@0: } {0 {}} sl@0: do_test misc1-10.4 { sl@0: execsql {SELECT count(*) FROM manycol} sl@0: } {8} sl@0: do_test misc1-10.5 { sl@0: catchsql "DELETE FROM manycol $::where AND rowid>0" sl@0: } {0 {}} sl@0: do_test misc1-10.6 { sl@0: execsql {SELECT x1 FROM manycol WHERE x0=100} sl@0: } {101} sl@0: do_test misc1-10.7 { sl@0: regsub "x0=0" $::where "x0=100" ::where sl@0: catchsql "UPDATE manycol SET x1=x1+1 $::where" sl@0: } {0 {}} sl@0: do_test misc1-10.8 { sl@0: execsql {SELECT x1 FROM manycol WHERE x0=100} sl@0: } {102} sl@0: do_test misc1-10.9 { sl@0: catchsql "UPDATE manycol SET x1=x1+1 $::where AND rowid>0" sl@0: } {0 {}} sl@0: do_test misc1-10.10 { sl@0: execsql {SELECT x1 FROM manycol WHERE x0=100} sl@0: } {103} sl@0: sl@0: # Make sure the initialization works even if a database is opened while sl@0: # another process has the database locked. sl@0: # sl@0: # Update for v3: The BEGIN doesn't lock the database so the schema is read sl@0: # and the SELECT returns successfully. sl@0: do_test misc1-11.1 { sl@0: execsql {BEGIN} sl@0: execsql {UPDATE t1 SET a=0 WHERE 0} sl@0: sqlite3 db2 test.db sl@0: set rc [catch {db2 eval {SELECT count(*) FROM t1}} msg] sl@0: lappend rc $msg sl@0: # v2 result: {1 {database is locked}} sl@0: } {0 3} sl@0: do_test misc1-11.2 { sl@0: execsql {COMMIT} sl@0: set rc [catch {db2 eval {SELECT count(*) FROM t1}} msg] sl@0: db2 close sl@0: lappend rc $msg sl@0: } {0 3} sl@0: sl@0: # Make sure string comparisons really do compare strings in format4+. sl@0: # Similar tests in the format3.test file show that for format3 and earlier sl@0: # all comparisions where numeric if either operand looked like a number. sl@0: # sl@0: do_test misc1-12.1 { sl@0: execsql {SELECT '0'=='0.0'} sl@0: } {0} sl@0: do_test misc1-12.2 { sl@0: execsql {SELECT '0'==0.0} sl@0: } {0} sl@0: do_test misc1-12.3 { sl@0: execsql {SELECT '12345678901234567890'=='12345678901234567891'} sl@0: } {0} sl@0: do_test misc1-12.4 { sl@0: execsql { sl@0: CREATE TABLE t6(a INT UNIQUE, b TEXT UNIQUE); sl@0: INSERT INTO t6 VALUES('0','0.0'); sl@0: SELECT * FROM t6; sl@0: } sl@0: } {0 0.0} sl@0: ifcapable conflict { sl@0: do_test misc1-12.5 { sl@0: execsql { sl@0: INSERT OR IGNORE INTO t6 VALUES(0.0,'x'); sl@0: SELECT * FROM t6; sl@0: } sl@0: } {0 0.0} sl@0: do_test misc1-12.6 { sl@0: execsql { sl@0: INSERT OR IGNORE INTO t6 VALUES('y',0); sl@0: SELECT * FROM t6; sl@0: } sl@0: } {0 0.0 y 0} sl@0: } sl@0: do_test misc1-12.7 { sl@0: execsql { sl@0: CREATE TABLE t7(x INTEGER, y TEXT, z); sl@0: INSERT INTO t7 VALUES(0,0,1); sl@0: INSERT INTO t7 VALUES(0.0,0,2); sl@0: INSERT INTO t7 VALUES(0,0.0,3); sl@0: INSERT INTO t7 VALUES(0.0,0.0,4); sl@0: SELECT DISTINCT x, y FROM t7 ORDER BY z; sl@0: } sl@0: } {0 0 0 0.0} sl@0: do_test misc1-12.8 { sl@0: execsql { sl@0: SELECT min(z), max(z), count(z) FROM t7 GROUP BY x ORDER BY 1; sl@0: } sl@0: } {1 4 4} sl@0: do_test misc1-12.9 { sl@0: execsql { sl@0: SELECT min(z), max(z), count(z) FROM t7 GROUP BY y ORDER BY 1; sl@0: } sl@0: } {1 2 2 3 4 2} sl@0: sl@0: # This used to be an error. But we changed the code so that arbitrary sl@0: # identifiers can be used as a collating sequence. Collation is by text sl@0: # if the identifier contains "text", "blob", or "clob" and is numeric sl@0: # otherwise. sl@0: # sl@0: # Update: In v3, it is an error again. sl@0: # sl@0: #do_test misc1-12.10 { sl@0: # catchsql { sl@0: # SELECT * FROM t6 ORDER BY a COLLATE unknown; sl@0: # } sl@0: #} {0 {0 0 y 0}} sl@0: do_test misc1-12.11 { sl@0: execsql { sl@0: CREATE TABLE t8(x TEXT COLLATE numeric, y INTEGER COLLATE text, z); sl@0: INSERT INTO t8 VALUES(0,0,1); sl@0: INSERT INTO t8 VALUES(0.0,0,2); sl@0: INSERT INTO t8 VALUES(0,0.0,3); sl@0: INSERT INTO t8 VALUES(0.0,0.0,4); sl@0: SELECT DISTINCT x, y FROM t8 ORDER BY z; sl@0: } sl@0: } {0 0 0.0 0} sl@0: do_test misc1-12.12 { sl@0: execsql { sl@0: SELECT min(z), max(z), count(z) FROM t8 GROUP BY x ORDER BY 1; sl@0: } sl@0: } {1 3 2 2 4 2} sl@0: do_test misc1-12.13 { sl@0: execsql { sl@0: SELECT min(z), max(z), count(z) FROM t8 GROUP BY y ORDER BY 1; sl@0: } sl@0: } {1 4 4} sl@0: sl@0: # There was a problem with realloc() in the OP_MemStore operation of sl@0: # the VDBE. A buffer was being reallocated but some pointers into sl@0: # the old copy of the buffer were not being moved over to the new copy. sl@0: # The following code tests for the problem. sl@0: # sl@0: ifcapable subquery { sl@0: do_test misc1-13.1 { sl@0: execsql { sl@0: CREATE TABLE t9(x,y); sl@0: INSERT INTO t9 VALUES('one',1); sl@0: INSERT INTO t9 VALUES('two',2); sl@0: INSERT INTO t9 VALUES('three',3); sl@0: INSERT INTO t9 VALUES('four',4); sl@0: INSERT INTO t9 VALUES('five',5); sl@0: INSERT INTO t9 VALUES('six',6); sl@0: INSERT INTO t9 VALUES('seven',7); sl@0: INSERT INTO t9 VALUES('eight',8); sl@0: INSERT INTO t9 VALUES('nine',9); sl@0: INSERT INTO t9 VALUES('ten',10); sl@0: INSERT INTO t9 VALUES('eleven',11); sl@0: SELECT y FROM t9 sl@0: WHERE x=(SELECT x FROM t9 WHERE y=1) sl@0: OR x=(SELECT x FROM t9 WHERE y=2) sl@0: OR x=(SELECT x FROM t9 WHERE y=3) sl@0: OR x=(SELECT x FROM t9 WHERE y=4) sl@0: OR x=(SELECT x FROM t9 WHERE y=5) sl@0: OR x=(SELECT x FROM t9 WHERE y=6) sl@0: OR x=(SELECT x FROM t9 WHERE y=7) sl@0: OR x=(SELECT x FROM t9 WHERE y=8) sl@0: OR x=(SELECT x FROM t9 WHERE y=9) sl@0: OR x=(SELECT x FROM t9 WHERE y=10) sl@0: OR x=(SELECT x FROM t9 WHERE y=11) sl@0: OR x=(SELECT x FROM t9 WHERE y=12) sl@0: OR x=(SELECT x FROM t9 WHERE y=13) sl@0: OR x=(SELECT x FROM t9 WHERE y=14) sl@0: ; sl@0: } sl@0: } {1 2 3 4 5 6 7 8 9 10 11} sl@0: } sl@0: sl@0: # Make sure a database connection still works after changing the sl@0: # working directory. sl@0: # sl@0: do_test misc1-14.1 { sl@0: file mkdir tempdir sl@0: cd tempdir sl@0: execsql {BEGIN} sl@0: file exists ./test.db-journal sl@0: } {0} sl@0: do_test misc1-14.2 { sl@0: execsql {UPDATE t1 SET a=0 WHERE 0} sl@0: file exists ../test.db-journal sl@0: } {1} sl@0: do_test misc1-14.3 { sl@0: cd .. sl@0: file delete -force tempdir sl@0: execsql {COMMIT} sl@0: file exists ./test.db-journal sl@0: } {0} sl@0: sl@0: # A failed create table should not leave the table in the internal sl@0: # data structures. Ticket #238. sl@0: # sl@0: do_test misc1-15.1.1 { sl@0: catchsql { sl@0: CREATE TABLE t10 AS SELECT c1; sl@0: } sl@0: } {1 {no such column: c1}} sl@0: do_test misc1-15.1.2 { sl@0: catchsql { sl@0: CREATE TABLE t10 AS SELECT t9.c1; sl@0: } sl@0: } {1 {no such column: t9.c1}} sl@0: do_test misc1-15.1.3 { sl@0: catchsql { sl@0: CREATE TABLE t10 AS SELECT main.t9.c1; sl@0: } sl@0: } {1 {no such column: main.t9.c1}} sl@0: do_test misc1-15.2 { sl@0: catchsql { sl@0: CREATE TABLE t10 AS SELECT 1; sl@0: } sl@0: # The bug in ticket #238 causes the statement above to fail with sl@0: # the error "table t10 alread exists" sl@0: } {0 {}} sl@0: sl@0: # Test for memory leaks when a CREATE TABLE containing a primary key sl@0: # fails. Ticket #249. sl@0: # sl@0: do_test misc1-16.1 { sl@0: catchsql {SELECT name FROM sqlite_master LIMIT 1} sl@0: catchsql { sl@0: CREATE TABLE test(a integer, primary key(a)); sl@0: } sl@0: } {0 {}} sl@0: do_test misc1-16.2 { sl@0: catchsql { sl@0: CREATE TABLE test(a integer, primary key(a)); sl@0: } sl@0: } {1 {table test already exists}} sl@0: do_test misc1-16.3 { sl@0: catchsql { sl@0: CREATE TABLE test2(a text primary key, b text, primary key(a,b)); sl@0: } sl@0: } {1 {table "test2" has more than one primary key}} sl@0: do_test misc1-16.4 { sl@0: execsql { sl@0: INSERT INTO test VALUES(1); sl@0: SELECT rowid, a FROM test; sl@0: } sl@0: } {1 1} sl@0: do_test misc1-16.5 { sl@0: execsql { sl@0: INSERT INTO test VALUES(5); sl@0: SELECT rowid, a FROM test; sl@0: } sl@0: } {1 1 5 5} sl@0: do_test misc1-16.6 { sl@0: execsql { sl@0: INSERT INTO test VALUES(NULL); sl@0: SELECT rowid, a FROM test; sl@0: } sl@0: } {1 1 5 5 6 6} sl@0: sl@0: ifcapable trigger&&tempdb { sl@0: # Ticket #333: Temp triggers that modify persistent tables. sl@0: # sl@0: do_test misc1-17.1 { sl@0: execsql { sl@0: BEGIN; sl@0: CREATE TABLE RealTable(TestID INTEGER PRIMARY KEY, TestString TEXT); sl@0: CREATE TEMP TABLE TempTable(TestID INTEGER PRIMARY KEY, TestString TEXT); sl@0: CREATE TEMP TRIGGER trigTest_1 AFTER UPDATE ON TempTable BEGIN sl@0: INSERT INTO RealTable(TestString) sl@0: SELECT new.TestString FROM TempTable LIMIT 1; sl@0: END; sl@0: INSERT INTO TempTable(TestString) VALUES ('1'); sl@0: INSERT INTO TempTable(TestString) VALUES ('2'); sl@0: UPDATE TempTable SET TestString = TestString + 1 WHERE TestID=1 OR TestId=2; sl@0: COMMIT; sl@0: SELECT TestString FROM RealTable ORDER BY 1; sl@0: } sl@0: } {2 3} sl@0: } sl@0: sl@0: do_test misc1-18.1 { sl@0: set n [sqlite3_sleep 100] sl@0: expr {$n>=100} sl@0: } {1} sl@0: sl@0: finish_test