diff options
author | drh <drh@noemail.net> | 2013-06-03 21:25:28 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-06-03 21:25:28 +0000 |
commit | a3855653ed06222b8c0f0329a4ab23ea8a8adbbb (patch) | |
tree | e1f96b0c32b5e76d33f57dc9c30bc446252786ef /ext/misc/closure.c | |
parent | 45c154ac90fa300d509e8844b345c3e7645e6f17 (diff) | |
download | sqlite-a3855653ed06222b8c0f0329a4ab23ea8a8adbbb.tar.gz sqlite-a3855653ed06222b8c0f0329a4ab23ea8a8adbbb.zip |
Adjust the xBestIndex methods on both the fuzzer and transitive_closure
virtual tables so that an unused MATCH operator gets a really large cost.
Remove ambiguities from the fuzzer test cases.
FossilOrigin-Name: e2c1af78b65a8ace976fa6c035db212e1ffc79b8
Diffstat (limited to 'ext/misc/closure.c')
-rw-r--r-- | ext/misc/closure.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/misc/closure.c b/ext/misc/closure.c index 665cc7ce4..260a78304 100644 --- a/ext/misc/closure.c +++ b/ext/misc/closure.c @@ -826,12 +826,17 @@ static int closureBestIndex( int iPlan = 0; int i; int idx = 1; + int seenMatch = 0; const struct sqlite3_index_constraint *pConstraint; closure_vtab *pVtab = (closure_vtab*)pTab; double rCost = 10000000.0; pConstraint = pIdxInfo->aConstraint; for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){ + if( pConstraint->iColumn==CLOSURE_COL_ROOT + && pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){ + seenMatch = 1; + } if( pConstraint->usable==0 ) continue; if( (iPlan & 1)==0 && pConstraint->iColumn==CLOSURE_COL_ROOT @@ -895,6 +900,7 @@ static int closureBestIndex( ){ pIdxInfo->orderByConsumed = 1; } + if( seenMatch && (iPlan&1)==0 ) rCost *= 1e30; pIdxInfo->estimatedCost = rCost; return SQLITE_OK; |