diff options
author | drh <drh@noemail.net> | 2008-07-08 18:05:26 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-07-08 18:05:26 +0000 |
commit | 0880a7463364f3fd0428c8457c89c5fefae977ea (patch) | |
tree | 476be7d82431ffa906a3bc9f5b7f8cc046f02df9 /src | |
parent | 49fc1f60b0129650dee601de0819fa1392d7bc70 (diff) | |
download | sqlite-0880a7463364f3fd0428c8457c89c5fefae977ea.tar.gz sqlite-0880a7463364f3fd0428c8457c89c5fefae977ea.zip |
Improved testing of the min/max optimization. (CVS 5373)
FossilOrigin-Name: fa07c360b708324c47c8e9931f1e2b1b24e4faf8
Diffstat (limited to 'src')
-rw-r--r-- | src/select.c | 4 | ||||
-rw-r--r-- | src/where.c | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/select.c b/src/select.c index 9275c47d5..6effc49d5 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.448 2008/07/08 17:43:57 danielk1977 Exp $ +** $Id: select.c,v 1.449 2008/07/08 18:05:26 drh Exp $ */ #include "sqliteInt.h" @@ -4241,7 +4241,7 @@ int sqlite3Select( if( flag ){ pDel = pMinMax = sqlite3ExprListDup(db, p->pEList->a[0].pExpr->pList); if( pMinMax && !db->mallocFailed ){ - pMinMax->a[0].sortOrder = ((flag==WHERE_ORDERBY_MIN)?0:1); + pMinMax->a[0].sortOrder = flag!=WHERE_ORDERBY_MIN; pMinMax->a[0].pExpr->op = TK_COLUMN; } } diff --git a/src/where.c b/src/where.c index 009dd4848..97edf5be7 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.311 2008/06/26 18:04:03 danielk1977 Exp $ +** $Id: where.c,v 1.312 2008/07/08 18:05:26 drh Exp $ */ #include "sqliteInt.h" @@ -2157,7 +2157,8 @@ WhereInfo *sqlite3WhereBegin( ppIdxInfo); flags = WHERE_VIRTUALTABLE; pIndex = *ppIdxInfo; - if( pIndex && pIndex->orderByConsumed ){ + assert( pIndex!=0 ); + if( pIndex->orderByConsumed ){ flags = WHERE_VIRTUALTABLE | WHERE_ORDERBY; } pIdx = 0; @@ -2546,8 +2547,9 @@ WhereInfo *sqlite3WhereBegin( if( (wflags&WHERE_ORDERBY_MIN)!=0 && (pLevel->flags&WHERE_ORDERBY) && (pIdx->nColumn>nEq) - && (pOrderBy->a[0].pExpr->iColumn==pIdx->aiColumn[nEq]) ){ + assert( pOrderBy->nExpr==1 ); + assert( pOrderBy->a[0].pExpr->iColumn==pIdx->aiColumn[nEq] ); isMinQuery = 1; } |