Bug #20709 Collation not used in group by on 4.1
Submitted: 27 Jun 2006 0:20 Modified: 10 Aug 2006 15:47
Reporter: Morgan Tocker Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:4.1 OS:Any (ALL)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[27 Jun 2006 0:20] Morgan Tocker
Description:
A GROUP BY ignores the collation.

Verified in;
5.0.22: Performed as expected (no bug)
4.1.9: Bug exists
4.1.20: Bug exists

How to repeat:
CREATE TABLE tbl1 (a varchar(255) collate utf8_unicode_ci NOT NULL default '') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
insert into tbl1 values (unhex('43617465676F72696573'));
insert into tbl1 values (unhex('436174C3A9676F72696573'));

SELECT a FROM tbl1 group by a;
+------------+
| a          |
+------------+
| Categories |
| Cat�gories |
+------------+
2 rows in set (0.00 sec)

In MySQL 5.0, this would return one row.
[27 Jun 2006 0:31] Miguel Solorzano
Thank you for the bug report. Verified as described:

mysql> SELECT a FROM tbl1 group by a;
+------------+
| a          |
+------------+
| Categories |
| Catégories |
+------------+
2 rows in set (0.00 sec)

mysql> select version();
+--------------+
| version()    |
+--------------+
| 4.1.21-debug |
+--------------+
1 row in set (0.00 sec)
[9 Aug 2006 12:50] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/10203

ChangeSet@1.2538, 2006-08-09 17:51:24+05:00, ramil@mysql.com +3 -0
  Fix for bug #20709: Collation not used in group by on 4.1.
[10 Aug 2006 10:05] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/10249

ChangeSet@1.2532, 2006-08-10 15:06:22+05:00, ramil@mysql.com +3 -0
  Fix for bug #20709: Collation not used in group by on 4.1.    
  
  myisam/mi_uniue.c:mi_check_unique() should skip trailing spaces comparing 
  TEXT and VARTTEXT key segments.
[10 Aug 2006 12:39] Ramil Kalimullin
fixed in 4.1.22
[10 Aug 2006 15:47] Paul Dubois
Noted in 4.1.22 changelog.

Character set collation was ignored in GROUP BY clauses.
[1 Sep 2006 9:41] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/11237

ChangeSet@1.2254, 2006-09-01 17:41:41+08:00, dli@dev3-76.dev.cn.tlan +1 -0
  Bug #21345, Error in cluster logfile rotation.
  merge the modification for ctype_utf8.result in bug#20709 fix for mysql 4.1. to let the pushbuild succeed.