Re: [HACKERS] SUM() and GROUP BY - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] SUM() and GROUP BY
Date
Msg-id 199901131743.MAA16352@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] SUM() and GROUP BY  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> I disagree ... the sum of zero items has traditionally been defined as
> zero by any mathematician you care to ask.  No logical problems are
> introduced by doing so, and it avoids an unpleasant special case that
> applications would otherwise be forced to deal with.  (Example: if
> D'Arcy's tramount column has been declared NOT NULL, then it seems to me
> that his code is entitled to expect to get a non-NULL result from SUM().
> He should not have to cope with a NULL just because the table is empty.)

Informix returns NULL for sum.  It returns a zero only for count().


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Brook Milligan
Date:
Subject: references to packaged versions of PostgreSQL
Next
From: Hal Snyder
Date:
Subject: Re: [HACKERS] references to packaged versions of PostgreSQL