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

Allow an automatic index on a WHERE constraint where the RHS is does not

reference another table as long as the RHS is not a constant.

FossilOrigin-Name: 58acc2a8b38c5f13175c191697b4d2b663db1872
This commit is contained in:
drh
2014-06-17 09:00:54 +00:00
parent 9978e6a680
commit 6b7ff748a1
5 changed files with 27 additions and 16 deletions

View File

@@ -4529,7 +4529,10 @@ static int whereLoopAddBtree(
WhereTerm *pWCEnd = pWC->a + pWC->nTerm;
for(pTerm=pWC->a; rc==SQLITE_OK && pTerm<pWCEnd; pTerm++){
if( pTerm->prereqRight & pNew->maskSelf ) continue;
if( pTerm->prereqRight==0 ) continue;
if( pTerm->prereqRight==0
&& sqlite3ExprIsConstant(pTerm->pExpr->pRight) ){
continue;
}
if( termCanDriveIndex(pTerm, pSrc, 0) ){
pNew->u.btree.nEq = 1;
pNew->u.btree.nSkip = 0;