aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2007-03-02 08:12:22 +0000
committerdanielk1977 <danielk1977@noemail.net>2007-03-02 08:12:22 +0000
commit8efe541f246c554198731eb48d77c255b9042b34 (patch)
tree480531c8558a8270584dde17f7a34306442c9a8f /src
parenta41c7497e800fdc6890dd2fbe9ff545445b5b348 (diff)
downloadsqlite-8efe541f246c554198731eb48d77c255b9042b34.tar.gz
sqlite-8efe541f246c554198731eb48d77c255b9042b34.zip
Handle the case where the estimated cost of a virtual table scan is larger than SQLITE_BIG_DBL. Ticket #2253. (CVS 3670)
FossilOrigin-Name: 52885ed8b76a06588acf202a38b4feabfca1cfd1
Diffstat (limited to 'src')
-rw-r--r--src/where.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/where.c b/src/where.c
index ad7e12c88..a3b49ccb1 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.238 2007/02/23 23:13:34 drh Exp $
+** $Id: where.c,v 1.239 2007/03/02 08:12:22 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -1357,6 +1357,7 @@ static double bestVirtualIndex(
rc = sqlite3SafetyOn(pParse->db);
}
*(int*)&pIdxInfo->nOrderBy = nOrderBy;
+
return pIdxInfo->estimatedCost;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -2043,6 +2044,14 @@ WhereInfo *sqlite3WhereBegin(
}
pIdx = 0;
nEq = 0;
+ if( (SQLITE_BIG_DBL/2.0)<cost ){
+ /* The cost is not allowed to be larger than SQLITE_BIG_DBL (the
+ ** inital value of lowestCost in this loop. If it is, then
+ ** the (cost<lowestCost) test below will never be true and
+ ** pLevel->pBestIdx never set.
+ */
+ cost = (SQLITE_BIG_DBL/2.0);
+ }
}else
#endif
{