1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Make sure the estLog() routine in the query planner handles negative

values correctly (always returning 1).  Prior to this change, estLog(-1)
would return a large number which could throw off the cost computations
in the query planner in obscure circumstances.

FossilOrigin-Name: 75437bee4905949c66dc7694ea234d4d5aefd981
This commit is contained in:
drh
2014-06-06 20:20:09 +00:00
parent 94aa7e091b
commit c94b2f7d6b
3 changed files with 8 additions and 8 deletions

View File

@@ -1494,7 +1494,7 @@ static int isDistinctRedundant(
** Estimate the logarithm of the input value to base 2.
*/
static LogEst estLog(LogEst N){
LogEst x = sqlite3LogEst(N);
LogEst x = N<0 ? 1 : sqlite3LogEst(N);
return x>33 ? x - 33 : 0;
}