summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_group.result11
-rw-r--r--mysql-test/t/func_group.test12
2 files changed, 21 insertions, 2 deletions
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 8e50c045775..8e2bdeae93c 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1458,6 +1458,8 @@ DROP TABLE derived1;
DROP TABLE D;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (3),(4);
SET SQL_MODE='ONLY_FULL_GROUP_BY';
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -1473,12 +1475,19 @@ COUNT(*)
SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
FROM t1 outr;
ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
+SELECT COUNT(*) FROM t1 outr, (SELECT b, count(*) FROM t2) as t3;
+ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
+SELECT COUNT(*) FROM t1 outr where (1,1) in (SELECT a, count(*) FROM t2);
+COUNT(*)
+0
SELECT COUNT(*) FROM t1 a JOIN t1 outr
ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
COUNT(*)
0
+SELECT * FROM (SELECT a FROM t1 GROUP BY a) sq JOIN t2 ON a = b;
+a b
SET SQL_MODE=default;
-DROP TABLE t1;
+DROP TABLE t1,t2;
End of 5.0 tests
#
# BUG#47280 - strange results from count(*) with order by multiple
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index cf5f00c3ee1..363f089e8d7 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -981,10 +981,13 @@ DROP TABLE D;
#
# Bug #39656: Behaviour different for agg functions with & without where -
# ONLY_FULL_GROUP_BY
+# MDEV-5617 mysqld crashes when running a query with ONLY_FULL_GROUP_BY
#
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (3),(4);
SET SQL_MODE='ONLY_FULL_GROUP_BY';
@@ -1000,11 +1003,18 @@ SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
FROM t1 outr;
+--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
+SELECT COUNT(*) FROM t1 outr, (SELECT b, count(*) FROM t2) as t3;
+
+SELECT COUNT(*) FROM t1 outr where (1,1) in (SELECT a, count(*) FROM t2);
+
SELECT COUNT(*) FROM t1 a JOIN t1 outr
ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
+SELECT * FROM (SELECT a FROM t1 GROUP BY a) sq JOIN t2 ON a = b;
+
SET SQL_MODE=default;
-DROP TABLE t1;
+DROP TABLE t1,t2;
###