Re: NULL/0

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: NULL/0
Date: 2004-09-20 05:16:14
Message-ID: 2796.1095657374@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)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

In response to

  • NULL/0 at 2004-09-20 05:00:14 from David Garamond

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2004-09-20 07:10:54 Re: Prefetch children
Previous Message David Garamond 2004-09-20 05:00:14 NULL/0