mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-21 09:00:59 +03:00
Allow an index to be used for sorting even if prior terms of the index
are constrained by IN operators. FossilOrigin-Name: 98bf668ab1a8683b46ee8c94cb60f8215aabc517
This commit is contained in:
@@ -3010,10 +3010,15 @@ static int isSortingIndex(
|
||||
if( pConstraint==0 ){
|
||||
isEq = 0;
|
||||
}else if( (pConstraint->eOperator & WO_IN)!=0 ){
|
||||
#if 0
|
||||
/* Constraints of the form: "X IN ..." cannot be used with an ORDER BY
|
||||
** because we do not know in what order the values on the RHS of the IN
|
||||
** operator will occur. */
|
||||
break;
|
||||
#else
|
||||
if( termSortOrder ) break;
|
||||
isEq = 0;
|
||||
#endif
|
||||
}else if( (pConstraint->eOperator & WO_ISNULL)!=0 ){
|
||||
uniqueNotNull = 0;
|
||||
isEq = 1; /* "X IS NULL" means X has only a single value */
|
||||
@@ -3317,8 +3322,8 @@ static void bestBtreeIndex(WhereBestIdx *p){
|
||||
** indicate this to the caller.
|
||||
**
|
||||
** Otherwise, if the search may find more than one row, test to see if
|
||||
** there is a range constraint on indexed column (pc.plan.nEq+1) that can be
|
||||
** optimized using the index.
|
||||
** there is a range constraint on indexed column (pc.plan.nEq+1) that
|
||||
** can be optimized using the index.
|
||||
*/
|
||||
if( pc.plan.nEq==pProbe->nColumn && pProbe->onError!=OE_None ){
|
||||
testcase( pc.plan.wsFlags & WHERE_COLUMN_IN );
|
||||
|
||||
Reference in New Issue
Block a user