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'.
Examples:
SELECT binary 'abc' = 'ABC'; will return false.
SELECT binary 'abc' = 'abc '; will also return false.
Best regards,
KH
> In the last episode (Feb 21), Zhestkov Victor said:
> > I have a table with varchar column and when I execute SELECT query like
that:
> > SELECT * FROM sometable WHERE somecolumn='abc '; it returns records
which
> > contain records with bo 'abc ' value, and which are only 'abc'.
> > Thry this SELECT 'abc' = 'abc '; it returns true. I think it rather
strange.
> > 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:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <mysql-thread133007@stripped>
> To unsubscribe, e-mail <mysql-unsubscribe-
kh=caconsultant.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
--
Yours,
KH Chiu
C&A Computer Consultants Ltd.
Tel: 3104 2070 Fax: 3010 0896
Email: kh@stripped
Website: www.caconsultant.com