summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_group.test
diff options
context:
space:
mode:
authorGeorgi Kodinov <kgeorge@mysql.com>2008-11-24 18:00:09 +0200
committerGeorgi Kodinov <kgeorge@mysql.com>2008-11-24 18:00:09 +0200
commitf31d305238d1f6c51ca03b23b119d602c149c75d (patch)
treeeab163c66942e3ede5ce1b97429ead8b9bbea8fc /mysql-test/t/func_group.test
parent3374afe8b0c1d4a5a92c43eaf71c76bc481f42f7 (diff)
parentc9be1c9f88dac50e75d4b51399c01986f23c4642 (diff)
downloadmariadb-git-f31d305238d1f6c51ca03b23b119d602c149c75d.tar.gz
merged bug 39656 to 5.1-bugteam
Diffstat (limited to 'mysql-test/t/func_group.test')
-rw-r--r--mysql-test/t/func_group.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 4eedd433d34..be4e9c32686 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -973,5 +973,34 @@ GROUP BY int_nokey LIMIT 1;
DROP TABLE derived1;
DROP TABLE D;
+#
+# Bug #39656: Behaviour different for agg functions with & without where -
+# ONLY_FULL_GROUP_BY
+#
+
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
+
+SET SQL_MODE='ONLY_FULL_GROUP_BY';
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t1 where a=1;
+
+--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
+SELECT COUNT(*),a FROM t1;
+
+SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
+
+--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
+SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
+ FROM t1 outr;
+
+SELECT COUNT(*) FROM t1 a JOIN t1 outr
+ ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
+
+SET SQL_MODE=default;
+DROP TABLE t1;
+
+
###
--echo End of 5.0 tests