Michael Nolan wrote:
Earlier today I was working on a MySQL database (not by choice, I assure
you),
and I typed a statement like this:
Update tablexyz set field1 = '15' where field2 - 20;
The '-' was supposed to be an equal sign, but MySQL executed it anyway.
(Field2 is an integer.)
I was not amused.
PostgreSQL reports this as an error, of course.
I assume MySQL accepts this because it, like SQLite, doesn't have a real BOOLEAN
type and instead uses INTEGER for its truth values, I believe.
The result of any "foo = bar" is an INTEGER anyway, I believe, in such DBMSs,
same as "field2 - 20", and so if its result is nonzero, that is treated as TRUE.
Sure, that's inane, but for this one I would place a lot of blame on the SQL
standard, because it doesn't mandate BOOLEAN support, just making it optional,
and so lots of SQL DBMSs don't require BOOLEAN as the type of a WHERE expression.
Having real BOOLEAN is just one of the reasons I like Postgres the most.
-- Darren Duncan
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general