Bug #383 Wrong behaviour of Group_Concat() function
Submitted: 6 May 2003 12:06 Modified: 26 Jun 2003 11:00
Reporter: Dmitry Katsubo Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.0 OS:Linux (Linux)
Assigned to: Bugs System CPU Architecture:Any

[6 May 2003 12:06] Dmitry Katsubo
Description:
Release: mysql-4.1.0-alpha (Official MySQL RPM)
System:  Linux pilot 2.4.20-mosix-migshm #1 Fri Apr 25 15:31:11 EEST 2003 i686 unknown
Architecture: i686

The problem reveals itself both on InnoDB and MyISAM table types.

The query returns wrong results:

pilot> mysql --user=root < test.sql
REQ_ID  URL
1       host.com     \0\0\0\0
5       google.com   \0\0\0\0 host.com     \0\0\0P

How to repeat:
create database test_2;
use test_2;

DROP TABLE IF EXISTS T_URL;
CREATE TABLE T_URL (
  URL_ID int(11),
  URL varchar(80)
);

DROP TABLE IF EXISTS T_REQUEST;
CREATE TABLE T_REQUEST (
  REQ_ID int(11),
  URL_ID int(11)
);

INSERT INTO T_URL VALUES (4,'www.host.com'), (5,'www.google.com');
INSERT INTO T_REQUEST VALUES (1,4), (5,4), (5,5);

select REQ_ID, Group_Concat(URL) as URL
from T_URL, T_REQUEST
where T_REQUEST.URL_ID = T_URL.URL_ID
group by REQ_ID;

drop database test_2;
[7 May 2003 1:25] Dmitry Katsubo
Sorry, I have missed the earlier report bug#289, which is similar to this issue. In some cases I have experienced the same: NULL output for the whole column.
[29 May 2003 10:34] Vasily Kishkin
Some problem with field type of variable length. It will be fixed soon
[26 Jun 2003 11:00] Vasily Kishkin
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html

It was problem with offsets of fields. It was fixed.