/ Check-in [e7033104]
Login

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

Overview
Comment:Fix a problem causing ENABLE_CURSOR_HINTS builds to segfault.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:e7033104fa8bd974a9a3d173200aa07a3aa3daade86e7eb65cad5d00b086969e
User & Date: dan 2018-09-11 13:38:35
Context
2018-09-11
19:05
Do not do the byte-by-byte modifications in the resetdb.test script if the reserved-byte flag in the DB header is non-zero, because in that case the bytes will be in the wrong place and the test won't work. check-in: 0af18674 user: drh tags: trunk
13:38
Fix a problem causing ENABLE_CURSOR_HINTS builds to segfault. check-in: e7033104 user: dan tags: trunk
2018-09-10
19:34
Fix a test script issue in fts3ao.test. check-in: 74c381b5 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wherecode.c.

   882    882   static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){
   883    883     int rc = WRC_Continue;
   884    884     struct CCurHint *pHint = pWalker->u.pCCurHint;
   885    885     if( pExpr->op==TK_COLUMN ){
   886    886       if( pExpr->iTable!=pHint->iTabCur ){
   887    887         Vdbe *v = pWalker->pParse->pVdbe;
   888    888         int reg = ++pWalker->pParse->nMem;   /* Register for column value */
   889         -      sqlite3ExprCodeGetColumnOfTable(
   890         -          v, pExpr->pTab, pExpr->iTable, pExpr->iColumn, reg
   891         -      );
          889  +      sqlite3ExprCode(pWalker->pParse, pExpr, reg);
   892    890         pExpr->op = TK_REGISTER;
   893    891         pExpr->iTable = reg;
   894    892       }else if( pHint->pIdx!=0 ){
   895    893         pExpr->iTable = pHint->iIdxCur;
   896    894         pExpr->iColumn = sqlite3ColumnOfIndex(pHint->pIdx, pExpr->iColumn);
   897    895         assert( pExpr->iColumn>=0 );
   898    896       }

Changes to test/cursorhint2.test.

   181    181   }
   182    182     
   183    183   do_extract_hints_test 2.12 {
   184    184     SELECT * FROM x1 LEFT JOIN x2 ON (a=x) WHERE coalesce(x2.b, 1)
   185    185   } {
   186    186     x2 {EQ(c0,r[2])}
   187    187   }
          188  +
          189  +reset_db
          190  +do_execsql_test 3.0 {
          191  +  CREATE TABLE t1 (i1 TEXT);    
          192  +  CREATE TABLE t2 (i2 TEXT UNIQUE);    
          193  +  INSERT INTO t1 VALUES('0');
          194  +  INSERT INTO t2 VALUES('0');
          195  +}
          196  +
          197  +do_extract_hints_test 3.1 {
          198  +  SELECT * FROM t1 CROSS JOIN t2 WHERE (t1.i1 = t2.i2) AND t2.i2 = 1;
          199  +} {
          200  +  t1 {EQ(c0,r[1])} t2 EQ(c0,1)
          201  +}
          202  +
   188    203   
   189    204   finish_test