Re: + operator with a possible NULL operand

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Vincent Hikida <vhikida(at)inreach(dot)com>
Cc: Michael Glaesemann <grzm(at)myrealbox(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: + operator with a possible NULL operand
Date: 2003-05-29 11:16:59
Message-ID: 20030529111659.GC11002@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, May 28, 2003 at 23:43:19 -0700,
Vincent Hikida <vhikida(at)inreach(dot)com> wrote:
>
> That is
>
> SELECT SUM(numvar) FROM tablex
>
> Will treat any numvar which are null as if they were a zero. However, the
> following will not treat it as zero but non-existent.

Aggragates (except for count(*)) will skip any row for which the expression
is null. For sum() that turns out to be equivalent to treating the number
as zero because of the way math works. But the function isn't actually
treating nulls as zeros.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-05-29 14:04:50 Re: MD5 salt
Previous Message M. Bastin 2003-05-29 11:10:53 MD5 salt