/ Check-in [25f34cb9]
Login

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

Overview
Comment:Fix a crash that can occur with a skip-scan on an index with expressions when SQLITE_ENABLE_EXPLAIN_COMMENTS is defined.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 25f34cb9b576a2d4250a06a7dbf88010b1c11675
User & Date: drh 2015-09-18 18:09:28
Context
2015-09-19
03:07
Do not allow rowid in a UNIQUE or PRIMARY KEY constraint. (This restores the same behavior exhibited by all prior releases.) check-in: b1278301 user: drh tags: trunk
2015-09-18
18:09
Fix a crash that can occur with a skip-scan on an index with expressions when SQLITE_ENABLE_EXPLAIN_COMMENTS is defined. check-in: 25f34cb9 user: drh tags: trunk
15:38
Adjustments to the spellfix2.test module so that it works reliably on windows. check-in: 09a313fb user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wherecode.c.

   510    510       pLevel->addrSkip = sqlite3VdbeAddOp4Int(v, (bRev?OP_SeekLT:OP_SeekGT),
   511    511                               iIdxCur, 0, regBase, nSkip);
   512    512       VdbeCoverageIf(v, bRev==0);
   513    513       VdbeCoverageIf(v, bRev!=0);
   514    514       sqlite3VdbeJumpHere(v, j);
   515    515       for(j=0; j<nSkip; j++){
   516    516         sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, j, regBase+j);
   517         -      assert( pIdx->aiColumn[j]>=0 );
   518         -      VdbeComment((v, "%s", pIdx->pTable->aCol[pIdx->aiColumn[j]].zName));
          517  +      testcase( pIdx->aiColumn[j]==(-2) );
          518  +      VdbeComment((v, "%s", explainIndexColumnName(pIdx, j)));
   519    519       }
   520    520     }    
   521    521   
   522    522     /* Evaluate the equality constraints
   523    523     */
   524    524     assert( zAff==0 || (int)strlen(zAff)>=nEq );
   525    525     for(j=nSkip; j<nEq; j++){

Changes to test/indexexpr1.test.

   213    213     -- test and the next, verify that "k" can be used by the t5ax index
   214    214     SELECT substr(a,4,3) AS k FROM cnt, t5 WHERE k=printf('%03d',x);
   215    215   } {001 002 003 004 005}
   216    216   do_execsql_test indexexpr1-510eqp {
   217    217     EXPLAIN QUERY PLAN
   218    218     SELECT substr(a,4,3) AS k FROM cnt, t5 WHERE k=printf('%03d',x);
   219    219   } {/USING INDEX t5ax/}
          220  +
          221  +# Skip-scan on an indexed expression
          222  +#
          223  +do_execsql_test indexexpr1-600 {
          224  +  DROP TABLE IF EXISTS t4;
          225  +  CREATE TABLE t4(a,b,c,d,e,f,g,h,i);
          226  +  CREATE INDEX t4all ON t4(a,b,c<d,e,f,i,h);
          227  +  INSERT INTO t4 VALUES(1,2,3,4,5,6,7,8,9);
          228  +  ANALYZE;
          229  +  DELETE FROM sqlite_stat1;
          230  +  INSERT INTO sqlite_stat1
          231  +    VALUES('t4','t4all','600000 160000 40000 10000 2000 600 100 40 10');
          232  +  ANALYZE sqlite_master;
          233  +  SELECT i FROM t4 WHERE e=5;
          234  +} {9}
          235  +
          236  +
   220    237   
   221    238   
   222    239   finish_test