Bug #12046 Group_concat bug ?
Submitted: 20 Jul 2005 6:28 Modified: 20 Jul 2005 14:02
Reporter: Toten Hose Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5 OS:Linux (Suse)
Assigned to: CPU Architecture:Any

[20 Jul 2005 6:28] Toten Hose
Description:
Have a table with ID and Name field.
I use 2 GROUP_CONCAT-s. One is for concatting ID-s and one for names. Names concat acts strangely. It returns fields ending with separator (not with last name) and on some cases half fields.

For example, these german city names end like that:

......."Essen", "Frankfurt", "Köln", "München", "Hambu

And japan city names:

......."Wakayama", "Omiya", "Matsuyama", "Kanazawa", "Kawaguchi",

Here's the query:

SELECT country, GROUP_CONCAT(id SEPARATOR ', '), GROUP_CONCAT(name SEPARATOR '", "') FROM cities GROUP BY country

Maybe it's a bug ? Or just the matter of configuration (field sizes, etc.)

How to repeat:
Make a table and use this query... ?
[20 Jul 2005 7:40] Vasily Kishkin
Could you please write here table definition ?
[20 Jul 2005 7:49] Toten Hose
id		int(10) unsigned 	  	PRI 	NULL 	auto_increment
country		int(10) unsigned 	  	MUL 	0 	 
name		varchar(50)
[20 Jul 2005 8:03] Toten Hose
PHP query making code:

$q = 'SELECT riik, GROUP_CONCAT(id SEPARATOR ", "), GROUP_CONCAT(nimi SEPARATOR "\", \"") FROM maailma_linnad GROUP BY riik';

I tried with different separators... looks like there's a field length limit 1024. I'm not an expert, but is it changable ?
[20 Jul 2005 8:06] Toten Hose
Sorry for annoying :)
I found there's a system variable called:  group_concat_max_len = 1024