/ Check-in [bfe79378]
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:Revise the VDBE comments for NULL-scan so that they also work make sense when reading a NULLS FIRST plan.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | nulls-last
Files: files | file ages | folders
SHA3-256: bfe793780fa6fc7a1e7d0ee60606dda272985de9573887dca118e9510fc609f2
User & Date: drh 2019-08-23 17:09:02
Context
2019-08-23
20:33
Move some things in parse.y so that TK_COLUMN and TK_AGG_COLUMN are assigned the same values as they are on trunk for a very small speedup. check-in: d26fdfa3 user: dan tags: nulls-last
17:09
Revise the VDBE comments for NULL-scan so that they also work make sense when reading a NULLS FIRST plan. check-in: bfe79378 user: drh tags: nulls-last
17:00
Additional simplifications of the WHERE loop code generator logic for NULLS LAST. check-in: 1383680d user: drh tags: nulls-last
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wherecode.c.

  1687   1687         ** so no further seeking is needed */
  1688   1688       }else{
  1689   1689         if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
  1690   1690           sqlite3VdbeAddOp1(v, OP_SeekHit, iIdxCur);
  1691   1691         }
  1692   1692         if( regBignull ){
  1693   1693           sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull);
  1694         -        VdbeComment((v, "NULL-scan needed flag"));
         1694  +        VdbeComment((v, "NULL-scan pass ctr"));
  1695   1695         }
  1696   1696   
  1697   1697         op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
  1698   1698         assert( op!=0 );
  1699   1699         sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
  1700   1700         VdbeCoverage(v);
  1701   1701         VdbeCoverageIf(v, op==OP_Rewind);  testcase( op==OP_Rewind );
................................................................................
  1765   1765       pLevel->p2 = sqlite3VdbeCurrentAddr(v);
  1766   1766   
  1767   1767       /* Check if the index cursor is past the end of the range. */
  1768   1768       if( nConstraint ){
  1769   1769         if( regBignull ){
  1770   1770           /* Except, skip the end-of-range check while doing the NULL-scan */
  1771   1771           sqlite3VdbeAddOp2(v, OP_IfNot, regBignull, sqlite3VdbeCurrentAddr(v)+3);
  1772         -        VdbeComment((v, "If NULL-scan active"));
         1772  +        VdbeComment((v, "If NULL-scan 2nd pass"));
  1773   1773           VdbeCoverage(v);
  1774   1774         }
  1775   1775         op = aEndOp[bRev*2 + endEq];
  1776   1776         sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
  1777   1777         testcase( op==OP_IdxGT );  VdbeCoverageIf(v, op==OP_IdxGT );
  1778   1778         testcase( op==OP_IdxGE );  VdbeCoverageIf(v, op==OP_IdxGE );
  1779   1779         testcase( op==OP_IdxLT );  VdbeCoverageIf(v, op==OP_IdxLT );
................................................................................
  1782   1782       if( regBignull ){
  1783   1783         /* During a NULL-scan, check to see if we have reached the end of
  1784   1784         ** the NULLs */
  1785   1785         assert( bSeekPastNull==!bStopAtNull );
  1786   1786         assert( bSeekPastNull+bStopAtNull==1 );
  1787   1787         assert( nConstraint+bSeekPastNull>0 );
  1788   1788         sqlite3VdbeAddOp2(v, OP_If, regBignull, sqlite3VdbeCurrentAddr(v)+2);
  1789         -      VdbeComment((v, "If NULL-scan pending"));
         1789  +      VdbeComment((v, "If NULL-scan 1st pass"));
  1790   1790         VdbeCoverage(v);
  1791   1791         op = aEndOp[bRev*2 + bSeekPastNull];
  1792   1792         sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase,
  1793   1793                              nConstraint+bSeekPastNull);
  1794   1794         testcase( op==OP_IdxGT );  VdbeCoverageIf(v, op==OP_IdxGT );
  1795   1795         testcase( op==OP_IdxGE );  VdbeCoverageIf(v, op==OP_IdxGE );
  1796   1796         testcase( op==OP_IdxLT );  VdbeCoverageIf(v, op==OP_IdxLT );