Re: Should Aggregate Functions always return one row?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: wilhelm(dot)pakulla(at)gmx(dot)de
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Should Aggregate Functions always return one row?
Date: 2004-01-25 02:45:51
Message-ID: 16437.1074998751@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

wilhelm(dot)pakulla(at)gmx(dot)de writes:
> So, if I use the max() aggregate, I receive one row with the value NULL. Is
> that correct?

Yup, that's what the SQL spec says to do, and it seems reasonable to me.

IIRC, the spec also says that SUM() over no rows returns NULL, which is
less reasonable --- I'd have defined it as returning zero, myself.
But when in doubt we follow the spec.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PostgreSQL Bugs List 2004-01-25 09:20:18 BUG #1066: avg(age()) results months with more than 30 days
Previous Message wilhelm.pakulla 2004-01-25 00:33:18 Should Aggregate Functions always return one row?