Skip site navigation (1) Skip section navigation (2)

Re: Meeting recap - Logic and Databases with Jeff Davis

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: "Randal L(dot) Schwartz" <merlyn(at)stonehenge(dot)com>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, PDX PostgreSQL Users <pdxpug(at)postgresql(dot)org>
Subject: Re: Meeting recap - Logic and Databases with Jeff Davis
Date: 2008-06-23 00:16:54
Message-ID: 1214180214.8973.79.camel@jdavis (view raw or flat)
Thread:
Lists: pdxpug
On Sun, 2008-06-22 at 11:31 -0700, Randal L. Schwartz wrote:
> I'd argue that this is also wrong.  You should not include "unknown" in your
> sum, even with this trick. Just filter it out with WHERE where you can,
> and rely on this "trick" only when filtering the rows is not an option.
> 

In SQL, NULL doesn't always mean "unknown". See: OUTER JOIN and any
aggregate function (except COUNT).

I provided a link to the slides for my talk, and in there is a complete
example, in which we start out with no NULLs at all in our data, and yet
still run into precisely this problem. In that particular example, a
WHERE will *not* solve the problem, because aggregates (other than
COUNT) return NULL when there are no input rows (which I'd like to point
out is not an "unknown").

http://www.pgcon.org/2008/schedule/events/83.en.html

Regards,
	Jeff Davis


In response to

Responses

pdxpug by date

Next:From: David E. WheelerDate: 2008-06-24 05:29:06
Subject: Re: Meeting recap - Logic and Databases with Jeff Davis
Previous:From: Randal L. SchwartzDate: 2008-06-22 18:31:01
Subject: Re: Meeting recap - Logic and Databases with Jeff Davis

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group