"James Taylor" <jtx(at)hatesville(dot)com> writes:
> select case(sum(numbers)) when null then 0 else sum(numbers) end from
> list_results;
The reason the above doesn't work is that it expands to
CASE WHEN sum(numbers) = null THEN ...
which always fails ("= null" does not mean "is null").
Easier would be SELECT COALESCE(sum(numbers), 0) FROM list_results
regards, tom lane