Marco Colombo wrote:
> That is, given a variable A, you can always write a boolean expression
> that evaluates True or False to test if A is _equal_ to None/undef/NULL
> (in C):
And of course you can do this in SQL as well.
> ('a', NULL) is neither the same _nor different_ from ('a', 2).
Uh, I'm not sure what you mean by "the same"; but
certainly ('a',NULL) is distinct from ('a',2).
>The result of comparison is NULL, no matter how you're testing it:
Unless you're testing with the IS DISTINCT FROM operator.
fli=# select ('a',NULL) IS DISTINCT FROM ('a',2);
?column?
----------
t
(1 row)
> marco=# select ('a', 2) = ('a', NULL);
> ?column?
> ----------
>
> (1 row)
>
> marco=# select ('a', 2) <> ('a', NULL);
> ?column?
> ----------
>
> (1 row)
fli=# select ('a',NULL) IS DISTINCT FROM ('a',NULL);
?column?
----------
f
(1 row)
> That's why NULLs are not allowed in primary keys...
But in general I agree with most of the rest of what you said.