1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Make sure LIMITs are handled correctly on UNION operators. Ticket #1035. (CVS 2166)

FossilOrigin-Name: ece0085f86bd715c95a6c59f41b4a97de2555faf
This commit is contained in:
drh
2004-12-16 21:09:16 +00:00
parent 23bf66d6af
commit be5fd4906d
4 changed files with 44 additions and 10 deletions

View File

@ -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