select null + 0 question - Mailing list pgsql-general

From Jean-Christian Imbeault
Subject select null + 0 question
Date
Msg-id 3F1242C2.8080802@mega-bucks.co.jp
Whole thread Raw
Responses Re: select null + 0 question  ("listrec" <listrec@epecon.de>)
Re: select null + 0 question  (Joe Conway <mail@joeconway.com>)
Re: select null + 0 question  (Mike Mascari <mascarm@mascari.com>)
List pgsql-general
Why is it that "select null + 1" gives null but "select sum(a) from
table" where there are null entries returns an integer?

Shouldn't the sum() and "+" operators behave the same?

TAL=# select null + 0;
  ?column?
----------

(1 row)

TAL=# select * from a;
  a
---


  1
(3 rows)

TAL=# select sum(a) from a;
  sum
-----
    1
(1 row)


Thanks,

Jean-Christian Imbeault


pgsql-general by date:

Previous
From: Jim Rosenberg
Date:
Subject: Re: OS X installation with readline support
Next
From: Ron Johnson
Date:
Subject: Re: Is SQL silly as an RDBMS<->app interface?