diff options
author | unknown <msvensson@neptunus.(none)> | 2006-09-04 11:45:43 +0200 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2006-09-04 11:45:43 +0200 |
commit | eb0cc3bf8778ca9734c53099a8c30499dcb5a103 (patch) | |
tree | 35ea1bfde5b4b93184a20d2ef76ea38142079cf7 /mysql-test | |
parent | 4cd43a1a4682c8dc6cf88b062fb4ced261511870 (diff) | |
parent | 495edb59bddc9a43242c27106d73ecd18b9d933d (diff) | |
download | mariadb-git-eb0cc3bf8778ca9734c53099a8c30499dcb5a103.tar.gz |
Merge dl145s:/data/tkatchaounov/5.0-bug-21787
into neptunus.(none):/home/msvensson/mysql/mysql-5.0
sql/sql_select.cc:
Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/limit.result | 14 | ||||
-rw-r--r-- | mysql-test/t/limit.test | 10 |
2 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result index 1e38f762dd1..be2776ef533 100644 --- a/mysql-test/r/limit.result +++ b/mysql-test/r/limit.result @@ -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 diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test index 6df865278f6..cf7789428b2 100644 --- a/mysql-test/t/limit.test +++ b/mysql-test/t/limit.test @@ -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 |