From: Tom Lane <tgl@sss.pgh.pa.us>
To: kaiq@realtyideas.com
Cc: Stephan Bauer <stephan_bauer@gmx.de>
Cc: pgsql-sql@postgreSQL.org, Dietmar Kling <dietmar.kling@sam-net.de>
Subject: Re: [SQL] select with group by problem
Date: Fri, 17 Dec 1999 12:09:24 -0500
Message-ID: <8222.945450564@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.10.9912170919030.26477-100000@picasso.realtyideas.com>
<kaiq@realtyideas.com> writes:
> because there is a sum. sum always results something, even
> the something's value is a null ;-)
Yeah, but in GROUP BY mode, that SUM() should return one row per group.
If no input, then there are no groups, so there should be no output.
This is in fact a bug in Postgres: it produces a row anyway, which is
right for the un-GROUPed case but not when GROUPing.
The bug is fixed for the next release. In the meantime you might want
to use a workaround like adding "HAVING COUNT(*) > 0" to the query.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, kaiq@realtyideas.com, stephan_bauer@gmx.de, dietmar.kling@sam-net.de
Subject: Re: [SQL] select with group by problem
In-Reply-To: <8222.945450564@sss.pgh.pa.us>
References: <Pine.LNX.4.10.9912170919030.26477-100000@picasso.realtyideas.com> <8222.945450564@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox