mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
The expression "(X IS FALSE) BETWEEN FALSE AND TRUE" does not implie that
X is not NULL. Ticket [fba33c8b1df6a915] FossilOrigin-Name: 057fb8b1809b8b9c8fff0fd0804153b9644f0545c23c6ddc4758bda3381094b9
This commit is contained in:
11
src/expr.c
11
src/expr.c
@@ -4974,13 +4974,16 @@ int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
|
||||
|
||||
/*
|
||||
** Return non-zero if Expr p can only be true if pNN is not NULL.
|
||||
**
|
||||
** Or if seenNot is true, return non-zero if Expr p can only be
|
||||
** non-NULL if pNN is not NULL
|
||||
*/
|
||||
static int exprImpliesNotNull(
|
||||
Parse *pParse, /* Parsing context */
|
||||
Expr *p, /* The expression to be checked */
|
||||
Expr *pNN, /* The expression that is NOT NULL */
|
||||
int iTab, /* Table being evaluated */
|
||||
int seenNot /* True if p is an operand of NOT */
|
||||
int seenNot /* Return true only if p can be any non-NULL value */
|
||||
){
|
||||
assert( p );
|
||||
assert( pNN );
|
||||
@@ -4999,12 +5002,12 @@ static int exprImpliesNotNull(
|
||||
assert( pList!=0 );
|
||||
assert( pList->nExpr==2 );
|
||||
if( seenNot ) return 0;
|
||||
if( exprImpliesNotNull(pParse, pList->a[0].pExpr, pNN, iTab, seenNot)
|
||||
|| exprImpliesNotNull(pParse, pList->a[1].pExpr, pNN, iTab, seenNot)
|
||||
if( exprImpliesNotNull(pParse, pList->a[0].pExpr, pNN, iTab, 1)
|
||||
|| exprImpliesNotNull(pParse, pList->a[1].pExpr, pNN, iTab, 1)
|
||||
){
|
||||
return 1;
|
||||
}
|
||||
return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot);
|
||||
return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, 1);
|
||||
}
|
||||
case TK_EQ:
|
||||
case TK_NE:
|
||||
|
||||
Reference in New Issue
Block a user