1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Make sure min() and max() optimizations work for subqueries. Ticket #587. (CVS 1201)

FossilOrigin-Name: af73fbca839f8cbe39c21f1f9e439fe9b79005c8
This commit is contained in:
drh
2004-01-30 02:01:03 +00:00
parent e8a63423da
commit 0c37e6309b
4 changed files with 40 additions and 10 deletions

View File

@ -13,7 +13,7 @@
# aggregate min() and max() functions and which are handled as
# as a special case.
#
# $Id: minmax.test,v 1.6 2003/07/19 00:44:15 drh Exp $
# $Id: minmax.test,v 1.7 2004/01/30 02:01:05 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -212,5 +212,29 @@ do_test minmax-6.7 {
}
} {}
# Make sure the max(x) and min(x) optimizations work for nested
# queries. Ticket #587.
#
do_test minmax-7.1 {
execsql {
SELECT max(x) FROM t1;
}
} 20
do_test minmax-7.2 {
execsql {
SELECT * FROM (SELECT max(x) FROM t1);
}
} 20
do_test minmax-7.3 {
execsql {
SELECT min(x) FROM t1;
}
} 1
do_test minmax-7.4 {
execsql {
SELECT * FROM (SELECT min(x) FROM t1);
}
} 1
finish_test