aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fts4rename.test2
-rw-r--r--test/hook.test58
2 files changed, 59 insertions, 1 deletions
diff --git a/test/fts4rename.test b/test/fts4rename.test
index c647d6928..5571ea7b1 100644
--- a/test/fts4rename.test
+++ b/test/fts4rename.test
@@ -29,7 +29,7 @@ do_execsql_test 1.0 {
do_catchsql_test 1.1 {
ALTER TABLE t1_content RENAME c0a TO docid;
-} {1 {duplicate column name: docid}}
+} {1 {error in table t1_content after rename: duplicate column name: docid}}
do_catchsql_test 1.2 {
UPDATE t1 SET Col0 = 1 ;
diff --git a/test/hook.test b/test/hook.test
index d137e9056..0b72b2dcf 100644
--- a/test/hook.test
+++ b/test/hook.test
@@ -956,5 +956,63 @@ ifcapable analyze {
}]
}
+#-------------------------------------------------------------------------
+# Test that the pre-update hook is fired for INSERT statements that use
+# the xfer optimization on without rowid tables.
+#
+reset_db
+do_execsql_test 12.1 {
+ CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
+ CREATE TABLE t2(a INTEGER PRIMARY KEY, b) WITHOUT ROWID;
+
+ INSERT INTO t1 VALUES(1, 2);
+ INSERT INTO t1 VALUES(3, 4);
+ INSERT INTO t2 VALUES(5, 6);
+ INSERT INTO t2 VALUES(7, 8);
+
+ CREATE TABLE t3 (a INTEGER PRIMARY KEY, b) WITHOUT ROWID;
+}
+
+db preupdate hook preupdate_cb
+db update_hook update_cb
+
+proc preupdate_cb {args} { lappend ::res "preupdate" $args }
+proc update_cb {args} { lappend ::res "update" $args }
+
+set ::res [list]
+do_test 12.2 {
+ execsql VACUUM
+ set ::res
+} {}
+
+do_test 12.3 {
+ set ::res [list]
+ execsql { INSERT INTO t3 SELECT a, b FROM t2 }
+ set ::res
+} {preupdate {INSERT main t3 0 0} preupdate {INSERT main t3 0 0}}
+
+do_test 12.4 {
+ execsql { DELETE FROM t3 }
+ set ::res [list]
+ execsql { INSERT INTO t3 SELECT * FROM t2 }
+ set ::res
+} {preupdate {INSERT main t3 0 0} preupdate {INSERT main t3 0 0}}
+
+do_execsql_test 12.5 {
+ CREATE TABLE t4(a COLLATE nocase PRIMARY KEY, b) WITHOUT ROWID;
+ INSERT INTO t4 VALUES('abc', 1);
+ INSERT INTO t4 VALUES('DEF', 2);
+}
+
+set ::res [list]
+do_test 12.6 {
+ execsql VACUUM
+ set ::res
+} {}
+
+do_catchsql_test 12.6 {
+ INSERT INTO t4 VALUES('def', 3);
+} {1 {UNIQUE constraint failed: t4.a}}
finish_test
+