/ Check-in [23073a05]
Login

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

Overview
Comment:Trivial simplification to the automatic index logic.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:23073a053931de324323f631a6613086786af411
User & Date: drh 2014-10-28 15:58:50
Context
2014-10-28
16:19
Fix a faulty assert() in the DELETE code generator. check-in: 95f8ebdb user: drh tags: trunk
15:58
Trivial simplification to the automatic index logic. check-in: 23073a05 user: drh tags: trunk
12:35
Bump the version number to 3.8.8 check-in: 1a7e711e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  1647   1647     ** columns that are needed by the query.  With a covering index, the
  1648   1648     ** original table never needs to be accessed.  Automatic indices must
  1649   1649     ** be a covering index because the index will not be updated if the
  1650   1650     ** original table changes and the index and table cannot both be used
  1651   1651     ** if they go out of sync.
  1652   1652     */
  1653   1653     extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
  1654         -  mxBitCol = (pTable->nCol >= BMS-1) ? BMS-1 : pTable->nCol;
         1654  +  mxBitCol = MIN(BMS-1,pTable->nCol);
  1655   1655     testcase( pTable->nCol==BMS-1 );
  1656   1656     testcase( pTable->nCol==BMS-2 );
  1657   1657     for(i=0; i<mxBitCol; i++){
  1658   1658       if( extraCols & MASKBIT(i) ) nKeyCol++;
  1659   1659     }
  1660   1660     if( pSrc->colUsed & MASKBIT(BMS-1) ){
  1661   1661       nKeyCol += pTable->nCol - BMS + 1;
  1662   1662     }
  1663         -  pLoop->wsFlags |= WHERE_COLUMN_EQ | WHERE_IDX_ONLY;
  1664   1663   
  1665   1664     /* Construct the Index object to describe this index */
  1666   1665     pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
  1667   1666     if( pIdx==0 ) goto end_auto_index_create;
  1668   1667     pLoop->u.btree.pIndex = pIdx;
  1669   1668     pIdx->zName = "auto-index";
  1670   1669     pIdx->pTable = pTable;