/ Check-in [2a74129a]
Login

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

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:2a74129a21f9745f1363f844807e2d10201a3f40
User & Date: drh 2014-08-29 14:20:46
Original Comment: Note a fault after all, rather a testing mistake. Move this change back to trunk. Was: Avoid an unnecessary OP_Move operation for expression subqueries.
References
2016-01-13
15:00 New ticket [cb3aa064] Incorrect result from a subquery containing over-constrainted ORDER BY. artifact: ac020a73 user: drh
Context
2016-01-13
17:50
When the block sorting optimization is used in a scalar subquery, be sure to exit the loop as soon as the first valid output row is received. Fix for ticket [cb3aa0641d9a4]. check-in: cdbb0947 user: drh tags: trunk
2014-08-30
15:49
In the command-line shell, added options --lookaside, --pagecache, and --scratch used to configure auxiliary memories. check-in: f61db04b user: drh tags: trunk
2014-08-29
14:40
Merge recent performance enhancements from trunk onto the threads branch. check-in: 35c44a3c user: drh tags: threads
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 */