diff options
author | dan <dan@noemail.net> | 2016-09-06 16:33:24 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2016-09-06 16:33:24 +0000 |
commit | 1c12657f9a5527a72986ce4fc0487ea5f5915401 (patch) | |
tree | aab3d1af8b77551a112411e0461bcae2b0020ede /src/wherecode.c | |
parent | 099a0f5f54ee8108b4b131fecc5f20a0005cdd58 (diff) | |
download | sqlite-1c12657f9a5527a72986ce4fc0487ea5f5915401.tar.gz sqlite-1c12657f9a5527a72986ce4fc0487ea5f5915401.zip |
Simplify the fix in commit [7d9bd22c].
FossilOrigin-Name: bd5a342008575bf66f63881a0bebf43741f2a67b
Diffstat (limited to 'src/wherecode.c')
-rw-r--r-- | src/wherecode.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/wherecode.c b/src/wherecode.c index 03d1ac16d..13904c9c8 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -663,25 +663,27 @@ static int codeAllEqualityTerms( testcase( pTerm->eOperator & WO_ISNULL ); testcase( pTerm->eOperator & WO_IN ); if( (pTerm->eOperator & WO_ISNULL)==0 ){ - Expr *pRight = 0; if( pTerm->eOperator & WO_IN ){ if( pTerm->pExpr->flags & EP_xIsSelect ){ - int iField = pTerm->iField ? pTerm->iField-1 : 0; - pRight = pTerm->pExpr->x.pSelect->pEList->a[iField].pExpr; + /* No affinity ever needs to be (or should be) applied to a value + ** from the RHS of an "? IN (SELECT ...)" expression. The + ** sqlite3FindInIndex() routine has already ensured that the + ** affinity of the comparison has been applied to the value. */ + zAff[j] = SQLITE_AFF_BLOB; } }else{ - pRight = pTerm->pExpr->pRight; + Expr *pRight = pTerm->pExpr->pRight; if( (pTerm->wtFlags & TERM_IS)==0 && sqlite3ExprCanBeNull(pRight) ){ sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk); VdbeCoverage(v); } - } - if( pRight && zAff ){ - if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){ - zAff[j] = SQLITE_AFF_BLOB; - } - if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){ - zAff[j] = SQLITE_AFF_BLOB; + if( zAff ){ + if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){ + zAff[j] = SQLITE_AFF_BLOB; + } + if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){ + zAff[j] = SQLITE_AFF_BLOB; + } } } } |