1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Make sure the min() and max() optimizer works correctly when there

is a LIMIT clause.  Ticket #396. (CVS 1057)

FossilOrigin-Name: c35e50717678703763c696e3e9b265add2ca6454
This commit is contained in:
drh
2003-07-19 00:44:14 +00:00
parent 9347b20050
commit e5f50722b4
4 changed files with 64 additions and 20 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.5 2003/04/17 12:44:25 drh Exp $
# $Id: minmax.test,v 1.6 2003/07/19 00:44:15 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -173,5 +173,44 @@ do_test minmax-5.5 {
}
} {999}
# Make sure the min(x) and max(x) optimizations work when there
# is a LIMIT clause. Ticket #396.
#
do_test minmax-6.1 {
execsql {
SELECT min(a) FROM t2 LIMIT 1
}
} {1}
do_test minmax-6.2 {
execsql {
SELECT max(a) FROM t2 LIMIT 3
}
} {22}
do_test minmax-6.3 {
execsql {
SELECT min(a) FROM t2 LIMIT 0,100
}
} {1}
do_test minmax-6.4 {
execsql {
SELECT max(a) FROM t2 LIMIT 1,100
}
} {}
do_test minmax-6.5 {
execsql {
SELECT min(x) FROM t3 LIMIT 1
}
} {{}}
do_test minmax-6.6 {
execsql {
SELECT max(x) FROM t3 LIMIT 0
}
} {}
do_test minmax-6.7 {
execsql {
SELECT max(a) FROM t2 LIMIT 0
}
} {}
finish_test