/ Check-in [cbb977fe]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change the LEFT JOIN strength reduction optimization so that assumes that virtual table constraints can be true even if terms within the constraint are NULL. This works around dodgy virtual table implementations. Fix for ticket [fac496b61722daf2].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cbb977fe1908431f3aad8e67668588b119e7d491724f2042af436f509a4f6623
User & Date: drh 2018-04-03 14:04:48
Original Comment: Change the LEFT JOIN strength reduction optimization so that assumes that virtual table constraints can be true even if terms within the constraint are NULL. This works around dodgy virtual table implementations.
Context
2018-04-03
14:25
Fix the generate_series virtual table so that it correctly returns no rows if any of its constraints are NULL. Ticket [fac496b61722daf28]. check-in: 3328e828 user: drh tags: trunk
14:04
Change the LEFT JOIN strength reduction optimization so that assumes that virtual table constraints can be true even if terms within the constraint are NULL. This works around dodgy virtual table implementations. Fix for ticket [fac496b61722daf2]. check-in: cbb977fe user: drh tags: trunk
2018-04-02
11:04
Version 3.23.0 check-in: 736b53f5 user: drh tags: trunk, release, version-3.23.0
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/expr.c.

5033
5034
5035
5036
5037
5038
5039





















5040
5041
5042
5043
5044
5045
5046
      return WRC_Prune;
    case TK_COLUMN:
      if( pWalker->u.iCur==pExpr->iTable ){
        pWalker->eCode = 1;
        return WRC_Abort;
      }
      return WRC_Prune;





















    default:
      return WRC_Continue;
  }
}

/*
** Return true (non-zero) if expression p can only be true if at least







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
      return WRC_Prune;
    case TK_COLUMN:
      if( pWalker->u.iCur==pExpr->iTable ){
        pWalker->eCode = 1;
        return WRC_Abort;
      }
      return WRC_Prune;

    /* Virtual tables are allowed to use constraints like x=NULL.  So
    ** a term of the form x=y does not prove that y is not null if x
    ** is the column of a virtual table */
    case TK_EQ:
    case TK_NE:
    case TK_LT:
    case TK_LE:
    case TK_GT:
    case TK_GE:
      testcase( pExpr->op==TK_EQ );
      testcase( pExpr->op==TK_NE );
      testcase( pExpr->op==TK_LT );
      testcase( pExpr->op==TK_LE );
      testcase( pExpr->op==TK_GT );
      testcase( pExpr->op==TK_GE );
      if( (pExpr->pLeft->op==TK_COLUMN && IsVirtual(pExpr->pLeft->pTab))
       || (pExpr->pRight->op==TK_COLUMN && IsVirtual(pExpr->pRight->pTab))
      ){
       return WRC_Prune;
      }
    default:
      return WRC_Continue;
  }
}

/*
** Return true (non-zero) if expression p can only be true if at least