mirror of
https://github.com/sqlite/sqlite.git
synced 2025-12-24 14:17:58 +03:00
Fix a problem with LIMIT and OFFSET clauses on the parent query when optimizing a UNION ALL sub-select. (CVS 5332)
FossilOrigin-Name: a79786a961dba8f4ffaddbe55e6467c14b12f7d6
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
# $Id: select9.test,v 1.3 2008/06/30 07:53:10 danielk1977 Exp $
|
||||
# $Id: select9.test,v 1.4 2008/07/01 14:39:35 danielk1977 Exp $
|
||||
|
||||
# The tests in this file are focused on test compound SELECT statements
|
||||
# that have any or all of an ORDER BY, LIMIT or OFFSET clauses. As of
|
||||
@@ -360,7 +360,7 @@ proc cksort {sql} {
|
||||
# CREATE VIEW v1 AS SELECT a FROM t1 UNION ALL SELECT d FROM t2
|
||||
# SELECT a FROM v1 ORDER BY 1
|
||||
#
|
||||
# Currently it is not.
|
||||
# It turns out that it is.
|
||||
#
|
||||
do_test select9-3.1 {
|
||||
cksort { SELECT a FROM t1 ORDER BY 1 }
|
||||
@@ -379,7 +379,7 @@ do_test select9-3.4 {
|
||||
do_test select9-3.5 {
|
||||
execsql { CREATE VIEW v1 AS SELECT a FROM t1 UNION ALL SELECT d FROM t2 }
|
||||
cksort { SELECT a FROM v1 ORDER BY 1 LIMIT 5 }
|
||||
} {1 1 2 2 3 sort}
|
||||
} {1 1 2 2 3 nosort}
|
||||
do_test select9-3.X {
|
||||
execsql {
|
||||
DROP INDEX i1;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
# $Id: selectB.test,v 1.1 2008/07/01 14:09:14 danielk1977 Exp $
|
||||
# $Id: selectB.test,v 1.2 2008/07/01 14:39:35 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -93,6 +93,19 @@ test_transform selectB-1.6 {
|
||||
ORDER BY a
|
||||
} {14 21}
|
||||
|
||||
test_transform selectB-1.7 {
|
||||
SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2) ORDER BY 1 LIMIT 2
|
||||
} {
|
||||
SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY 1 LIMIT 2
|
||||
} {2 3}
|
||||
|
||||
test_transform selectB-1.8 {
|
||||
SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2) ORDER BY 1
|
||||
LIMIT 2 OFFSET 3
|
||||
} {
|
||||
SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY 1 LIMIT 2 OFFSET 3
|
||||
} {12 14}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
Reference in New Issue
Block a user