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

Bug fixes in the solver.

FossilOrigin-Name: b36034bbd19bc5677b26a6f60ca96eb2b37db373
This commit is contained in:
drh
2013-05-08 03:22:07 +00:00
parent a18f3d271e
commit f204dac1e3
3 changed files with 23 additions and 7 deletions

View File

@@ -5443,6 +5443,7 @@ static int wherePathSolver(WhereInfo *pWInfo){
pFrom->aLoop = pX;
}
aFrom[0].nRow = (double)1;
nFrom = 1;
for(iLoop=0; iLoop<nLoop; iLoop++){
nTo = 0;
@@ -5462,6 +5463,8 @@ static int wherePathSolver(WhereInfo *pWInfo){
for(jj=nTo-1; aTo[jj].rCost>=mxCost; jj++){ assert(jj>0); }
}
pTo = &aTo[jj];
}else{
if( pTo->rCost<=rCost ) continue;
}
pTo->maskLoop = pFrom->maskLoop | pWLoop->maskSelf;
pTo->nRow = pFrom->nRow * pWLoop->nOut;
@@ -5477,6 +5480,19 @@ static int wherePathSolver(WhereInfo *pWInfo){
}
}
#if 0
if( sqlite3WhereTrace ){
sqlite3DebugPrintf("---- round %d ---- nTo=%d\n", iLoop, nTo);
for(ii=0; ii<nTo; ii++){
sqlite3DebugPrintf("%03d: cost=%g nrow=%g\n",
ii, aTo[ii].rCost, aTo[ii].nRow);
for(jj=0; jj<=iLoop; jj++){
whereLoopPrint(aTo[ii].aLoop[jj], pWInfo->pTabList);
}
}
}
#endif
/* Swap the roles of aFrom and aTo in preparation for the next
** cycle. */
pFrom = aTo;