diff options
author | dan <dan@noemail.net> | 2019-10-10 17:09:44 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2019-10-10 17:09:44 +0000 |
commit | 0287c951655bc543a7d0dcdb4fcb8cc1718325ef (patch) | |
tree | 47aa2d8821b491271fa40587f8fc92df28595b9c /src/expr.c | |
parent | cd79010964231114a6e370852c28aae8adcb5dfd (diff) | |
download | sqlite-0287c951655bc543a7d0dcdb4fcb8cc1718325ef.tar.gz sqlite-0287c951655bc543a7d0dcdb4fcb8cc1718325ef.zip |
Prevent SQLite from assuming that if ((? IS NOT NULL) IS NOT NULL) is true, ? may not be NULL. Fix for [d51a8696].
FossilOrigin-Name: 7833feecfe745e237f239ee4c38a9e4bf7ad66a32919150208da87c00a826473
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/expr.c b/src/expr.c index ba19a331d..b1f405cdc 100644 --- a/src/expr.c +++ b/src/expr.c @@ -5168,10 +5168,11 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ return WRC_Prune; case TK_AND: - if( sqlite3ExprImpliesNonNullRow(pExpr->pLeft, pWalker->u.iCur) - && sqlite3ExprImpliesNonNullRow(pExpr->pRight, pWalker->u.iCur) - ){ - pWalker->eCode = 1; + assert( pWalker->eCode==0 ); + sqlite3WalkExpr(pWalker, pExpr->pLeft); + if( pWalker->eCode ){ + pWalker->eCode = 0; + sqlite3WalkExpr(pWalker, pExpr->pRight); } return WRC_Prune; @@ -5230,15 +5231,8 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ int sqlite3ExprImpliesNonNullRow(Expr *p, int iTab){ Walker w; p = sqlite3ExprSkipCollateAndLikely(p); - while( p ){ - if( p->op==TK_NOTNULL ){ - p = p->pLeft; - }else if( p->op==TK_AND ){ - if( sqlite3ExprImpliesNonNullRow(p->pLeft, iTab) ) return 1; - p = p->pRight; - }else{ - break; - } + if( p && p->op==TK_NOTNULL ){ + p = p->pLeft; } w.xExprCallback = impliesNotNullRow; w.xSelectCallback = 0; |