Bug #514 GROUP BY and LEFT/RIGHT/MID wrong results with charset cp1251
Submitted: 27 May 2003 2:28 Modified: 3 Jul 2003 0:08
Reporter: Alexander Keremidarski Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.13 OS:Any (any)
Assigned to: CPU Architecture:Any

[27 May 2003 2:28] Alexander Keremidarski
Description:
Looks like this one was introduced by fix of bug 314

How to repeat:
Start mysqld 4.0.13 with --default-character-set   = cp1251

create table test (a varchar(10) not null); 

insert into test values ("a"),("ab"),("abc");

mysql> select * from test;
+-----+
| a   |
+-----+
| a   |
| ab  |
| abc |
+-----+
3 rows in set (0.00 sec)

mysql> select a, left(a,1) as b from test;
+-----+---+
| a   | b |
+-----+---+
| a   | a |
| ab  | a |
| abc | a |
+-----+---+

mysql> select a, left(a,1) as b from test group by a;
+-----+---+
| a   | b |
+-----+---+
| a   |   |
| ab  |   |
| abc |   |
+-----+---+
[31 May 2003 8:42] MySQL Verification Team
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
[19 Jun 2003 1:21] [ name withheld ]
I have similar problem, but with charset cp1252 and using DISTINCT command with LEFT/RIGHT/MID:

select distinct RIGHT(a,1) from test;

Blaz
[3 Jul 2003 0:08] Michael Widenius
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

Will be fixed in 4.0.14