Bug #9255 BINARY type: SELECT ... WHERE a = 'a ' does not find inserted row
Submitted: 17 Mar 2005 18:11 Modified: 18 Mar 2005 14:03
Reporter: Heikki Tuuri Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3-pre OS:Linux (Linux/x86)
Assigned to: CPU Architecture:Any

[17 Mar 2005 18:11] Heikki Tuuri
Description:
Hi!

Is this the intended behavior with the BINARY type?

Regards,

Heikki

mysql> create table bug2 (a binary(5) not null) type = myisam;
Query OK, 0 rows affected, 1 warning (0.00 sec)

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

mysql> select * from bug2 where a = 'a ';
Empty set (0.00 sec)

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

mysql> select * from bug2 where a = 'a ';
Empty set (0.01 sec)

How to repeat:
See above.

Suggested fix:
The comparison has to be space-padded.
[18 Mar 2005 14:03] MySQL Verification Team
Duplicate of http://bugs.mysql.com/bug.php?id=9278 which was
described by Bar with more complete description.