Bug #80186 the group by colunm is trimed when do group by
Submitted: 28 Jan 2016 13:15 Modified: 28 Jan 2016 13:54
Reporter: Tough HOU Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.5.38-log OS:Windows
Assigned to: CPU Architecture:Any
Tags: GROUP BY, space, trim

[28 Jan 2016 13:15] Tough HOU
Description:
For bleow sql, the first insert statement, there is 1 space after "a", and 2 spaces after "a" for 2nd statement. (If the sapce is before the "a", then the situation is different)

When do group by for column "name", I suppose the result is below:
"a "  1
"a  " 1

But here I got:
"a "  1

Is this reasonable?

=================================================
use test;
create table t1(id int(10), name varchar(10));
truncate t1;
insert into t1 values (1, "a ");
insert into t1 values (1, "a  ");

select name, count(1) from t1 group by 1;

How to repeat:
use test;
create table t1(id int(10), name varchar(10));
truncate t1;
insert into t1 values (1, "a ");
insert into t1 values (1, "a  ");

select name, count(1) from t1 group by 1;
[28 Jan 2016 13:54] MySQL Verification Team
Thank you for the bug report. That is expected behavior, please read:

http://dev.mysql.com/doc/refman/5.5/en/char.html

"All MySQL collations are of type PADSPACE. This means that all CHAR, VARCHAR, and TEXT values in MySQL are compared without regard to any trailing spaces. “Comparison” in this context does not..."