aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2008-06-25 02:47:57 +0000
committerdrh <drh@noemail.net>2008-06-25 02:47:57 +0000
commitff354e91baa33e33e4c4b789f8c2b5c1cdfa9af5 (patch)
treeab5f1ac9ec2d0e7d374e7fb66a13d5db8907ba89 /src
parentfae37af17f9862c86585fcef8c7fca858b334482 (diff)
downloadsqlite-ff354e91baa33e33e4c4b789f8c2b5c1cdfa9af5.tar.gz
sqlite-ff354e91baa33e33e4c4b789f8c2b5c1cdfa9af5.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/where.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/where.c b/src/where.c
index 3a14bf321..a5ba55f0d 100644
--- a/src/where.c
+++ b/src/where.c
@@ -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.