Bug #19205 server provides different metadata in ps-protocol and non-ps-protocol mode
Submitted: 19 Apr 2006 20:44 Modified: 12 Dec 2009 15:56
Reporter: Evgeny Potemkin Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Prepared statements Severity:S3 (Non-critical)
Version:4.1, 5.0-BK OS:Any (any)
Assigned to: CPU Architecture:Any
Tags: affects_connectors

[19 Apr 2006 20:44] Evgeny Potemkin
Description:
Test for the mysql test suite:

create table t1(f1 int, f2 int);
insert into t1 values (1,1),(2,2);
--enable_metadata
select f2,group_concat(f1) from t1 group by 1 order by 2;
--disable_metadata

With the ps-protocol mode enabled only alias will be set for the group_concat() column.
If ps-protocol isn't enabled then and the alias and the column name will be set.

This occurs because of in the ps-protocol mode send_fields() will send fields from the original select list. In the plain mode when a tmp table is created it sets the column name and only after this fields are sent.

How to repeat:
See description.
[20 Apr 2006 17:17] Valeriy Kravchuk
Thank you for a problem report. Please, send the results you got and describe the results expected.
[20 Apr 2006 20:12] Evgeny Potemkin
In the non ps-protocol mode it returns:

+ select f2,group_concat(f1) from t1 group by 1 order by 2;
+ Catalog       Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals   Charsetnr
+ def   test    t1      t1      f2      f2      3       11      1       Y       32768   0       63
+ def                           group_concat(f1)        group_concat(f1)        253     400     1       Y       128     0       63
+ f2    group_concat(f1)
+ 1     1
+ 2     2

In the ps-protocol mode it returns:
+ select f2,group_concat(f1) from t1 group by 1 order by 2;
+ Catalog       Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals   Charsetnr
+ def   test    t1      t1      f2      f2      3       11      11      Y       32768   0       63
+ def                                   group_concat(f1)        253     400     1       Y       128     0       63
+ f2    group_concat(f1)
+ 1     1
+ 2     2

You can see the difference in the second line that starts with 'def'. There group_concat() is  mentioned only once.
[17 May 2006 21:36] Valeriy Kravchuk
Verified just as described with 5.0.22-BK (ChangeSet@1.2125.1.1, 2006-05-17 00:23:40+02:00) on Linux.
[17 Oct 2006 7:26] Konstantin Osipov
This is broken as designed, see Bug#2812
[30 Sep 2008 14:58] Konstantin Osipov
Related Bug#2812.
[12 Dec 2009 15:56] Valeriy Kravchuk
With 5.1.43 from bzr I've got in non-ps-protocol mode:

+create table t1(f1 int, f2 int);
+insert into t1 values (1,1),(2,2);
+select f2,group_concat(f1) from t1 group by 1 order by 2;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def	test	t1	t1	f2	f2	3	11	1	Y	32768	0	63
+def					group_concat(f1)	252	1024	144	0	63
+f2	group_concat(f1)
+1	1
+2	2

and in ps-protocol mode:

+create table t1(f1 int, f2 int);
+insert into t1 values (1,1),(2,2);
+select f2,group_concat(f1) from t1 group by 1 order by 2;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def	test	t1	t1	f2	f2	3	11	11	Y	32768	0	63
+def					group_concat(f1)	252	1024	144	0	63
+f2	group_concat(f1)
+1	1
+2	2

These results looks exactly the same for me.