1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Merge changes from trunk into the alter-table-drop-column branch.

FossilOrigin-Name: 9ea640073f8809dfe2612ae1ea384a938b433f884c54d9e5aa3712de79397ac1
This commit is contained in:
drh
2021-02-18 22:47:34 +00:00
12 changed files with 193 additions and 73 deletions

View File

@ -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 ;

View File

@ -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