summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_gconcat.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/func_gconcat.test')
-rw-r--r--mysql-test/t/func_gconcat.test20
1 files changed, 16 insertions, 4 deletions
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index aede2220466..62343fa2af8 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -61,7 +61,7 @@ select grp,group_concat(c order by c) from t1 group by grp;
# Test warnings
-set group_concat_max_len = 5;
+set group_concat_max_len = 4;
select grp,group_concat(c) from t1 group by grp;
show warnings;
set group_concat_max_len = 1024;
@@ -83,7 +83,7 @@ insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com'
insert into t2 values (1,4), (5,4), (5,5);
# Make this order independent
--replace_result www.help.com X www.host.com X www.google.com X
-select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
+select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
t2.URL_ID = t1.URL_ID group by REQ_ID;
# check min/max function
--replace_result www.help.com X www.host.com X www.google.com X
@@ -132,7 +132,7 @@ drop table t1, t2;
CREATE TABLE t1 (id1 tinyint(4) NOT NULL, id2 tinyint(4) NOT NULL);
INSERT INTO t1 VALUES (1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(2, 1),(2, 2),(2, 3);
-CREATE TABLE t2 (id1 tinyint(4) NOT NULL);
+CREATE TABLE t2 (id1 tinyint(4) NOT NULL);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 AND t1.id1=1 GROUP BY t1.id1;
SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
@@ -163,7 +163,7 @@ drop table t1;
# Test with subqueries (Bug #3319)
#
-create table t1 (a int, c int);
+create table t1 (a int, c int);
insert into t1 values (1, 2), (2, 3), (2, 4), (3, 5);
create table t2 (a int, c int);
insert into t2 values (1, 5), (2, 4), (3, 3), (3,3);
@@ -189,3 +189,15 @@ INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES (1), (2);
SELECT GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a) FROM t1, t2 GROUP BY t1.a;
DROP TABLE t1, t2;
+
+#
+# Bug #4035: group_concat() and HAVING
+#
+
+CREATE TABLE t1 (a char(4));
+INSERT INTO t1 VALUES ('John'), ('Anna'), ('Bill');
+SELECT GROUP_CONCAT(a SEPARATOR '||') AS names FROM t1
+ HAVING names LIKE '%An%';
+SELECT GROUP_CONCAT(a SEPARATOR '###') AS names FROM t1
+ HAVING LEFT(names, 1) ='J';
+DROP TABLE t1;