/ Check-in [2041231d]
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:Fix comments that were made obsolete by the removal of the column cache.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | omit-column-cache
Files: files | file ages | folders
SHA3-256: 2041231d56c7b02b785015ef4d1af260d61326eab1b2a304c17faa3e33f76441
User & Date: drh 2018-08-04 17:15:56
Context
2018-08-04
20:12
Remove a testcase() that is no longer reachable without the column cache. Provide an assert() to help prove that the testcase is no longer reachable. Closed-Leaf check-in: a500893b user: drh tags: omit-column-cache
17:15
Fix comments that were made obsolete by the removal of the column cache. check-in: 2041231d user: drh tags: omit-column-cache
16:54
Remove more column-cache residue: The OP_SetColTab and OP_VerifyColTab opcodes and the associated SQLITE_DEBUG_COLUMNCACHE logic. check-in: 80236e81 user: drh tags: omit-column-cache
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  3258   3258       sqlite3VdbeChangeP5(v, p5);
  3259   3259     }
  3260   3260     return iReg;
  3261   3261   }
  3262   3262   
  3263   3263   /*
  3264   3264   ** Generate code to move content from registers iFrom...iFrom+nReg-1
  3265         -** over to iTo..iTo+nReg-1. Keep the column cache up-to-date.
         3265  +** over to iTo..iTo+nReg-1.
  3266   3266   */
  3267   3267   void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){
  3268   3268     assert( iFrom>=iTo+nReg || iFrom+nReg<=iTo );
  3269   3269     sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg);
  3270   3270   }
  3271   3271   
  3272   3272   /*
................................................................................
  5248   5248     }
  5249   5249     return pParse->aTempReg[--pParse->nTempReg];
  5250   5250   }
  5251   5251   
  5252   5252   /*
  5253   5253   ** Deallocate a register, making available for reuse for some other
  5254   5254   ** purpose.
  5255         -**
  5256         -** If a register is currently being used by the column cache, then
  5257         -** the deallocation is deferred until the column cache line that uses
  5258         -** the register becomes stale.
  5259   5255   */
  5260   5256   void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
  5261   5257     if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
  5262   5258       pParse->aTempReg[pParse->nTempReg++] = iReg;
  5263   5259     }
  5264   5260   }
  5265   5261   

Changes to src/select.c.

  5330   5330       sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF);
  5331   5331       sqlite3VdbeChangeP5(v, (u8)nArg);
  5332   5332       sqlite3ReleaseTempRange(pParse, regAgg, nArg);
  5333   5333       if( addrNext ){
  5334   5334         sqlite3VdbeResolveLabel(v, addrNext);
  5335   5335       }
  5336   5336     }
  5337         -
  5338         -  /* Before populating the accumulator registers, clear the column cache.
  5339         -  ** Otherwise, if any of the required column values are already present 
  5340         -  ** in registers, sqlite3ExprCode() may use OP_SCopy to copy the value
  5341         -  ** to pC->iMem. But by the time the value is used, the original register
  5342         -  ** may have been used, invalidating the underlying buffer holding the
  5343         -  ** text or blob value. See ticket [883034dcb5].
  5344         -  **
  5345         -  ** Another solution would be to change the OP_SCopy used to copy cached
  5346         -  ** values to an OP_Copy.
  5347         -  */
  5348   5337     if( regHit==0 && pAggInfo->nAccumulator ){
  5349   5338       regHit = regAcc;
  5350   5339     }
  5351   5340     if( regHit ){
  5352   5341       addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit); VdbeCoverage(v);
  5353   5342     }
  5354   5343     for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){

Changes to src/sqliteInt.h.

  1554   1554   
  1555   1555   /*
  1556   1556   ** Bits of the sqlite3.dbOptFlags field that are used by the
  1557   1557   ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
  1558   1558   ** selectively disable various optimizations.
  1559   1559   */
  1560   1560   #define SQLITE_QueryFlattener 0x0001   /* Query flattening */
  1561         -#define SQLITE_ColumnCache    0x0002   /* Column cache */
         1561  +                          /*  0x0002   available for reuse */
  1562   1562   #define SQLITE_GroupByOrder   0x0004   /* GROUPBY cover of ORDERBY */
  1563   1563   #define SQLITE_FactorOutConst 0x0008   /* Constant factoring */
  1564   1564   #define SQLITE_DistinctOpt    0x0010   /* DISTINCT using indexes */
  1565   1565   #define SQLITE_CoverIdxScan   0x0020   /* Covering index scans */
  1566   1566   #define SQLITE_OrderByIdxJoin 0x0040   /* ORDER BY of joins via index */
  1567   1567   #define SQLITE_Transitive     0x0080   /* Transitive constraints */
  1568   1568   #define SQLITE_OmitNoopJoin   0x0100   /* Omit unused tables in joins */
................................................................................
  2953   2953   struct AutoincInfo {
  2954   2954     AutoincInfo *pNext;   /* Next info block in a list of them all */
  2955   2955     Table *pTab;          /* Table this info block refers to */
  2956   2956     int iDb;              /* Index in sqlite3.aDb[] of database holding pTab */
  2957   2957     int regCtr;           /* Memory register holding the rowid counter */
  2958   2958   };
  2959   2959   
  2960         -/*
  2961         -** Size of the column cache
  2962         -*/
  2963         -#ifndef SQLITE_N_COLCACHE
  2964         -# define SQLITE_N_COLCACHE 10
  2965         -#endif
  2966         -
  2967   2960   /*
  2968   2961   ** At least one instance of the following structure is created for each
  2969   2962   ** trigger that may be fired while parsing an INSERT, UPDATE or DELETE
  2970   2963   ** statement. All such objects are stored in the linked list headed at
  2971   2964   ** Parse.pTriggerPrg and deleted once statement compilation has been
  2972   2965   ** completed.
  2973   2966   **

Changes to src/test1.c.

  6978   6978     static const struct {
  6979   6979       const char *zOptName;
  6980   6980       int mask;
  6981   6981     } aOpt[] = {
  6982   6982       { "all",                 SQLITE_AllOpts        },
  6983   6983       { "none",                0                     },
  6984   6984       { "query-flattener",     SQLITE_QueryFlattener },
  6985         -    { "column-cache",        SQLITE_ColumnCache    },
  6986   6985       { "groupby-order",       SQLITE_GroupByOrder   },
  6987   6986       { "factor-constants",    SQLITE_FactorOutConst },
  6988   6987       { "distinct-opt",        SQLITE_DistinctOpt    },
  6989   6988       { "cover-idx-scan",      SQLITE_CoverIdxScan   },
  6990   6989       { "order-by-idx-join",   SQLITE_OrderByIdxJoin },
  6991   6990       { "transitive",          SQLITE_Transitive     },
  6992   6991       { "omit-noop-join",      SQLITE_OmitNoopJoin   },