diff options
author | dan <dan@noemail.net> | 2019-08-29 19:34:29 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2019-08-29 19:34:29 +0000 |
commit | 9d23ea74d44f458f39b51ae39a9b0d617947a90d (patch) | |
tree | 25b2c3d45725e80d2b5f13e4591c5fb062152990 /src/expr.c | |
parent | db586e48432ac81c81d454af4f5e879743dd9f7b (diff) | |
download | sqlite-9d23ea74d44f458f39b51ae39a9b0d617947a90d.tar.gz sqlite-9d23ea74d44f458f39b51ae39a9b0d617947a90d.zip |
Fix other problems similar to ticket [c0390363].
FossilOrigin-Name: 96ff2ba9c4bb71d5f7c6f359986a76a5364b7ac3e1a612441543a9eabecf31df
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/expr.c b/src/expr.c index 80bc002d7..fbed5f992 100644 --- a/src/expr.c +++ b/src/expr.c @@ -5014,14 +5014,16 @@ static int exprImpliesNotNull( case TK_GE: case TK_PLUS: case TK_MINUS: - case TK_STAR: - case TK_REM: - case TK_BITAND: case TK_BITOR: - case TK_SLASH: case TK_LSHIFT: case TK_RSHIFT: - case TK_CONCAT: { + case TK_CONCAT: + seenNot = 1; + /* Fall thru */ + case TK_STAR: + case TK_REM: + case TK_BITAND: + case TK_SLASH: { if( exprImpliesNotNull(pParse, p->pRight, pNN, iTab, seenNot) ) return 1; /* Fall thru into the next case */ } @@ -5102,8 +5104,6 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ if( ExprHasProperty(pExpr, EP_FromJoin) ) return WRC_Prune; switch( pExpr->op ){ case TK_ISNOT: - case TK_NOT: - case TK_BITNOT: case TK_ISNULL: case TK_NOTNULL: case TK_IS: @@ -5128,6 +5128,18 @@ 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; + } + return WRC_Prune; + + case TK_BETWEEN: + sqlite3WalkExpr(pWalker, pExpr->pLeft); + return WRC_Prune; + /* Virtual tables are allowed to use constraints like x=NULL. So ** a term of the form x=y does not prove that y is not null if x ** is the column of a virtual table */ @@ -5148,6 +5160,7 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ ){ return WRC_Prune; } + default: return WRC_Continue; } |