/ Check-in [7f3ef7dd]
Login

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

Overview
Comment:Get LIMIT 0 working on subqueries. Ticket #1784. (CVS 3177)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7f3ef7ddba22d69a23e656836ba76738c9652b4d
User & Date: drh 2006-04-26 17:39:34
Context
2006-05-03
23:34
Faster :memory: database COMMITs. Ticket #1790. (CVS 3178) check-in: 8f820e43 user: drh tags: trunk
2006-04-26
17:39
Get LIMIT 0 working on subqueries. Ticket #1784. (CVS 3177) check-in: 7f3ef7dd user: drh tags: trunk
2006-04-21
09:38
Additional information about index sorting in EXPLAIN QUERY PLAN. (CVS 3176) check-in: 39dd9695 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains C code routines that are called by the parser
    13     13   ** to handle SELECT statements in SQLite.
    14     14   **
    15         -** $Id: select.c,v 1.312 2006/04/11 14:16:21 drh Exp $
           15  +** $Id: select.c,v 1.313 2006/04/26 17:39:34 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   
    20     20   /*
    21     21   ** Delete all the content of a Select structure but do not deallocate
    22     22   ** the select structure itself.
................................................................................
  2928   2928       p->addrOpenVirt[2] = addrSortIndex =
  2929   2929          sqlite3VdbeOp3(v, OP_OpenVirtual, pOrderBy->iECursor, pOrderBy->nExpr+2, 
  2930   2930                           (char*)pKeyInfo, P3_KEYINFO_HANDOFF);
  2931   2931     }else{
  2932   2932       addrSortIndex = -1;
  2933   2933     }
  2934   2934   
  2935         -  /* Set the limiter.
  2936         -  */
  2937         -  iEnd = sqlite3VdbeMakeLabel(v);
  2938         -  computeLimitRegisters(pParse, p, iEnd);
  2939         -
  2940   2935     /* If the output is destined for a temporary table, open that table.
  2941   2936     */
  2942   2937     if( eDest==SRT_VirtualTab ){
  2943   2938       sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, pEList->nExpr);
  2944   2939     }
  2945   2940   
         2941  +  /* Set the limiter.
         2942  +  */
         2943  +  iEnd = sqlite3VdbeMakeLabel(v);
         2944  +  computeLimitRegisters(pParse, p, iEnd);
         2945  +
  2946   2946     /* Open a virtual index to use for the distinct set.
  2947   2947     */
  2948   2948     if( isDistinct ){
  2949   2949       KeyInfo *pKeyInfo;
  2950   2950       distinct = pParse->nTab++;
  2951   2951       pKeyInfo = keyInfoFromExprList(pParse, p->pEList);
  2952   2952       sqlite3VdbeOp3(v, OP_OpenVirtual, distinct, 0, 

Changes to test/limit.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the LIMIT ... OFFSET ... clause
    13     13   #  of SELECT statements.
    14     14   #
    15         -# $Id: limit.test,v 1.28 2006/03/03 19:12:30 drh Exp $
           15  +# $Id: limit.test,v 1.29 2006/04/26 17:39:34 drh Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # Build some test data
    21     21   #
    22     22   execsql {
................................................................................
   432    432     set limit "hello world"
   433    433     set rc [catch {
   434    434     db eval {
   435    435       SELECT x FROM t1 WHERE x<10 LIMIT :limit;
   436    436     } } msg]
   437    437     list $rc $msg
   438    438   } {1 {datatype mismatch}}
          439  +
          440  +do_test limit-11.1 {
          441  +  db eval {
          442  +     SELECT x FROM (SELECT x FROM t1 ORDER BY x LIMIT 0) ORDER BY x
          443  +  }
          444  +} {}
   439    445   
   440    446   finish_test