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

Fix over-aggressive optimization of ORDER BY as reported on the mailing list. (CVS 2655)

FossilOrigin-Name: efbb4bc83cd86b6a26d58c5818c58c2e3edaab18
This commit is contained in:
drh
2005-09-01 17:47:51 +00:00
parent 4db38a7092
commit a21c8495f9
5 changed files with 39 additions and 21 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.167 2005/08/29 16:40:53 drh Exp $
** $Id: where.c,v 1.168 2005/09/01 17:47:51 drh Exp $
*/
#include "sqliteInt.h"
@@ -813,7 +813,8 @@ static int sortableByRowid(
assert( pOrderBy!=0 );
assert( pOrderBy->nExpr>0 );
p = pOrderBy->a[0].pExpr;
if( p->op==TK_COLUMN && p->iTable==base && p->iColumn==-1 ){
if( pOrderBy->nExpr==1 && p->op==TK_COLUMN && p->iTable==base
&& p->iColumn==-1 ){
*pbRev = pOrderBy->a[0].sortOrder;
return 1;
}