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

The optimization of check-in [9b2879629c34fc0a] is incorrectly reasoned.

The WHERE clause of the partial index might not be true if the table of
the partial index is the right table of a left join.  So disable the
optimization in that case.  Ticket [623eff57e76d45f6]

FossilOrigin-Name: 3be19e1151af1850b65991edb82420f9412a7798dd756c86eaa9ffdde573263a
This commit is contained in:
drh
2019-11-03 00:07:41 +00:00
parent 0383661414
commit db535390db
4 changed files with 62 additions and 36 deletions

View File

@ -935,4 +935,22 @@ do_execsql_test join-19.5 {
(b IS NOT NULL AND b IS NOT NULL) IS NOT NULL;
} {0 {}}
# 2019-11-02 ticket 623eff57e76d45f6
# The optimization of exclusing the WHERE expression of a partial index
# from the WHERE clause of the query if the index is used does not work
# of the table of the index is the right-hand table of a LEFT JOIN.
#
db close
sqlite3 db :memory:
do_execsql_test join-20.1 {
CREATE TABLE t1(c1);
CREATE TABLE t0(c0);
INSERT INTO t0(c0) VALUES (0);
SELECT * FROM t0 LEFT JOIN t1 WHERE NULL IN (c1);
} {}
do_execsql_test join-20.2 {
CREATE INDEX t1x ON t1(0) WHERE NULL IN (c1);
SELECT * FROM t0 LEFT JOIN t1 WHERE NULL IN (c1);
} {}
finish_test