1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Avoid redundant table b-tree cursor seeks in UPDATE statements that use the

two-pass strategy.

FossilOrigin-Name: dc555b1039c6930f6d15355c698ff917a85e8056
This commit is contained in:
dan
2017-01-28 19:45:34 +00:00
parent 6034d47618
commit f64ece143c
7 changed files with 62 additions and 15 deletions

View File

@ -176,5 +176,30 @@ foreach {tn sql} {
}
}
#-------------------------------------------------------------------------
#
do_execsql_test 5.0 {
CREATE TABLE x1(a INTEGER PRIMARY KEY, b, c);
CREATE INDEX x1c ON x1(b, c);
INSERT INTO x1 VALUES(1, 'a', 1);
INSERT INTO x1 VALUES(2, 'a', 2);
INSERT INTO x1 VALUES(3, 'a', 3);
}
do_execsql_test 5.1.1 {
UPDATE x1 SET c=c+1 WHERE b='a';
}
do_execsql_test 5.1.2 {
SELECT * FROM x1;
} {1 a 2 2 a 3 3 a 4}
do_test 5.2 {
catch { array unset A }
db eval { EXPLAIN UPDATE x1 SET c=c+1 WHERE b='a' } { incr A($opcode) }
set A(NotExists)
} {1}
finish_test