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

Fix an instance where the planner might choose to use the OR-optimization when it adds no benefit. The same quirk causes an assert() to fail. This is not a bug in released versions - without the assert() the library still gets the right answer, it just does so less efficiently than it should.

FossilOrigin-Name: f4bed1d7af8a94c6facd567dec5afae8865a5ad76b8834493099e5e30bed1132
This commit is contained in:
dan
2019-12-28 15:24:02 +00:00
parent f1bb31e219
commit 51f2b1719c
4 changed files with 33 additions and 10 deletions

View File

@ -1001,5 +1001,27 @@ do_execsql_test join-23.10 {
WHERE v0.c0 == 0;
} {123 0 c0}
#-------------------------------------------------------------------------
reset_db
do_execsql_test join-24.1 {
CREATE TABLE t1(a PRIMARY KEY, x);
CREATE TABLE t2(b INT);
CREATE INDEX t1aa ON t1(a, a);
INSERT INTO t1 VALUES('abc', 'def');
INSERT INTO t2 VALUES(1);
}
do_execsql_test join-24.2 {
SELECT * FROM t2 JOIN t1 WHERE a='abc' AND x='def';
} {1 abc def}
do_execsql_test join-24.3 {
SELECT * FROM t2 JOIN t1 WHERE a='abc' AND x='abc';
} {}
do_execsql_test join-24.2 {
SELECT * FROM t2 LEFT JOIN t1 ON a=0 WHERE (x='x' OR x IS NULL);
} {1 {} {}}
finish_test