summaryrefslogtreecommitdiff
path: root/mysql-test/t/having.test
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-05-09 12:35:11 +0200
committerSergei Golubchik <sergii@pisem.net>2014-05-09 12:35:11 +0200
commitd3e2e1243bb0dae95ce35b0380dd4f8f476b254d (patch)
tree8779ad6b2059f181770cc07e2437925d7d5d5d04 /mysql-test/t/having.test
parent229dad1f9b12f8e9f64b6a605bdf8e31c339d018 (diff)
parent124428a9e28e59f98b25d8ee07b57d264f63cbe4 (diff)
downloadmariadb-git-d3e2e1243bb0dae95ce35b0380dd4f8f476b254d.tar.gz
5.5 merge
Diffstat (limited to 'mysql-test/t/having.test')
-rw-r--r--mysql-test/t/having.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index 78f6ff4a880..cd6a4c9d328 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -659,6 +659,41 @@ drop table t1,t2,t3;
--echo End of 5.2 tests
--echo #
+--echo # Bug mdev-6116: an equality in the conjunction of HAVING
+--echo # and IN subquery in WHERE
+--echo # (The bug is caused by the same problem as bug mdev-5927)
+--echo #
+
+CREATE TABLE t1 (f_key varchar(1), f_nokey varchar(1), INDEX(f_key));
+INSERT INTO t1 VALUES ('v','v'),('s','s');
+
+CREATE TABLE t2 (f_int int, f_key varchar(1), INDEX(f_key));
+INSERT INTO t2 VALUES
+(4,'j'),(6,'v'),(3,'c'),(5,'m'),(3,'d'),(2,'d'),(2,'y'),
+(9,'t'),(3,'d'),(8,'s'),(1,'r'),(8,'m'),(8,'b'),(5,'x');
+
+SELECT t2.f_int FROM t1 INNER JOIN t2 ON (t2.f_key = t1.f_nokey)
+WHERE t1.f_nokey IN (
+ SELECT t1.f_key FROM t1, t2 WHERE t1.f_key = t2.f_key
+) HAVING t2.f_int >= 0 AND t2.f_int != 0;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug mdev-5927: an equality in the conjunction of HAVING
+--echo # and an equality in WHERE
+--echo #
+
+CREATE TABLE t1 (pk int PRIMARY KEY, f int NOT NULL, INDEX(f));
+INSERT INTO t1 VALUES (1,0), (2,8);
+
+SELECT * FROM t1 WHERE f = 2 HAVING ( pk IN ( SELECT 9 ) AND f != 0 );
+
+DROP TABLE t1;
+
+--echo End of 5.3 tests
+
+--echo #
--echo # Bug mdev-5160: two-way join with HAVING over the second table
--echo #
@@ -673,3 +708,4 @@ SELECT * FROM t1 JOIN t2 ON c1 = c2 HAVING c2 > 'a' ORDER BY c2 LIMIT 1;
DROP TABLE t1,t2;
--echo End of 10.0 tests
+