1# 2013-10-19 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# 12# Test the operation of table-options in the WITH clause of the 13# CREATE TABLE statement. 14# 15 16 17set testdir [file dirname $argv0] 18source $testdir/tester.tcl 19 20do_test tableopt-1.1 { 21 catchsql { 22 CREATE TABLE t1(a,b) WITH (omit_rowid); 23 } 24} {1 {no PRIMARY KEY for table t1}} 25do_test tableopt-1.2 { 26 catchsql { 27 CREATE TABLE t1(a,b) WITH (unknown1, unknown2); 28 } 29} {1 {unknown table option: unknown2}} 30do_test tableopt-1.3 { 31 catchsql { 32 CREATE TABLE t1(a,b,c,PRIMARY KEY(a,b)) WITH (omit_rowid, unknown3); 33 } 34} {1 {unknown table option: unknown3}} 35do_test tableopt-1.4 { 36 catchsql { 37 CREATE TABLE t1(a,b,c,PRIMARY KEY(a,b)) WITH (unknown4, omit_rowid); 38 } 39} {1 {unknown table option: unknown4}} 40 41do_execsql_test tableopt-2.1 { 42 CREATE TABLE t1(a, b, c, PRIMARY KEY(a,b)) WITH (omit_rowid); 43 INSERT INTO t1 VALUES(1,2,3),(2,3,4); 44 SELECT c FROM t1 WHERE a IN (1,2) ORDER BY b; 45} {3 4} 46do_execsql_test tableopt-2.2 { 47 VACUUM; 48 SELECT c FROM t1 WHERE a IN (1,2) ORDER BY b; 49} {3 4} 50do_test tableopt-2.3 { 51 sqlite3 db2 test.db 52 db2 eval {SELECT c FROM t1 WHERE a IN (1,2) ORDER BY b;} 53} {3 4} 54db2 close 55 56finish_test 57