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

Remove an always-false conditional from constructAutomaticIndex(). Put an

assert() in its place to prove that the conditional is always false.

FossilOrigin-Name: 3af300bf6f5bee0b51a4c1ac1dc3879771378bff
This commit is contained in:
drh
2015-02-25 00:24:41 +00:00
parent 2a45cb5c0e
commit 13cc90cfa2
3 changed files with 15 additions and 12 deletions

View File

@@ -1612,13 +1612,16 @@ static void constructAutomaticIndex(
pLoop = pLevel->pWLoop;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
Expr *pExpr = pTerm->pExpr;
assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
|| pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
|| pLoop->prereq!=0 ); /* table of a LEFT JOIN */
if( pLoop->prereq==0
&& (pTerm->wtFlags & TERM_VIRTUAL)==0
&& (!ExprHasProperty(pTerm->pExpr, EP_FromJoin)
|| pTerm->pExpr->iRightJoinTable==pSrc->iCursor)
&& sqlite3ExprIsTableConstant(pTerm->pExpr, pSrc->iCursor) ){
&& !ExprHasProperty(pExpr, EP_FromJoin)
&& sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
pPartial = sqlite3ExprAnd(pParse->db, pPartial,
sqlite3ExprDup(pParse->db, pTerm->pExpr, 0));
sqlite3ExprDup(pParse->db, pExpr, 0));
}
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;