MySQL Version 5.0.67
Take a look at this very simple table and tell me if I have found a MySQL bug, I have tried to search for an answer but as you can imagine it’s a bit hard to come up with the right search terms
CREATE TABLE `product` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(60) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `product` VALUES (1, 'jim');
INSERT INTO `product` VALUES (2, 'bob');
From there I can then select the following
SELECT * FROM `product` WHERE `id` = '1';
Obviously this returns a row, but then, so does this
SELECT * FROM `product` WHERE `id` = '1blah';
Erm… WHY? Surely this is wrong or am I going mad? Will crawl the web a bit more before I file a bug report with MySQL.
This happens because of type conversion. Since your column has integer value, ‘1blah’ is converted to 1. Please, see http://dev.mysql.com/doc/refman/5.0/en/type-conversion.html for more details.