Disable sorting by indices if there is a COLLATE subclause in the
ORDER BY clause. (CVS 713)
FossilOrigin-Name: 2438da791afb53b4f1c7a9ff9705d393c86f3cbd
diff --git a/src/where.c b/src/where.c
index 8211d42..1f4130b 100644
--- a/src/where.c
+++ b/src/where.c
@@ -13,7 +13,7 @@
** the WHERE clause of SQL statements. Also found here are subroutines
** to generate VDBE code to evaluate expressions.
**
-** $Id: where.c,v 1.61 2002/08/13 23:02:58 drh Exp $
+** $Id: where.c,v 1.62 2002/08/14 03:03:57 drh Exp $
*/
#include "sqliteInt.h"
@@ -181,6 +181,10 @@
/* Indices can only be used for ascending sort order */
return 0;
}
+ if( (pOrderBy->a[i].sortOrder & SQLITE_SO_TYPEMASK)!=SQLITE_SO_UNK ){
+ /* Do not sort by index if there is a COLLATE clause */
+ return 0;
+ }
p = pOrderBy->a[i].pExpr;
if( p->op!=TK_COLUMN || p->iTable!=base ){
/* Can not use an index sort on anything that is not a column in the