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

Provide hints for all terms in a range constraint if there are any equality

terms anywhere in the constraint.  Range constraint terms are only omitted
for a pure range constraint with no equality prefix.

FossilOrigin-Name: b5897bc0f003c470eeb2a75e0a2b2bb202681531
This commit is contained in:
drh
2015-08-18 15:58:05 +00:00
parent b413a5467a
commit bcf40a7f12
4 changed files with 29 additions and 26 deletions

View File

@ -139,15 +139,19 @@ do_test 4.5desc {
SELECT c FROM t1 WHERE b>=10 AND b<=20 ORDER BY b DESC;
}
} {GE(c0,10)}
# If there are any equality terms used in the constraint, then all terms
# should be hinted.
#
do_test 4.6asc {
p4_of_opcode db CursorHint {
SELECT rowid FROM t1 WHERE b=22 AND c>=10 AND c<=20 ORDER BY b,c ASC;
}
} {LE(c1,20)}
} {AND(AND(EQ(c0,22),GE(c1,10)),LE(c1,20))}
do_test 4.6desc {
p4_of_opcode db CursorHint {
SELECT rowid FROM t1 WHERE b=22 AND c>=10 AND c<=20 ORDER BY b,c DESC;
}
} {GE(c1,10)}
} {AND(AND(EQ(c0,22),GE(c1,10)),LE(c1,20))}
finish_test