/ Check-in [462f42af]
Login

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

Overview
Comment:Contains a fault. Was: Avoid an unnecessary OP_Move operation for expression subqueries.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mistake
Files: files | file ages | folders
SHA1: 462f42af52f146fd328ddcbbe78c8444ef7bd2c3
User & Date: drh 2014-08-29 12:29:39
Original Comment: Avoid an unnecessary OP_Move operation for expression subqueries.
Context
2014-08-29
14:20
Not a fault after all, rather a testing mistake. Move this change back to trunk. Was: Avoid an unnecessary OP_Move operation for expression subqueries. check-in: 2a74129a user: drh tags: trunk
12:29
Contains a fault. Was: Avoid an unnecessary OP_Move operation for expression subqueries. Closed-Leaf check-in: 462f42af user: drh tags: mistake
2014-08-28
19:38
Improved WHERETRACE messages for the estimated output row reductions from range scans. check-in: fdd478bb user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  1908   1908         assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT );
  1909   1909   
  1910   1910         assert( ExprHasProperty(pExpr, EP_xIsSelect) );
  1911   1911         pSel = pExpr->x.pSelect;
  1912   1912         sqlite3SelectDestInit(&dest, 0, ++pParse->nMem);
  1913   1913         if( pExpr->op==TK_SELECT ){
  1914   1914           dest.eDest = SRT_Mem;
         1915  +        dest.iSdst = dest.iSDParm;
  1915   1916           sqlite3VdbeAddOp2(v, OP_Null, 0, dest.iSDParm);
  1916   1917           VdbeComment((v, "Init subquery result"));
  1917   1918         }else{
  1918   1919           dest.eDest = SRT_Exists;
  1919   1920           sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm);
  1920   1921           VdbeComment((v, "Init EXISTS result"));
  1921   1922         }

Changes to src/select.c.

   825    825       ** of the scan loop.
   826    826       */
   827    827       case SRT_Mem: {
   828    828         assert( nResultCol==1 );
   829    829         if( pSort ){
   830    830           pushOntoSorter(pParse, pSort, p, regResult);
   831    831         }else{
   832         -        sqlite3ExprCodeMove(pParse, regResult, iParm, 1);
          832  +        assert( regResult==iParm );
   833    833           /* The LIMIT clause will jump out of the loop for us */
   834    834         }
   835    835         break;
   836    836       }
   837    837   #endif /* #ifndef SQLITE_OMIT_SUBQUERY */
   838    838   
   839    839       case SRT_Coroutine:       /* Send data to a co-routine */