aboutsummaryrefslogtreecommitdiff
path: root/src/whereexpr.c
diff options
context:
space:
mode:
authordan <Dan Kennedy>2021-02-26 20:14:32 +0000
committerdan <Dan Kennedy>2021-02-26 20:14:32 +0000
commit8ddf686267c58ee0e519cfd9024f177e606be0ab (patch)
tree2972477484a91b982f5b2d4e005d4199550ee208 /src/whereexpr.c
parent4b17455ab2f38d51ab0dcd6f01dd8d99c8229e8c (diff)
downloadsqlite-8ddf686267c58ee0e519cfd9024f177e606be0ab.tar.gz
sqlite-8ddf686267c58ee0e519cfd9024f177e606be0ab.zip
Attempt to optimize "x IS NULL" and "x IS NOT NULL" expressions when x is a column with a NOT NULL constraint.
FossilOrigin-Name: 5ecd842555009ce27ee6390325ac5c2504143474b12b730933f0833b3dad788a
Diffstat (limited to 'src/whereexpr.c')
-rw-r--r--src/whereexpr.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/whereexpr.c b/src/whereexpr.c
index 09ed7f6c3..f547db4f0 100644
--- a/src/whereexpr.c
+++ b/src/whereexpr.c
@@ -1407,6 +1407,11 @@ static void exprAnalyze(
pNew->prereqRight = prereqLeft | extraRight;
pNew->prereqAll = prereqAll;
pNew->eOperator = (operatorMask(pDup->op) + eExtraOp) & opMask;
+ }else if( op==TK_ISNULL && 0==sqlite3ExprCanBeNull(pLeft) ){
+ pExpr->op = TK_TRUEFALSE;
+ ExprSetProperty(pExpr, EP_IsFalse);
+ pTerm->prereqAll = 0;
+ pTerm->eOperator = 0;
}
}