summaryrefslogtreecommitdiff
path: root/test/tableopts.test
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:43 -0400
committerHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:43 -0400
commit9f67c0520ea0d5f11a190197cdf746c512db4ce4 (patch)
treec88a33f01f20a3d13a09594f114fffacebd0d1a4 /test/tableopts.test
parentee20336e9c78d2e3782c8d096b9ab4f6ca8ce95f (diff)
parent569c6676a6ddb0ff73821d7693b5e18ddef809b9 (diff)
Merge tag 'upstream/3.2.0'
Upstream version 3.2.0 # gpg: Signature made Thu 16 Oct 2014 10:51:39 PM EDT using RSA key ID 374BBE81 # gpg: Good signature from "Hans-Christoph Steiner <hans@guardianproject.info>" # gpg: aka "Hans-Christoph Steiner <hans@eds.org>" # gpg: aka "Hans-Christoph Steiner <hans@at.or.at>" # gpg: aka "[jpeg image of size 5408]"
Diffstat (limited to 'test/tableopts.test')
-rw-r--r--test/tableopts.test76
1 files changed, 76 insertions, 0 deletions
diff --git a/test/tableopts.test b/test/tableopts.test
new file mode 100644
index 0000000..0b2457e
--- /dev/null
+++ b/test/tableopts.test
@@ -0,0 +1,76 @@
+# 2013-10-19
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+# Test the operation of table-options in the WITH clause of the
+# CREATE TABLE statement.
+#
+
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+do_test tableopt-1.1 {
+ catchsql {
+ CREATE TABLE t1(a,b) WITHOUT rowid;
+ }
+} {1 {PRIMARY KEY missing on table t1}}
+do_test tableopt-1.1b {
+ catchsql {
+ CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT,b) WITHOUT rowid;
+ }
+} {1 {AUTOINCREMENT not allowed on WITHOUT ROWID tables}}
+do_test tableopt-1.2 {
+ catchsql {
+ CREATE TABLE t1(a,b) WITHOUT unknown2;
+ }
+} {1 {unknown table option: unknown2}}
+
+do_execsql_test tableopt-2.1 {
+ CREATE TABLE t1(a, b, c, PRIMARY KEY(a,b)) WITHOUT rowid;
+ INSERT INTO t1 VALUES(1,2,3),(2,3,4);
+ SELECT c FROM t1 WHERE a IN (1,2) ORDER BY b;
+} {3 4}
+do_test tableopt-2.1.1 {
+ catchsql {
+ SELECT rowid, * FROM t1;
+ }
+} {1 {no such column: rowid}}
+do_test tableopt-2.1.2 {
+ catchsql {
+ SELECT _rowid_, * FROM t1;
+ }
+} {1 {no such column: _rowid_}}
+do_test tableopt-2.1.3 {
+ catchsql {
+ SELECT oid, * FROM t1;
+ }
+} {1 {no such column: oid}}
+do_execsql_test tableopt-2.2 {
+ VACUUM;
+ SELECT c FROM t1 WHERE a IN (1,2) ORDER BY b;
+} {3 4}
+do_test tableopt-2.3 {
+ sqlite3 db2 test.db
+ db2 eval {SELECT c FROM t1 WHERE a IN (1,2) ORDER BY b;}
+} {3 4}
+db2 close
+
+# Make sure the "without" keyword is still usable as a table or
+# column name.
+#
+do_execsql_test tableopt-3.1 {
+ CREATE TABLE without(x INTEGER PRIMARY KEY, without TEXT);
+ INSERT INTO without VALUES(1, 'xyzzy'), (2, 'fizzle');
+ SELECT * FROM without WHERE without='xyzzy';
+} {1 xyzzy}
+
+
+finish_test