BUG #4057: SUM returns NULL when given no rows - Mailing list pgsql-bugs

From Reginald Drake
Subject BUG #4057: SUM returns NULL when given no rows
Date
Msg-id 200803251101.m2PB1imu036236@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4057: SUM returns NULL when given no rows
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4057
Logged by:          Reginald Drake
Email address:      reggie.drake@gmail.com
PostgreSQL version: 8.2.7
Operating system:   Ubuntu linux
Description:        SUM returns NULL when given no rows
Details:

Doing something like "SELECT SUM(some_integer_column) FROM some_table WHERE
FALSE" gives me NULL, where I would expect 0. Since COUNT does give a
meaningful value when applied to zero columns, maybe SUM should do the same.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Possible problem with EXTRACT(EPOCH FROM TIMESTAMP)
Next
From: Tom Lane
Date:
Subject: Re: BUG #4057: SUM returns NULL when given no rows