diff options
Diffstat (limited to 'third_party/sqlite/test/table.test')
-rw-r--r-- | third_party/sqlite/test/table.test | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/third_party/sqlite/test/table.test b/third_party/sqlite/test/table.test index 02fc909..173a62a 100644 --- a/third_party/sqlite/test/table.test +++ b/third_party/sqlite/test/table.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE TABLE statement. # -# $Id: table.test,v 1.48 2007/10/09 08:29:33 danielk1977 Exp $ +# $Id: table.test,v 1.53 2009/06/05 17:09:12 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -118,9 +118,9 @@ do_test table-2.1f { # Verify that we cannot make a table with the same name as an index # do_test table-2.2a { - execsql {CREATE TABLE test2(one text); CREATE INDEX test3 ON test2(one)} - set v [catch {execsql {CREATE TABLE test3(two text)}} msg] - lappend v $msg + execsql {CREATE TABLE test2(one text)} + execsql {CREATE INDEX test3 ON test2(one)} + catchsql {CREATE TABLE test3(two text)} } {1 {there is already an index named test3}} do_test table-2.2b { db close @@ -314,6 +314,14 @@ do_test table-7.3 { SELECT * FROM weird; } } {desc a asc b key 9 14_vac 0 fuzzy_dog_12 xyz begin hi end y'all} +do_test table-7.3 { + execsql { + CREATE TABLE savepoint(release); + INSERT INTO savepoint(release) VALUES(10); + UPDATE savepoint SET release = 5; + SELECT release FROM savepoint; + } +} {5} # Try out the CREATE TABLE AS syntax # @@ -328,13 +336,13 @@ do_test table-8.1.1 { SELECT sql FROM sqlite_master WHERE name='t2'; } } {{CREATE TABLE t2( - "desc" text, - "asc" text, - "key" int, - "14_vac" boolean, - fuzzy_dog_12 varchar(10), - "begin" blob, - "end" clob + "desc" TEXT, + "asc" TEXT, + "key" INT, + "14_vac" NUM, + fuzzy_dog_12 TEXT, + "begin", + "end" TEXT )}} do_test table-8.2 { execsql { @@ -391,6 +399,37 @@ do_test table-8.8 { } } {1 {no such table: no_such_table}} +do_test table-8.9 { + execsql { + CREATE TABLE t10("col.1" [char.3]); + CREATE TABLE t11 AS SELECT * FROM t10; + SELECT sql FROM sqlite_master WHERE name = 't11'; + } +} {{CREATE TABLE t11("col.1" TEXT)}} +do_test table-8.10 { + execsql { + CREATE TABLE t12( + a INTEGER, + b VARCHAR(10), + c VARCHAR(1,10), + d VARCHAR(+1,-10), + e VARCHAR (+1,-10), + f "VARCHAR (+1,-10, 5)", + g BIG INTEGER + ); + CREATE TABLE t13 AS SELECT * FROM t12; + SELECT sql FROM sqlite_master WHERE name = 't13'; + } +} {{CREATE TABLE t13( + a INT, + b TEXT, + c TEXT, + d TEXT, + e TEXT, + f TEXT, + g INT +)}} + # Make sure we cannot have duplicate column names within a table. # do_test table-9.1 { @@ -545,7 +584,7 @@ do_test table-12.2 { execsql { SELECT sql FROM sqlite_master WHERE tbl_name = 't8' } -} {{CREATE TABLE t8(b number(5,10),h,i integer,j BLOB)}} +} {{CREATE TABLE t8(b NUM,h,i INT,j)}} #-------------------------------------------------------------------- # Test cases table-13.* |