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:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user