/ Check-in [e252c654]
Login

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

Overview
Comment:All the OR optimization to proceed even if the OR is also converted into an IN operator.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e252c6540db266b93beeb47a8f7dbf3b275f8c782cd2d36ba4c00648c382f63f
User & Date: drh 2018-04-24 16:41:37
Context
2018-04-24
16:51
Update the expert extension test cases to account for the fact that EXPLAIN QUERY PLAN now shows the start of each trigger in its output. check-in: 8acb42f4 user: drh tags: trunk
16:41
All the OR optimization to proceed even if the OR is also converted into an IN operator. check-in: e252c654 user: drh tags: trunk
14:18
Add a hyperlink to the ticket on the code comment for the fix to ticket [7fa8049685b50b5aeb0c2]. check-in: 45247c7f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/whereexpr.c.

   814    814           testcase( idxNew==0 );
   815    815           exprAnalyze(pSrc, pWC, idxNew);
   816    816           pTerm = &pWC->a[idxTerm];
   817    817           markTermAsChild(pWC, idxNew, idxTerm);
   818    818         }else{
   819    819           sqlite3ExprListDelete(db, pList);
   820    820         }
   821         -      pTerm->eOperator = WO_NOOP;  /* case 1 trumps case 3 */
   822    821       }
   823    822     }
   824    823   }
   825    824   #endif /* !SQLITE_OMIT_OR_OPTIMIZATION && !SQLITE_OMIT_SUBQUERY */
   826    825   
   827    826   /*
   828    827   ** We already know that pExpr is a binary operator where both operands are

Changes to test/where.test.

  1363   1363     SELECT DISTINCT a FROM t181 LEFT JOIN t182 ON a=b ORDER BY c IS NULL, +a;
  1364   1364   } {1 2}
  1365   1365   do_execsql_test where-18.6 {
  1366   1366     INSERT INTO t181 VALUES(2);
  1367   1367     SELECT DISTINCT a FROM t181 LEFT JOIN t182 ON a=b ORDER BY +a, +c IS NULL;
  1368   1368   } {1 2}
  1369   1369   
         1370  +# Make sure the OR optimization works on a JOIN
         1371  +#
         1372  +do_execsql_test where-19.0 {
         1373  +  CREATE TABLE t191(a INT UNIQUE NOT NULL, b INT UNIQUE NOT NULL,c,d);
         1374  +  CREATE INDEX t191a ON t1(a);
         1375  +  CREATE INDEX t191b ON t1(b);
         1376  +  CREATE TABLE t192(x INTEGER PRIMARY KEY,y INT, z INT);
         1377  +
         1378  +  EXPLAIN QUERY PLAN
         1379  +  SELECT t191.rowid FROM t192, t191 WHERE (a=y OR b=y) AND x=?1;
         1380  +} {/.* sqlite_autoindex_t191_1 .* sqlite_autoindex_t191_2 .*/}
         1381  +
  1370   1382   
  1371   1383   finish_test