Bug #8681 %d in show warnings after group_concat + left join
Submitted: 22 Feb 2005 12:35 Modified: 11 Apr 2005 2:05
Reporter: Marcus Eriksson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.10 OS:Any (*)
Assigned to: Jim Winstead CPU Architecture:Any

[22 Feb 2005 12:35] Marcus Eriksson
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)
[22 Feb 2005 12:47] Aleksey Kishkin
a note:
on windows I got result 'aaaaa' in both queries (left and inner join).
[25 Mar 2005 0:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/23365
[5 Apr 2005 20:05] Jim Winstead
Fixed in 4.1.12 and 5.0.4.
[11 Apr 2005 2:05] Paul Dubois
Noted in 4.1.12, 5.0.4 changelogs.