To get to the point – i understand why these are true
select (null, null) is null;
select null is null as null_is_null;
I also understand why these are all false, resp. return null
select (null, null) is not null as null_null_is_not_null;
select null is not null as null_is_not_null;
select (null, null) = (null, null) as null_null_eq_null_null;
select (null, null) = null as null_null_eq_null_null;
select (null, null) != (null, null) as null_null_neq_null_null;
select (null, null) != null as null_null_neq_null_null;
But there are two aspects that puzzle me:
- All this implies that as a user, I have no way to distinguish between
null
and(null, null)
– which in my representation may have different meanings. - If all of the above is valid…then explain this to me:
select coalesce((null, null), (10, 20)) as magic;
returns
magic
-------
(,)
(1 row)
One would expect that as per documentation
The
COALESCE
function returns the first of its arguments that is not null.
But we just established that (null, null)
is null.