I was discussing how to avoid surprising users and someone pointed out that what seems intuitive and rational to one person is often complete insanity for others. The mental gap between a developer and a user can often be a chasm far too wide to cross. Of all the bug reports I’ve filed against MySQL, here is my all-time favorite:
select * from t where a >= 1.0order by a;
Does not cause an error. I believe it should, because there should be a whitespace before ORDER BY.
Similar syntax errors such as “select 1e0from dual”
were also accepted as valid SQL. Much soul-searching later, the
official reply from MySQL’s development team:
The server behaves properly here:
- “1″ alone can not be an identifier, because it’s followed by a
“.”
- therefore, the lexer parses “1″ as the beginning of a …