/ Check-in [7d3cb39f]
Login

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

Overview
Comment:Fix a problem causing non-covered WHERE terms to be evaluated before covered WHERE terms.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | defer-where-subqueries
Files: files | file ages | folders
SHA3-256: 7d3cb39f60951dcec1ff87da2c4ec998f993de5edf49ee5e5f480c6fe4e5a052
User & Date: dan 2017-07-10 14:39:42
Context
2017-07-10
15:17
Fix another problem on this branch. check-in: a4fc9811 user: dan tags: defer-where-subqueries
14:39
Fix a problem causing non-covered WHERE terms to be evaluated before covered WHERE terms. check-in: 7d3cb39f user: dan tags: defer-where-subqueries
14:33
When testing non-indexed WHERE constraints, test those that involve correlated sub-queries last of all. This increases the chances of not having to run the sub-query at all. check-in: 1f9c1f35 user: dan tags: defer-where-subqueries
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wherecode.c.

  2053   2053         }
  2054   2054         pE = pTerm->pExpr;
  2055   2055         assert( pE!=0 );
  2056   2056         if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
  2057   2057           continue;
  2058   2058         }
  2059   2059         
  2060         -      if( iNext==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
         2060  +      if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
  2061   2061           iNext = 2;
  2062   2062           continue;
  2063   2063         }
  2064   2064         if( iLoop<3 && (pE->flags & EP_VarSelect) ){
  2065   2065           if( iNext==0 ) iNext = 3;
  2066   2066           continue;
  2067   2067         }