Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Make sure LIMITs are handled correctly on UNION operators. Ticket #1035. (CVS 2166) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ece0085f86bd715c95a6c59f41b4a97d |
User & Date: | drh 2004-12-16 21:09:17.000 |
Context
2004-12-17
| ||
15:41 | Add 'copy' method for tcl interface. Behaves similar to shell .import or COPY statment in 2.x. (CVS 2167) (check-in: a9311d9df0 user: tpoindex tags: trunk) | |
2004-12-16
| ||
21:09 | Make sure LIMITs are handled correctly on UNION operators. Ticket #1035. (CVS 2166) (check-in: ece0085f86 user: drh tags: trunk) | |
2004-12-14
| ||
03:34 | Minor code and comment cleanup. (CVS 2165) (check-in: d012628a78 user: drh tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** 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. ** | | | 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.218 2004/12/16 21:09:17 drh Exp $ */ #include "sqliteInt.h" /* ** Allocate a new Select structure and return a pointer to that ** structure. |
︙ | ︙ | |||
1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 | nOffset = p->nOffset; p->nOffset = 0; rc = sqlite3Select(pParse, p, op, unionTab, 0, 0, 0, aff); p->pPrior = pPrior; p->pOrderBy = pOrderBy; p->nLimit = nLimit; p->nOffset = nOffset; if( rc ){ goto multi_select_end; } /* Convert the data in the temporary table into whatever form ** it is that we currently need. | > > | 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 | nOffset = p->nOffset; p->nOffset = 0; rc = sqlite3Select(pParse, p, op, unionTab, 0, 0, 0, aff); p->pPrior = pPrior; p->pOrderBy = pOrderBy; p->nLimit = nLimit; p->nOffset = nOffset; p->iLimit = -1; p->iOffset = -1; if( rc ){ goto multi_select_end; } /* Convert the data in the temporary table into whatever form ** it is that we currently need. |
︙ | ︙ |
Changes to test/limit.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # 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 the LIMIT ... OFFSET ... clause # of SELECT statements. # | | | 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 the LIMIT ... OFFSET ... clause # of SELECT statements. # # $Id: limit.test,v 1.19 2004/12/16 21:09:18 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Build some test data # execsql { |
︙ | ︙ | |||
312 313 314 315 316 317 318 319 320 | } } {5 6 7 8 9} do_test limit-8.3 { execsql { SELECT DISTINCT round(x/100) FROM t3 LIMIT 5 OFFSET 25; } } {25 26 27 28 29} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | } } {5 6 7 8 9} do_test limit-8.3 { execsql { SELECT DISTINCT round(x/100) FROM t3 LIMIT 5 OFFSET 25; } } {25 26 27 28 29} # Make sure limits on multiple subqueries work correctly. # Ticket #1035 # do_test limit-9.1 { execsql { SELECT * FROM (SELECT * FROM t6 LIMIT 3); } } {1 2 3} do_test limit-9.2 { execsql { CREATE TABLE t7 AS SELECT * FROM t6; SELECT * FROM (SELECT * FROM t7 LIMIT 3); } } {1 2 3} do_test limit-9.3 { execsql { SELECT * FROM (SELECT * FROM t6 LIMIT 3) UNION SELECT * FROM (SELECT * FROM t7 LIMIT 3) ORDER BY 1 } } {1 2 3} do_test limit-9.4 { execsql { SELECT * FROM (SELECT * FROM t6 LIMIT 3) UNION SELECT * FROM (SELECT * FROM t7 LIMIT 3) ORDER BY 1 LIMIT 2 } } {1 2} finish_test |