SQLite

Check-in [76fe68cff6]
Login

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

Overview
Comment:Honor the ORDER BY clause in a subquery that is the right-hand side of an IN operator. Ticket #827. (CVS 1871)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 76fe68cff6ce75dada510544b063dc1069eb2e0e
User & Date: drh 2004-07-26 23:32:27.000
Context
2004-07-27
13:38
Additional test case to cover ticket #831. (CVS 1872) (check-in: a62129af99 user: drh tags: trunk)
2004-07-26
23:32
Honor the ORDER BY clause in a subquery that is the right-hand side of an IN operator. Ticket #827. (CVS 1871) (check-in: 76fe68cff6 user: drh tags: trunk)
23:07
Get VACUUM working with UNIQUE indices. Ticket #829. (CVS 1870) (check-in: 88a19a4386 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/select.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.201 2004/07/20 01:45:20 drh Exp $
*/
#include "sqliteInt.h"


/*
** Allocate a new Select structure and return a pointer to that
** structure.







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.202 2004/07/26 23:32:27 drh Exp $
*/
#include "sqliteInt.h"


/*
** Allocate a new Select structure and return a pointer to that
** structure.
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252

  /* ORDER BY is ignored for some destinations.
  */
  switch( eDest ){
    case SRT_Union:
    case SRT_Except:
    case SRT_Discard:
    case SRT_Set:
      pOrderBy = 0;
      break;
    default:
      break;
  }

  /* At this point, we should have allocated all the cursors that we







<







2238
2239
2240
2241
2242
2243
2244

2245
2246
2247
2248
2249
2250
2251

  /* ORDER BY is ignored for some destinations.
  */
  switch( eDest ){
    case SRT_Union:
    case SRT_Except:
    case SRT_Discard:

      pOrderBy = 0;
      break;
    default:
      break;
  }

  /* At this point, we should have allocated all the cursors that we
Changes to test/subselect.test.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing SELECT statements that are part of
# expressions.
#
# $Id: subselect.test,v 1.8 2004/07/20 00:20:23 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Basic sanity checking.  Try a simple subselect.
#
do_test subselect-1.1 {







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing SELECT statements that are part of
# expressions.
#
# $Id: subselect.test,v 1.9 2004/07/26 23:32:27 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Basic sanity checking.  Try a simple subselect.
#
do_test subselect-1.1 {
144
145
146
147
148
149
150






151
152
153
    SELECT (SELECT x FROM t3 ORDER BY x LIMIT 1 OFFSET 2);
  }
} {3}
do_test subselect-3.9 {
  execsql {
    SELECT (SELECT x FROM t3 ORDER BY x DESC LIMIT 1 OFFSET 2);
  }






} {4}

finish_test







>
>
>
>
>
>



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
    SELECT (SELECT x FROM t3 ORDER BY x LIMIT 1 OFFSET 2);
  }
} {3}
do_test subselect-3.9 {
  execsql {
    SELECT (SELECT x FROM t3 ORDER BY x DESC LIMIT 1 OFFSET 2);
  }
} {4}
do_test subselect-3.10 {
  execsql {
    SELECT x FROM t3 WHERE x IN
       (SELECT x FROM t3 ORDER BY x DESC LIMIT 1 OFFSET 2);
  }
} {4}

finish_test