Description:
Bad warning when doing group_concat with left join and the concat length exceeds group_concat_max_len
How to repeat:
mysql> set group_concat_max_len=5; #(for testing purposes)
Query OK, 0 rows affected (0.00 sec)
mysql> create table t1(a int, b varchar(20));
Query OK, 0 rows affected (0.01 sec)
mysql> create table t2(a int, c varchar(20));
Query OK, 0 rows affected (0.00 sec)
mysql> insert into t1 values (1,"aaaaaaaaaa");
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1 values (1,"bbbbbbbbbb");
Query OK, 1 row affected (0.00 sec)
mysql> insert into t2 values (1,"cccccccccc");
Query OK, 1 row affected (0.00 sec)
mysql> select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by t1.a;
+-------------------------+
| group_concat(t1.b,t2.c) |
+-------------------------+
| bbbbb |
+-------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+---------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------+
| Warning | 1260 | %d line(s) were cut by GROUP_CONCAT() |
+---------+------+---------------------------------------+
1 row in set (0.00 sec)
---------
on the other hand, if i do it with inner join instead of left join:
---------
mysql> select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by t1.a;
+-------------------------+
| group_concat(t1.b,t2.c) |
+-------------------------+
| aaaaa |
+-------------------------+
1 row in set, 1 warning (0.01 sec)
mysql> show warnings;
+---------+------+--------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------+
| Warning | 1260 | 1 line(s) were cut by GROUP_CONCAT() |
+---------+------+--------------------------------------+
1 row in set (0.00 sec)
Description: Bad warning when doing group_concat with left join and the concat length exceeds group_concat_max_len How to repeat: mysql> set group_concat_max_len=5; #(for testing purposes) Query OK, 0 rows affected (0.00 sec) mysql> create table t1(a int, b varchar(20)); Query OK, 0 rows affected (0.01 sec) mysql> create table t2(a int, c varchar(20)); Query OK, 0 rows affected (0.00 sec) mysql> insert into t1 values (1,"aaaaaaaaaa"); Query OK, 1 row affected (0.00 sec) mysql> insert into t1 values (1,"bbbbbbbbbb"); Query OK, 1 row affected (0.00 sec) mysql> insert into t2 values (1,"cccccccccc"); Query OK, 1 row affected (0.00 sec) mysql> select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by t1.a; +-------------------------+ | group_concat(t1.b,t2.c) | +-------------------------+ | bbbbb | +-------------------------+ 1 row in set, 1 warning (0.00 sec) mysql> show warnings; +---------+------+---------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------+ | Warning | 1260 | %d line(s) were cut by GROUP_CONCAT() | +---------+------+---------------------------------------+ 1 row in set (0.00 sec) --------- on the other hand, if i do it with inner join instead of left join: --------- mysql> select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by t1.a; +-------------------------+ | group_concat(t1.b,t2.c) | +-------------------------+ | aaaaa | +-------------------------+ 1 row in set, 1 warning (0.01 sec) mysql> show warnings; +---------+------+--------------------------------------+ | Level | Code | Message | +---------+------+--------------------------------------+ | Warning | 1260 | 1 line(s) were cut by GROUP_CONCAT() | +---------+------+--------------------------------------+ 1 row in set (0.00 sec)