summaryrefslogtreecommitdiff
path: root/test/alter.test
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:35 -0400
committerHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:35 -0400
commit569c6676a6ddb0ff73821d7693b5e18ddef809b9 (patch)
tree833538da7bba39105daff45e265aef386a200acd /test/alter.test
parent08119c361d1181b3e8f1abb429236e488a664753 (diff)
Imported Upstream version 3.2.0upstream
Diffstat (limited to 'test/alter.test')
-rw-r--r--test/alter.test55
1 files changed, 54 insertions, 1 deletions
diff --git a/test/alter.test b/test/alter.test
index aca71c4..ddf1698 100644
--- a/test/alter.test
+++ b/test/alter.test
@@ -847,7 +847,8 @@ do_test alter-14.2 {
set system_table_list {1 sqlite_master}
catchsql ANALYZE
ifcapable analyze { lappend system_table_list 2 sqlite_stat1 }
-ifcapable stat3 { lappend system_table_list 4 sqlite_stat3 }
+ifcapable stat3 { lappend system_table_list 3 sqlite_stat3 }
+ifcapable stat4 { lappend system_table_list 4 sqlite_stat4 }
foreach {tn tbl} $system_table_list {
do_test alter-15.$tn.1 {
@@ -859,5 +860,57 @@ foreach {tn tbl} $system_table_list {
} [list 1 "table $tbl may not be altered"]
}
+#------------------------------------------------------------------------
+# Verify that ALTER TABLE works on tables with the WITHOUT rowid option.
+#
+do_execsql_test alter-16.1 {
+ CREATE TABLE t16a(a TEXT, b REAL, c INT, PRIMARY KEY(a,b)) WITHOUT rowid;
+ INSERT INTO t16a VALUES('abc',1.25,99);
+ ALTER TABLE t16a ADD COLUMN d TEXT DEFAULT 'xyzzy';
+ INSERT INTO t16a VALUES('cba',5.5,98,'fizzle');
+ SELECT * FROM t16a ORDER BY a;
+} {abc 1.25 99 xyzzy cba 5.5 98 fizzle}
+do_execsql_test alter-16.2 {
+ ALTER TABLE t16a RENAME TO t16a_rn;
+ SELECT * FROM t16a_rn ORDER BY a;
+} {abc 1.25 99 xyzzy cba 5.5 98 fizzle}
+
+#-------------------------------------------------------------------------
+# Verify that NULL values into the internal-use-only sqlite_rename_*()
+# functions do not cause problems.
+#
+do_execsql_test alter-17.1 {
+ SELECT sqlite_rename_table('CREATE TABLE xyz(a,b,c)','abc');
+} {{CREATE TABLE "abc"(a,b,c)}}
+do_execsql_test alter-17.2 {
+ SELECT sqlite_rename_table('CREATE TABLE xyz(a,b,c)',NULL);
+} {{CREATE TABLE "(NULL)"(a,b,c)}}
+do_execsql_test alter-17.3 {
+ SELECT sqlite_rename_table(NULL,'abc');
+} {{}}
+do_execsql_test alter-17.4 {
+ SELECT sqlite_rename_trigger('CREATE TRIGGER r1 ON xyz WHEN','abc');
+} {{CREATE TRIGGER r1 ON "abc" WHEN}}
+do_execsql_test alter-17.5 {
+ SELECT sqlite_rename_trigger('CREATE TRIGGER r1 ON xyz WHEN',NULL);
+} {{CREATE TRIGGER r1 ON "(NULL)" WHEN}}
+do_execsql_test alter-17.6 {
+ SELECT sqlite_rename_trigger(NULL,'abc');
+} {{}}
+do_execsql_test alter-17.7 {
+ SELECT sqlite_rename_parent('CREATE TABLE t1(a REFERENCES "xyzzy")',
+ 'xyzzy','lmnop');
+} {{CREATE TABLE t1(a REFERENCES "lmnop")}}
+do_execsql_test alter-17.8 {
+ SELECT sqlite_rename_parent('CREATE TABLE t1(a REFERENCES "xyzzy")',
+ 'xyzzy',NULL);
+} {{CREATE TABLE t1(a REFERENCES "(NULL)")}}
+do_execsql_test alter-17.9 {
+ SELECT sqlite_rename_parent('CREATE TABLE t1(a REFERENCES "xyzzy")',
+ NULL, 'lmnop');
+} {{}}
+do_execsql_test alter-17.10 {
+ SELECT sqlite_rename_parent(NULL,'abc','xyz');
+} {{}}
finish_test