List:General Discussion« Previous MessageNext Message »
From:KH Chiu Date:February 21 2003 6:43am
Subject:Re: Is this a bug?
View as plain text  
This is really not a bug. It is only a feature. Besides trimming of trailing 
spaces, MySQL also perform case-insensitive match. ie. SELECT 'abc' = 'ABC'; 
will return true.

In order to turn off this feature, you should add the keyword 'binary'. 


SELECT binary 'abc' = 'ABC'; will return false.
SELECT binary 'abc' = 'abc '; will also return false.

Best regards,


> In the last episode (Feb 21), Zhestkov Victor said:
> > I have a table with varchar column and when I execute SELECT query like 
> > SELECT * FROM sometable WHERE somecolumn='abc   '; it returns records 
> > contain records with bo 'abc  ' value, and which are only 'abc'.
> > Thry this SELECT 'abc' = 'abc   '; it returns true. I think it rather 
> > I have mysql installed from Debian 3.0 r0.
> >From the docs:
>    * All string columns, except `BLOB' and `TEXT' columns, automatically
>      have all trailing spaces removed when retrieved. For `CHAR' 
> types     this is okay, and may be regarded as a feature according 
> to ANSI     SQL92. The bug is that in MySQL Server, `VARCHAR' 
> columns are     treated the same way.
> It's mentioned in 3 other places as well.
> -- 
> 	Dan Nelson
> 	dnelson@stripped
> ---------------------------------------------------------------------
> Before posting, please check:
>   (the manual)
>           (the list archive)
> To request this thread, e-mail <mysql-thread133007@stripped>
> To unsubscribe, e-mail <mysql-unsubscribe->
> Trouble unsubscribing? Try:

KH Chiu
C&A Computer Consultants Ltd.
Tel: 3104 2070 Fax: 3010 0896
Email: kh@stripped

Is this a bug?Zhestkov Victor21 Feb
  • Re: Is this a bug?Dan Nelson21 Feb
    • Re: Is this a bug?KH Chiu21 Feb