Albe Laurenz, 22.06.2009 09:52:
Sorry to be nitpicking, but maybe in that case it adds to clarity:
A comparison with NULL does not return FALSE, but "undefined" or NULL.
Try to run the following queries:
SELECT 1 = 2;
and
SELECT 1 = NULL;
and observe the different result.
In the context of the original question this difference does not matter,
because a comparison is considered successful only if it returns TRUE.
But I think this way it becomes clearer *why* neither = nor != will
succeed for a NULL (= undefined) value: if you don't know which value
a certain thing has, you can neither say that it is equal to 1 nor
that it is not equal to 1.
Good points :)
Thanks for the clarification!
I recently saw a blog talking about interview questions. One of them was:
Under which circumstances does the following query *not* return all rows
SELECT *
FROM the_table
WHERE some_column = some_column;
boils down to the same behaviour...
Regards
Thomas
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general