Frank Millman wrote:
> Hi all
>
> 'SELECT (null * null)' returns null
>
> 'SELECT (null - 0)' returns null
>
> 'SELECT ((null * null) - 0)' gives the following error -
> ERROR: operator does not exist: "char" - integer
>
> Why does this statement give an error? I would expect it to return null.
This does not seem to be a bug from my point of view. Postgres just doesn't
know what datatype these nulls should be. You can cast the null values to
integer (or float if you need):
SELECT ((null::integer * null::integer) - 0);
-- returns null
Best Regards,
Michael Paesold