Re: multiple paramters in aggregate function - Mailing list pgsql-general

From Karsten Hilbert
Subject Re: multiple paramters in aggregate function
Date
Msg-id 20090820125222.GD5532@merkur.hilbert.loc
Whole thread Raw
In response to Re: multiple paramters in aggregate function  (Sim Zacks <sim@compulab.co.il>)
List pgsql-general
On Thu, Aug 20, 2009 at 03:30:00PM +0300, Sim Zacks wrote:

>         In other words, I have a conversion table of all different units. If
>         there is no conversion between 2 units (such as volume and area) then
>         the sum returns null.
>
>
>     Shouldn't that return NULL IOW unknown ?
>
> I am not familiar with returning unknown. I know that according to the spec an
> aggregate

Oh, OK, I forgot about the aggregate part.

> should only return null if all of its values of the aggregate are
> null. If there is a way to return unknown in a non-NULL way, then that would be
> preferred.

I don't know of any. However, it seems patently wrong to let
an integer sum()-something return 0 when some of its inputs
are NULL. After all, the sum could truly have been 0. This
should either throw an error, return NULL, or let me choose
to ignore NULL input and return the sum of non-NULL input.

But I have a feeling I am tip-toeing into a Holy War situation.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

pgsql-general by date:

Previous
From: Thom Brown
Date:
Subject: Re: Generating random unique alphanumeric IDs
Next
From: Jasen Betts
Date:
Subject: Re: Postgre RAISE NOTICE and PHP