Re: multiple paramters in aggregate function

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: multiple paramters in aggregate function
Date: 2009-08-20 12:52:22
Message-ID: 20090820125222.GD5532@merkur.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2009-08-20 12:52:57 Re: Postgre RAISE NOTICE and PHP
Previous Message Thom Brown 2009-08-20 12:34:51 Re: Generating random unique alphanumeric IDs