diff options
author | drh <> | 2023-05-31 18:35:12 +0000 |
---|---|---|
committer | drh <> | 2023-05-31 18:35:12 +0000 |
commit | 29e70da4a4e86a8b0bf08632750f879f662e936c (patch) | |
tree | e36a2c3023d90bf08d18040f1271eb3c84d5589a /src/expr.c | |
parent | d3b54d624ff57b941ec5f27abe1c233b618b244b (diff) | |
download | sqlite-29e70da4a4e86a8b0bf08632750f879f662e936c.tar.gz sqlite-29e70da4a4e86a8b0bf08632750f879f662e936c.zip |
Improved detection of when the LEFT JOIN strength reduction optimization
can be applied.
FossilOrigin-Name: f544a8e47cdd5ad7233887a558489983f4f305a39391ff463c43e2e4157da087
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/expr.c b/src/expr.c index 958759812..7e1483a90 100644 --- a/src/expr.c +++ b/src/expr.c @@ -6009,23 +6009,18 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ case TK_ISNULL: case TK_NOTNULL: case TK_IS: - case TK_OR: case TK_VECTOR: - case TK_CASE: - case TK_IN: case TK_FUNCTION: case TK_TRUTH: testcase( pExpr->op==TK_ISNOT ); testcase( pExpr->op==TK_ISNULL ); testcase( pExpr->op==TK_NOTNULL ); testcase( pExpr->op==TK_IS ); - testcase( pExpr->op==TK_OR ); testcase( pExpr->op==TK_VECTOR ); - testcase( pExpr->op==TK_CASE ); - testcase( pExpr->op==TK_IN ); testcase( pExpr->op==TK_FUNCTION ); testcase( pExpr->op==TK_TRUTH ); return WRC_Prune; + case TK_COLUMN: if( pWalker->u.iCur==pExpr->iTable ){ pWalker->eCode = 1; @@ -6033,7 +6028,10 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ } return WRC_Prune; + case TK_OR: case TK_AND: + testcase( pExpr->op==TK_OR ); + testcase( pExpr->op==TK_AND ); if( pWalker->eCode==0 ){ sqlite3WalkExpr(pWalker, pExpr->pLeft); if( pWalker->eCode ){ @@ -6043,11 +6041,13 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ } return WRC_Prune; + case TK_CASE: + case TK_IN: case TK_BETWEEN: - if( sqlite3WalkExpr(pWalker, pExpr->pLeft)==WRC_Abort ){ - assert( pWalker->eCode ); - return WRC_Abort; - } + testcase( pExpr->op==TK_CASE ); + testcase( pExpr->op==TK_IN ); + testcase( pExpr->op==TK_BETWEEN ); + sqlite3WalkExpr(pWalker, pExpr->pLeft); return WRC_Prune; /* Virtual tables are allowed to use constraints like x=NULL. So |