3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # Test the operation of table-options in the WITH clause of the
13 # CREATE TABLE statement.
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
20 do_test tableopt-1.1 {
22 CREATE TABLE t1(a,b) WITHOUT rowid;
24 } {1 {PRIMARY KEY missing on table t1}}
25 do_test tableopt-1.1b {
27 CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT,b) WITHOUT rowid;
29 } {1 {AUTOINCREMENT not allowed on WITHOUT ROWID tables}}
30 do_test tableopt-1.2 {
32 CREATE TABLE t1(a,b) WITHOUT unknown2;
34 } {1 {unknown table option: unknown2}}
36 do_execsql_test tableopt-2.1 {
37 CREATE TABLE t1(a, b, c, PRIMARY KEY(a,b)) WITHOUT rowid;
38 INSERT INTO t1 VALUES(1,2,3),(2,3,4);
39 SELECT c FROM t1 WHERE a IN (1,2) ORDER BY b;
41 do_test tableopt-2.1.1 {
43 SELECT rowid, * FROM t1;
45 } {1 {no such column: rowid}}
46 do_test tableopt-2.1.2 {
48 SELECT _rowid_, * FROM t1;
50 } {1 {no such column: _rowid_}}
51 do_test tableopt-2.1.3 {
53 SELECT oid, * FROM t1;
55 } {1 {no such column: oid}}
56 do_execsql_test tableopt-2.2 {
58 SELECT c FROM t1 WHERE a IN (1,2) ORDER BY b;
60 do_test tableopt-2.3 {
62 db2 eval {SELECT c FROM t1 WHERE a IN (1,2) ORDER BY b;}
66 # Make sure the "without" keyword is still usable as a table or
69 do_execsql_test tableopt-3.1 {
70 CREATE TABLE without(x INTEGER PRIMARY KEY, without TEXT);
71 INSERT INTO without VALUES(1, 'xyzzy'), (2, 'fizzle');
72 SELECT * FROM without WHERE without='xyzzy';