mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge timka@10.100.64.80:/home/timka/mysql/src/4.1-bug-21787
into dl145s.mysql.com:/data/tkatchaounov/5.0-bug-21787 mysql-test/r/limit.result: Auto merged mysql-test/t/limit.test: Auto merged sql/sql_select.cc: Adjust the fix for BUG#21787 for 5.0
This commit is contained in:
@ -76,3 +76,17 @@ a
|
||||
a
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
|
||||
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
c
|
||||
7
|
||||
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
|
||||
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
c
|
||||
28
|
||||
|
@ -60,4 +60,14 @@ select 1 as a from t1 union all select 1 from dual limit 1;
|
||||
(select 1 as a from t1) union all (select 1 from dual) limit 1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #21787: COUNT(*) + ORDER BY + LIMIT returns wrong result
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
Reference in New Issue
Block a user