diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2014-03-07 13:14:58 +0100 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2014-03-07 13:14:58 +0100 |
commit | 5ba109c4f6c180deef8e5d21c86fbf6b5d23e32f (patch) | |
tree | 5f8c75a9adf7f577c4bf136113fb41b90310523a /mysql-test/t/select.test | |
parent | f20cab1a8397c3ec4baeadb33c29e466ac977b59 (diff) | |
download | mariadb-git-5ba109c4f6c180deef8e5d21c86fbf6b5d23e32f.tar.gz |
Bug#45227: Lost HAVING clause led to a wrong result.
- Backport testcase from mysql-5.6
Diffstat (limited to 'mysql-test/t/select.test')
-rw-r--r-- | mysql-test/t/select.test | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 1174ab535ba..7134a5c16cf 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4363,6 +4363,30 @@ DROP TABLE t1,t2,t_empty; --echo End of 5.1 tests +--echo # +--echo # Bug#45227: Lost HAVING clause led to a wrong result. +--echo # +CREATE TABLE `CC` ( + `int_nokey` int(11) NOT NULL, + `int_key` int(11) NOT NULL, + `varchar_key` varchar(1) NOT NULL, + `varchar_nokey` varchar(1) NOT NULL, + KEY `int_key` (`int_key`), + KEY `varchar_key` (`varchar_key`) +); +INSERT INTO `CC` VALUES +(0,8,'q','q'),(5,8,'m','m'),(7,3,'j','j'),(1,2,'z','z'),(8,2,'a','a'),(2,6,'',''),(1,8,'e' +,'e'),(8,9,'t','t'),(5,2,'q','q'),(4,6,'b','b'),(5,5,'w','w'),(3,2,'m','m'),(0,4,'x','x'), +(8,9,'',''),(0,6,'w','w'),(4,5,'x','x'),(0,0,'e','e'),(0,0,'e','e'),(2,8,'p','p'),(0,0,'x' +,'x'); +EXPLAIN SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 + HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; + +SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 + HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; + +DROP TABLE CC; +--echo # End of test#45227 --echo # --echo # BUG#776274: substitution of a single row table --echo # |