aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <>2023-06-02 00:03:28 +0000
committerdrh <>2023-06-02 00:03:28 +0000
commit4ffcce88ad49b174ce5714e3c7a0b8e6462da7cd (patch)
treed35cd905933b9421eedc81256fc2556e492f8b91 /src/expr.c
parent179c32cb579af1cb2244c7397b7fb8c1666bfe06 (diff)
downloadsqlite-4ffcce88ad49b174ce5714e3c7a0b8e6462da7cd.tar.gz
sqlite-4ffcce88ad49b174ce5714e3c7a0b8e6462da7cd.zip
Fix the OUTER JOIN strength reduction theorem prover's handling of the CASE
operator. FossilOrigin-Name: 73d7b14b1713d93c4ae07995e9aa6485cbad90bd6125584dbaeccb0cc9410ea3
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/expr.c b/src/expr.c
index 707a9ca6b..92e96b0f1 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -6026,6 +6026,7 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){
case TK_VECTOR:
case TK_FUNCTION:
case TK_TRUTH:
+ case TK_CASE:
testcase( pExpr->op==TK_ISNOT );
testcase( pExpr->op==TK_ISNULL );
testcase( pExpr->op==TK_NOTNULL );
@@ -6033,6 +6034,7 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){
testcase( pExpr->op==TK_VECTOR );
testcase( pExpr->op==TK_FUNCTION );
testcase( pExpr->op==TK_TRUTH );
+ testcase( pExpr->op==TK_CASE );
return WRC_Prune;
case TK_COLUMN:
@@ -6055,16 +6057,6 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){
testcase( pExpr->op==TK_AND );
bothImplyNotNullRow(pWalker, pExpr->pLeft, pExpr->pRight);
return WRC_Prune;
-
- case TK_CASE:
- /* In "CASE x WHEN y THEN ..." the overall expression is non-null-row
- ** if either x or y is non-null-row. If the neither x nor y is
- ** non-null-row, assume the whole expression is not, to be safe. */
- assert( ExprUseXList(pExpr) );
- assert( pExpr->x.pList->nExpr>0 );
- sqlite3WalkExpr(pWalker, pExpr->pLeft);
- sqlite3WalkExpr(pWalker, pExpr->x.pList->a[0].pExpr);
- return WRC_Prune;
case TK_IN:
/* Beware of "x NOT IN ()" and "x NOT IN (SELECT 1 WHERE false)",