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

Update the xfer optimization code so that the xfer optimization can be used

with INTEGER PRIMARY KEY ON CONFLICT ... as long as the destination table
is initially empty.  Improvements to the comments on the xfer optimization.
New test cases added.

FossilOrigin-Name: e3f368cd5ef66a56fd4bd05a77276039e26b9e0e
This commit is contained in:
drh
2011-11-04 14:36:02 +00:00
parent d28286181d
commit ccdf1baebf
4 changed files with 101 additions and 51 deletions

View File

@ -504,5 +504,61 @@ do_test insert4-8.11 {
}
} {1 2}
do_test insert4-8.21 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT REPLACE, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT REPLACE, y);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
}
} {1 3}
do_test insert4-8.22 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT IGNORE, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT IGNORE, y);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
}
} {1 3}
do_test insert4-8.23 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT ABORT, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT ABORT, y);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
}
} {1 3}
do_test insert4-8.24 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT FAIL, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT FAIL, y);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
}
} {1 3}
do_test insert4-8.25 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT ROLLBACK, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT ROLLBACK, y);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
}
} {1 3}
finish_test