Re: Problem with select and null

Поиск
Список
Период
Сортировка
От Michael Paesold
Тема Re: Problem with select and null
Дата
Msg-id 012601c48eaa$f53ee1e0$ad01a8c0@zaphod
обсуждение исходный текст
Ответ на Problem with select and null  ("Frank Millman" <frank@chagford.com>)
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: Elie Nacache
Дата:
Сообщение: Hebrew support -- please help !
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Problem with select and null