Bug #56473 ERROR 1260 (HY000): %d line(s) were cut by GROUP_CONCAT()
Submitted: 1 Sep 2010 21:17 Modified: 17 Nov 2010 12:48
Reporter: Winfried Trümper Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.1.36, 5.1.50 OS:Any
Assigned to: Dmitry Shulga CPU Architecture:Any

[1 Sep 2010 21:17] Winfried Trümper
Description:
%d looks like a print got a printf format. Thanks. -Winfried

How to repeat:
Collect data with GROUP_CONCAT() beyond the limit set by the system variable group_concat_max_len.
[1 Sep 2010 21:26] MySQL Verification Team
Thank you for the bug report. Could you please provide a test case sample. Thanks in advance.
[1 Sep 2010 22:21] Winfried Trümper
Oh, I see. This is not as trivial to reproduce as it appears on the first sight.

SET @@group_concat_max_len = 1024; -- reset default
CREATE TABLE bughunt (t text);
INSERT INTO bughunt VALUES
       (REPEAT('a', 1500)),
       (REPEAT('a', 1500));
DELIMITER ;;
CREATE FUNCTION percentd()
RETURNS int
BEGIN
        DECLARE rv text;
        SELECT GROUP_CONCAT(t)
        INTO rv
        FROM bughunt;
        RETURN(rv);
END;;
DELIMITER ;
SELECT percentd()
INTO OUTFILE '/tmp/percentd.txt';
-- results in: ERROR 1260 (HY000): %d line(s) were cut by GROUP_CONCAT()
DROP FUNCTION percentd;
DROP TABLE bughunt;
[2 Sep 2010 9:06] Valeriy Kravchuk
Verified with 5.1.50:

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -uroot -proot -P3310 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.50-community MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SET @@group_concat_max_len = 1024; -- reset default
Query OK, 0 rows affected (0.08 sec)

mysql> CREATE TABLE bughunt (t text);
Query OK, 0 rows affected (0.19 sec)

mysql> INSERT INTO bughunt VALUES
    ->        (REPEAT('a', 1500)),
    ->        (REPEAT('a', 1500));
Query OK, 2 rows affected (0.14 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> DELIMITER ;;
mysql> CREATE FUNCTION percentd()
    -> RETURNS int
    -> BEGIN
    ->         DECLARE rv text;
    ->         SELECT GROUP_CONCAT(t)
    ->         INTO rv
    ->         FROM bughunt;
    ->         RETURN(rv);
    -> END;;
Query OK, 0 rows affected (0.17 sec)

mysql> DELIMITER ;
mysql> SELECT percentd()
    -> INTO OUTFILE 'c:/tmp/percentd.txt';
ERROR 1260 (HY000): %d line(s) were cut by GROUP_CONCAT()
[17 Nov 2010 11:21] Davi Arnaut
Could someone please reverify? I can no longer repeat it with latest mysql-5.1-bugteam.
[17 Nov 2010 12:48] Valeriy Kravchuk
Looks fixed in current mysql-5.1 tree:

macbook-pro:5.1 openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.54-debug Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SET @@group_concat_max_len = 1024; 
Query OK, 0 rows affected (0.00 sec)

mysql> drop table bughunt;
ERROR 1051 (42S02): Unknown table 'bughunt'
mysql> CREATE TABLE bughunt (t text);
Query OK, 0 rows affected (0.06 sec)

mysql> INSERT INTO bughunt VALUES
    ->        (REPEAT('a', 1500)),
    ->        (REPEAT('a', 1500));
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> DELIMITER ;;
mysql> CREATE FUNCTION percentd()
    -> RETURNS int
    -> BEGIN
    ->         DECLARE rv text;
    ->         SELECT GROUP_CONCAT(t)
    ->         INTO rv
    ->         FROM bughunt;
    ->         RETURN(rv);
    -> END;;
Query OK, 0 rows affected (0.01 sec)

mysql> DELIMITER ;
mysql> SELECT percentd()
    -> INTO OUTFILE '/tmp/percentd.txt';
Query OK, 1 row affected, 2 warnings (0.01 sec)

mysql> show warnings\G
*************************** 1. row ***************************
  Level: Warning
   Code: 1260
Message: 1 line(s) were cut by GROUP_CONCAT()
*************************** 2. row ***************************
  Level: Warning
   Code: 1366
Message: Incorrect integer value: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' for column 'percentd()' at row 2
2 rows in set (0.00 sec)
[17 Nov 2010 13:01] Davi Arnaut
Dmitry,

When you have some time to spare, please add the test case to our suite.
[25 Nov 2010 10:47] 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/commits/125004

3521 Dmitry Shulga	2010-11-25
      Bug#56473: ERROR 1260 (HY000): %d line(s) were cut by GROUP_CONCAT().
      Adding a test case to ensure there will be no regression.
[25 Nov 2010 10:50] Dmitry Shulga
Davi! Could you please review regression test for this bug.