4 ms·
I know this isn't a MySQL versus PostgreSQL thread, but I was bitten by MySQL today... The issue: I ran a SELECT with a WHERE against a column that is an "int(
by CoffeeDregs 14y ago
I know this isn't a MySQL versus PostgreSQL thread, but I was bitten by MySQL today...
The issue: I ran a SELECT with a WHERE against a column that is an "int(11)", but I meant to run it against another column that is "varchar(255)". Something like:
SELECT * FROM table WHERE wrong_column = "1abcdefghijk";
Somehow MySQL cast a "varchar(255)" to an "int(11)" with a value "1" without telling me. WTF? My result set was approximately 1M rows. I expected 1 row, so knew the result was wrong... But what if I had expected more than 1 row? Then the bizarre results from MySQL would have appeared to make sense.
- te_chris 14y agoMaybe there's a deeper reason PHP and MySQL are so closely linked.
- CoffeeDregs 14y agoFunny: I thought the exact same thing as I was writing my comment...
- pvh 14y agoThis is my least favorite MySQL misfeature, and it's something that users migrating FROM MySQL often rely on in their application and get surprised/angry when they encounter errors rather than silent successes.