List:General Discussion« Previous MessageNext Message »
From:Olivier Bodenreider Date:May 10 1999 10:44pm
Subject:behavior of LIKE in presence of diacritics
View as plain text  

Thanks, Monty, for providing us with the excellent MySQL!
Here is a the report of an unexpected behavior (I didn't say bug): it is my 
understanding that the LIKE operator for string comparisons is expected to give 
the same result as =, assuming that no wildcards is used (just expected to be 
much slower). This is not true, however, if the string searched for contains 
non-US ASCII characters, e.g. the characters modified by the funny diacritic 
signs used in French.

term = 'cholera' correctly retrieves 'Choléra'
but, unfortunately,
term like 'cholera' doesn't.

Looking at the mailing list, I have seen that I'm not the only one to have this 
"problem". I'm surprized that users wouldn't prefer a different behavior: = and 
LIKE would just work consistently.

	Dr. Olivier Bodenreider

National Library of Medicine (LHC/CgSB)
8600 Rockville Pike (Bldg 38A, B1N28G)
Bethesda, MD 20894 -- USA
phone : (301) 435-3246
fax   : (301) 480-3035

mysql> select * from NOME where nid = 'CIM10' and term = 'cholera';
| NID   | CODE | TERM    | TMST           |
| CIM10 | A00  | Choléra | 19990510135446 |
1 row in set (1.12 sec)

mysql> select * from NOME where nid = 'CIM10' and term like 'cholera';
Empty set (1.13 sec)

Technical information:

mysqladmin  Ver 7.8 Distrib 3.22.20a, for sun-solaris2.6 on sparc
SunOS etbsun2 5.6 Generic_105181-12 sun4u sparc SUNW,Ultra-2
binary version

behavior of LIKE in presence of diacriticsOlivier Bodenreider11 May
RE: MySQL Secure Connection(e.g. SSL) QuestionGreg.Cope26 Aug