1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Fix the OUTER JOIN strength reduction theorem prover's handling of the CASE

operator.

FossilOrigin-Name: 73d7b14b1713d93c4ae07995e9aa6485cbad90bd6125584dbaeccb0cc9410ea3
This commit is contained in:
drh
2023-06-02 00:03:28 +00:00
parent 179c32cb57
commit 4ffcce88ad
4 changed files with 22 additions and 18 deletions

View File

@@ -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)",