Bug #39242 Different result of 'like' operator
Submitted: 4 Sep 2008 13:00 Modified: 6 Sep 2008 15:05
Reporter: Ondrej Koala Vacha Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:5.0.67 OS:Any
Assigned to: CPU Architecture:Any
Tags: collate

[4 Sep 2008 13:00] Ondrej Koala Vacha
Description:
Some pairs of characters, such as Y and Ý (Ycaron), A and Á (Acaron) etc. are the same for the 'like' operator using utf8_czech_ci collate. 'Like' with collate latin2_czech_cs returns all ok.

How to repeat:
create table nn (
    name char(255)
    ) DEFAULT CHARSET=latin2 COLLATE=latin2_czech_cs;

    insert into nn values ('Yyyyy');
    insert into nn values ('Ýyyyy');

    select * from nn where name like 'Y%';
    select * from nn where name like 'Ý%';

+-------+
| name  |
+-------+
| Yyyyy | 
+-------+
+-------+
| name  |
+-------+
| Ýyyyy | 
+-------+

create table nn1 (
    name char(255)
) DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;

insert into nn1 values ('Yyyyy');
insert into nn1 values ('Ýyyyy');

select * from nn1 where name like 'Y%';
select * from nn1 where name like 'Ý%';

+-------+
| name  |
+-------+
| Yyyyy | 
| Ýyyyy | 
+-------+
+-------+
| name  |
+-------+
| Yyyyy | 
| Ýyyyy | 
+-------+
[4 Sep 2008 13:58] MySQL Verification Team
Thank you for the bug report. I can't repeat on current source server:

[miguel@hegel dbs]$ 5.0/bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.70-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database y7;
Query OK, 1 row affected (0.01 sec)

mysql> use y7
Database changed
mysql> create table nn1 (
    ->     name char(255)
    -> ) DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> insert into nn1 values ('Yyyyy');
Query OK, 1 row affected (0.00 sec)

mysql> insert into nn1 values ('Ýyyyy');
Query OK, 1 row affected (0.00 sec)

mysql> 
mysql> select * from nn1 where name like 'Y%';
+-------+
| name  |
+-------+
| Yyyyy | 
+-------+
1 row in set (0.00 sec)

mysql> select * from nn1 where name like 'Ý%';
+--------+
| name   |
+--------+
| Ýyyyy | 
+--------+
1 row in set (0.00 sec)

mysql>
[6 Sep 2008 15:05] Ondrej Koala Vacha
Miguel,

your mysql is 5.0.70, but the latest version on www.mysql.com is my version 5.0.67. Send me, please, link to mysql 5.0.70 (source). 

thanks

Ondrej Koala