mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-18 10:21:03 +03:00
Avoid assuming that "column IS ?", where column is declared UNIQUE, matches only a single row (as "?" might be NULL). Fix for [b8689402].
FossilOrigin-Name: d02490a2f0cae047087130b4ad8f55f265845c2ffb3bde3b7d507edb54acea6d
This commit is contained in:
12
src/where.c
12
src/where.c
@@ -3765,15 +3765,21 @@ static i8 wherePathSatisfiesOrderBy(
|
||||
u16 eOp = pLoop->aLTerm[j]->eOperator;
|
||||
|
||||
/* Skip over == and IS and ISNULL terms. (Also skip IN terms when
|
||||
** doing WHERE_ORDERBY_LIMIT processing).
|
||||
** doing WHERE_ORDERBY_LIMIT processing). Except, IS and ISNULL
|
||||
** terms imply that the index is not UNIQUE NOT NULL in which case
|
||||
** the loop need to be marked as not order-distinct because it can
|
||||
** have repeated NULL rows.
|
||||
**
|
||||
** If the current term is a column of an ((?,?) IN (SELECT...))
|
||||
** expression for which the SELECT returns more than one column,
|
||||
** check that it is the only column used by this loop. Otherwise,
|
||||
** if it is one of two or more, none of the columns can be
|
||||
** considered to match an ORDER BY term. */
|
||||
** considered to match an ORDER BY term.
|
||||
*/
|
||||
if( (eOp & eqOpMask)!=0 ){
|
||||
if( eOp & WO_ISNULL ){
|
||||
if( eOp & (WO_ISNULL|WO_IS) ){
|
||||
testcase( eOp & WO_ISNULL );
|
||||
testcase( eOp & WO_IS );
|
||||
testcase( isOrderDistinct );
|
||||
isOrderDistinct = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user