/ Check-in [1bd4b97d64]
Login

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

Overview
Comment:Strengthen an assert() in the WHERE clause code generator for the min/max optimization.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1bd4b97d6405c9b093f3bfed914c56088ee13e4a2242be62b74a86660f74f533
User & Date: drh 2019-08-03 19:06:18
Original Comment: Stregthen an assert() in the WHERE clause code generator for the min/max optimization.
Context
2019-08-05
12:55
Prevent an fts5 table from being its own content table, or part of a view that is the content table. check-in: b6d52c9364 user: dan tags: trunk
2019-08-03
19:06
Strengthen an assert() in the WHERE clause code generator for the min/max optimization. check-in: 1bd4b97d64 user: drh tags: trunk
16:37
Fix a problem with queries of the form "SELECT min(<expr>) ... WHERE <expr>=?" where there is an index on <expr>. Fix for [71e183ca]. check-in: d465c3eef4 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wherecode.c.

  1702   1702           ** select.c to pick a value for "b" in the above query.  */
  1703   1703           assert( startEq==0 && (op==OP_SeekGT || op==OP_SeekLT) );
  1704   1704           assert( (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)!=0 && pWInfo->nOBSat>0 );
  1705   1705           sqlite3VdbeChangeP2(v, -1, sqlite3VdbeCurrentAddr(v)+1);
  1706   1706           sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
  1707   1707   
  1708   1708           op = aStartOp[(start_constraints<<2) + (1<<1) + bRev];
  1709         -        assert( op!=0 );
         1709  +        assert( op==OP_SeekGE || op==OP_SeekLE );
  1710   1710           sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
  1711   1711           VdbeCoverage(v);
  1712   1712           VdbeCoverageIf(v, op==OP_SeekGE);  testcase( op==OP_SeekGE );
  1713   1713           VdbeCoverageIf(v, op==OP_SeekLE);  testcase( op==OP_SeekLE );
  1714   1714         }
  1715   1715       }
  1716   1716