Re: Should Aggregate Functions always return one row? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Should Aggregate Functions always return one row?
Date
Msg-id 16437.1074998751@sss.pgh.pa.us
Whole thread Raw
In response to Should Aggregate Functions always return one row?  (wilhelm.pakulla@gmx.de)
List pgsql-bugs
wilhelm.pakulla@gmx.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

pgsql-bugs by date:

Previous
From: wilhelm.pakulla@gmx.de
Date:
Subject: Should Aggregate Functions always return one row?
Next
From: "PostgreSQL Bugs List"
Date:
Subject: BUG #1066: avg(age()) results months with more than 30 days