1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Fix a problem with queries of the form "SELECT min(<expr>) ... WHERE <expr>=?" where there is an index on <expr>. Fix for [71e183ca].

FossilOrigin-Name: d465c3eef458c851d97eea6e4117247d9c69386b276168080dbff7bb64070c93
This commit is contained in:
dan
2019-08-03 16:37:40 +00:00
parent 55b4c827fa
commit 192418bd49
6 changed files with 43 additions and 17 deletions

View File

@@ -1562,13 +1562,12 @@ Bitmask sqlite3WhereCodeOneLoopStart(
** the first one after the nEq equality constraints in the index,
** this requires some special handling.
*/
assert( pWInfo->pOrderBy==0
|| pWInfo->pOrderBy->nExpr==1
assert( (pWInfo->pOrderBy!=0 && pWInfo->pOrderBy->nExpr==1)
|| (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0 );
if( (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)!=0
&& pWInfo->nOBSat>0
&& (pIdx->nKeyCol>nEq)
){
if( pLoop->wsFlags & WHERE_MIN_ORDERED ){
assert( (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN) );
assert( pWInfo->nOBSat );
assert( pIdx->nColumn>nEq );
assert( pLoop->nSkip==0 );
bSeekPastNull = 1;
nExtraReg = 1;