summaryrefslogtreecommitdiff
path: root/mysql-test/t/having.test
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-03-04 18:39:32 +0300
committerAlexander Nozdrin <alik@sun.com>2010-03-04 18:39:32 +0300
commit9f17a0018f5bfd9c5c6396e6b2f19def4a9b81c9 (patch)
tree4425c646a2f006dadc4de96960c63ed16024713b /mysql-test/t/having.test
parent47aaf9c401a68d6bff8cc869d383d0041b5146d2 (diff)
parent366a68bb460fea577719335efcfac8e14f13a077 (diff)
downloadmariadb-git-9f17a0018f5bfd9c5c6396e6b2f19def4a9b81c9.tar.gz
Auto-merge from mysql-next-mr-bugfixing.
Diffstat (limited to 'mysql-test/t/having.test')
-rw-r--r--mysql-test/t/having.test26
1 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index af9af4fe1fc..185ca4bdddb 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -442,4 +442,30 @@ INSERT INTO t1 VALUES (1, 1), (2,2), (3, NULL);
SELECT b, COUNT(DISTINCT a) FROM t1 GROUP BY b HAVING b is NULL;
DROP TABLE t1;
+
+--echo #
+--echo # Bug#50995 Having clause on subquery result produces incorrect results.
+--echo #
+
+CREATE TABLE t1
+(
+ id1 INT,
+ id2 INT NOT NULL,
+ INDEX id1(id2)
+);
+
+INSERT INTO t1 SET id1=1, id2=1;
+INSERT INTO t1 SET id1=2, id2=1;
+INSERT INTO t1 SET id1=3, id2=1;
+
+SELECT t1.id1,
+(SELECT 0 FROM DUAL
+ WHERE t1.id1=t1.id1) AS amount FROM t1
+WHERE t1.id2 = 1
+HAVING amount > 0
+ORDER BY t1.id1;
+
+DROP TABLE t1;
+
+
--echo End of 5.0 tests