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

Unless the destination table is completely empty, disable the xfer optimization for WITHOUT ROWID tables.

FossilOrigin-Name: 3877c9f50582b51817dcf3cd75d836891a34e590
This commit is contained in:
dan
2013-11-05 16:39:31 +00:00
parent 7b3d1860af
commit 427ebba10c
5 changed files with 91 additions and 45 deletions

View File

@ -153,6 +153,55 @@ do_execsql_test 2.4.2 {
SELECT * FROM t6 ORDER BY c;
} {ABC def ghi ABC def ghi}
#-------------------------------------------------------------------------
# Unless the destination table is completely empty, the xfer optimization
# is disabled for WITHOUT ROWID tables. The following tests check for
# some problems that might occur if this were not the case.
#
reset_db
do_execsql_test 3.1.1 {
CREATE TABLE t1(a, b, PRIMARY KEY(a)) WITHOUT ROWID;
CREATE UNIQUE INDEX i1 ON t1(b);
CREATE TABLE t2(a, b, PRIMARY KEY(a)) WITHOUT ROWID;
CREATE UNIQUE INDEX i2 ON t2(b);
INSERT INTO t1 VALUES('one', 'two');
INSERT INTO t2 VALUES('three', 'two');
}
do_execsql_test 3.1.2 {
INSERT OR REPLACE INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
} {three two}
do_execsql_test 3.1.3 {
DELETE FROM t1;
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
} {three two}
do_catchsql_test 3.1.4 {
INSERT INTO t2 VALUES('four', 'four');
INSERT INTO t2 VALUES('six', 'two');
INSERT INTO t1 SELECT * FROM t2;
} {1 {UNIQUE constraint failed: t2.b}}
do_execsql_test 3.1.5 {
CREATE TABLE t3(a PRIMARY KEY);
CREATE TABLE t4(a PRIMARY KEY);
INSERT INTO t4 VALUES('i');
INSERT INTO t4 VALUES('ii');
INSERT INTO t4 VALUES('iii');
INSERT INTO t3 SELECT * FROM t4;
SELECT * FROM t3;
} {i ii iii}
explain_i {
INSERT INTO t3 SELECT * FROM t4;
}
finish_test