mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
When applying the optimization that disables WHERE clause terms that drive
indexes, make sure not to do so if the term being disabled is a transitive constraint. Fix for the problem identified by [forum:forumpost/eb8613976a|forum post eb8613976a]. FossilOrigin-Name: f1f9b5de3c59489b94963685660b3ddc45eece5535b02fec399b6ece0e38563d
This commit is contained in:
@ -353,4 +353,31 @@ do_execsql_test transitive1-570eqp {
|
||||
SELECT * FROM c1 WHERE x=y AND z=y AND z='abc';
|
||||
} {/SEARCH c1 USING INDEX c1x/}
|
||||
|
||||
# 2021-05-04 forum https://sqlite.org/forum/forumpost/eb8613976a
|
||||
reset_db
|
||||
do_execsql_test transitive1-600 {
|
||||
CREATE TABLE t0(a0 INT, b1 INT);
|
||||
CREATE INDEX t0b1 ON t0(b1);
|
||||
CREATE TABLE t1(w,x,y,z3 INT);
|
||||
INSERT INTO t0(a0, b1) VALUES (0,1);
|
||||
INSERT INTO t1(w,x,y,z3) VALUES (7,8,9,1);
|
||||
} {}
|
||||
do_execsql_test transitive1-610 {
|
||||
SELECT ALL * FROM t0,t1 WHERE b1=z3 AND a0=z3;
|
||||
} {}
|
||||
do_execsql_test transitive1-620 {
|
||||
SELECT ALL * FROM t0,t1 WHERE likely(b1=z3) AND a0=z3;
|
||||
} {}
|
||||
do_execsql_test transitive1-630 {
|
||||
DROP TABLE t0;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t0(c0 INT, c1 INT UNIQUE);
|
||||
CREATE TABLE t1(c0 INT);
|
||||
INSERT INTO t0(c0, c1) VALUES (0, 1);
|
||||
INSERT INTO t1(c0) VALUES (1);
|
||||
SELECT ALL * FROM t1 NATURAL JOIN t0 WHERE (t1.c0=t0.c1);
|
||||
SELECT ALL * FROM t1 NATURAL JOIN t0 WHERE (likely(t1.c0=t0.c1));
|
||||
SELECT ALL * FROM t1,t0 WHERE (likely(t1.c0=t0.c1) AND t1.c0=t0.c0);
|
||||
} {}
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user