Strange Behavior of Comparison Operator in MySQL

Posted by SibProgrammer on April 03, 2010|Comments

Fighting with a bug during authorization on one of the projects, I found strange behavior of MySQL. It ignores trailing whitespace during comparison! The following two queries lead to the equal results:

SELECT * FROM users WHERE login = 'admin';
SELECT * FROM users WHERE login = 'admin    ';