/ 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 Unified Diffs Show Whitespace Changes Patch

Changes to src/wherecode.c.

1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
        ** select.c to pick a value for "b" in the above query.  */
        assert( startEq==0 && (op==OP_SeekGT || op==OP_SeekLT) );
        assert( (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)!=0 && pWInfo->nOBSat>0 );
        sqlite3VdbeChangeP2(v, -1, sqlite3VdbeCurrentAddr(v)+1);
        sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);

        op = aStartOp[(start_constraints<<2) + (1<<1) + bRev];
        assert( op!=0 );
        sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
        VdbeCoverage(v);
        VdbeCoverageIf(v, op==OP_SeekGE);  testcase( op==OP_SeekGE );
        VdbeCoverageIf(v, op==OP_SeekLE);  testcase( op==OP_SeekLE );
      }
    }








|







1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
        ** select.c to pick a value for "b" in the above query.  */
        assert( startEq==0 && (op==OP_SeekGT || op==OP_SeekLT) );
        assert( (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)!=0 && pWInfo->nOBSat>0 );
        sqlite3VdbeChangeP2(v, -1, sqlite3VdbeCurrentAddr(v)+1);
        sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);

        op = aStartOp[(start_constraints<<2) + (1<<1) + bRev];
        assert( op==OP_SeekGE || op==OP_SeekLE );
        sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
        VdbeCoverage(v);
        VdbeCoverageIf(v, op==OP_SeekGE);  testcase( op==OP_SeekGE );
        VdbeCoverageIf(v, op==OP_SeekLE);  testcase( op==OP_SeekLE );
      }
    }