1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-16 23:02:26 +03:00

If a unique index covers any prefix of the ORDER BY clause then let it

satisfy the ORDER BY clause. (CVS 5301)

FossilOrigin-Name: e53403b6d742be83c5b130ed6cef4035d081d613
This commit is contained in:
drh
2008-06-25 02:47:57 +00:00
parent fae37af17f
commit ff354e91ba
5 changed files with 16 additions and 13 deletions

View File

@@ -16,7 +16,7 @@
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.309 2008/06/15 02:51:48 drh Exp $
** $Id: where.c,v 1.310 2008/06/25 02:47:57 drh Exp $
*/
#include "sqliteInt.h"
@@ -1089,6 +1089,9 @@ static int isSortingIndex(
** ORDER BY term, that is OK. Just ignore that column of the index
*/
continue;
}else if( i==pIdx->nColumn ){
/* Index column i is the rowid. All other terms match. */
break;
}else{
/* If an index column fails to match and is not constrained by ==
** then the index cannot satisfy the ORDER BY constraint.