diff --git a/manifest b/manifest index ef1496c676..e375985642 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Minor\scode\sand\scomment\scleanup.\s(CVS\s2165) -D 2004-12-14T03:34:34 +C Make\ssure\sLIMITs\sare\shandled\scorrectly\son\sUNION\soperators.\s\sTicket\s#1035.\s(CVS\s2166) +D 2004-12-16T21:09:17 F Makefile.in da09f379b80c8cd78d78abaa0f32ca90a124e884 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 @@ -59,7 +59,7 @@ F src/parse.y ceba179b9703657180963568f54b0e75f33e36e1 F src/pragma.c d6406e12c9eac353b3a026b50d41e4fd561afcc2 F src/printf.c 3d20b21cfecadacecac3fb7274e746cb81d3d357 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 -F src/select.c 36cc9da999596578566e167d310e99f2005a7f03 +F src/select.c ac6610b4b2c5bd5ffc46536b760dacc420119dac F src/shell.c e8f4f486cbf6e60d81173146ac8a6522c930fa51 F src/sqlite.h.in fa75850f412808afd38fddc1fd6456f4efc6fb97 F src/sqliteInt.h e0c5c1af95e975645c7a09b151af258d6fca1c53 @@ -141,7 +141,7 @@ F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3 F test/join4.test 8dec387d06b3a4685e1104048065cf5236b99b93 F test/lastinsert.test b6a1db3e1ce2d3f0d6afe99d445084f543b6feaa F test/laststmtchanges.test 07cbdabc52407c29e40abc25050f2434f044a6b1 -F test/limit.test c7bddad249631ad068fbbd0ab926e04ba7e3b9a2 +F test/limit.test 0225cadf96f199566b6d1ae7b5642492878ec45a F test/lock.test 32fe28e5030f25f23bcf6beef440675b0d848413 F test/lock2.test 59c3dd7d9b24d1bf7ec91b2d1541c37e97939d5f F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9 @@ -263,7 +263,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25 F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c -P 7f38f67c7b427ea46db2e95fdfadc1aae064c704 -R 0372084bee24d5ee507746e9b7def4a4 +P d012628a78edaa8d3cb438a7dcc3770b2eb8588b +R bd08228a6f97570ef1438e0425471e15 U drh -Z 08a84bfe20c08dc8299c4719dba55eae +Z fcfd946d19b12e062ea66108631d01be diff --git a/manifest.uuid b/manifest.uuid index 03c1b72c3c..30254276c7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d012628a78edaa8d3cb438a7dcc3770b2eb8588b \ No newline at end of file +ece0085f86bd715c95a6c59f41b4a97de2555faf \ No newline at end of file diff --git a/src/select.c b/src/select.c index d16f43d233..a2a4d5e342 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.217 2004/11/23 01:47:30 drh Exp $ +** $Id: select.c,v 1.218 2004/12/16 21:09:17 drh Exp $ */ #include "sqliteInt.h" @@ -1504,6 +1504,8 @@ static int multiSelect( p->pOrderBy = pOrderBy; p->nLimit = nLimit; p->nOffset = nOffset; + p->iLimit = -1; + p->iOffset = -1; if( rc ){ goto multi_select_end; } diff --git a/test/limit.test b/test/limit.test index 3292497ec2..870d15eff3 100644 --- a/test/limit.test +++ b/test/limit.test @@ -12,7 +12,7 @@ # focus of this file is testing the LIMIT ... OFFSET ... clause # of SELECT statements. # -# $Id: limit.test,v 1.18 2004/11/22 13:35:42 danielk1977 Exp $ +# $Id: limit.test,v 1.19 2004/12/16 21:09:18 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -317,4 +317,36 @@ do_test limit-8.3 { } } {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