Re: NULL/0

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: NULL/0
Дата
Msg-id 2796.1095657374@sss.pgh.pa.us
обсуждение исходный текст
Ответ на NULL/0  (David Garamond <lists@zara.6.isreserved.com>)
Список pgsql-general
David Garamond <lists@zara.6.isreserved.com> writes:
> Does anyone know what the SQL standard say (or doesn't say) about
> division by zero for NULL?

You mean NULL/0 ?

SQL99 6.26 <numeric value expression> saith:

         General Rules

         1) If the value of any <numeric primary> simply contained in a
            <numeric value expression> is the null value, then the result of
            the <numeric value expression> is the null value.

         ...

         4) The dyadic arithmetic operators <plus sign>, <minus sign>,
            <asterisk>, and <solidus> (+, -, *, and /, respectively)
            specify addition, subtraction, multiplication, and division,
            respectively. If the value of a divisor is zero, then an
            exception condition is raised: data exception - division by
            zero.

Given the order of those statements, I'd expect NULL/0 to yield NULL.

            regards, tom lane

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

Предыдущее
От: David Garamond
Дата:
Сообщение: NULL/0
Следующее
От: Neil Conway
Дата:
Сообщение: Re: Prefetch children