Re: [HACKERS] Bug or feature? select, count(*), group by and empty tables - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Bug or feature? select, count(*), group by and empty tables
Date
Msg-id 17081.945237135@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Bug or feature? select, count(*), group by and empty tables  (Don Baccus <dhogaza@pacifier.com>)
List pgsql-hackers
Don Baccus <dhogaza@pacifier.com> writes:
> (always returning a row for a select count(*) ... group by query
>  even if there aren't any groups)

Yah: if you have aggregates and no GROUP, for empty input you should
get one row out with "default" results (0 for COUNT, null for most other
aggregates).  But for GROUP mode, no rows in should yield no rows out,
aggregates or no.  It took a fair amount of arguing before everyone was
convinced that that is the correct interpretation of the spec ;-),
which is why it's only been fixed recently.

> OK, I've gotten the latest sources with the bright idea of digging
> around, and in nodeAgg.c the routine ExecAgg.c has been somewhat
> rewritten, with comments that make it clear that this bug's already
> been fixed.
> I should build myself a latest version so I can filter out non-problems
> before reporting them, sorry...

Not a problem.  Bug reports on the latest release are fair game.
If it's already been fixed in current sources, whoever fixed it
will surely take pleasure in telling you so...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Volunteer: Large Tuples / Tuple chaining
Next
From: Oleg Bartunov
Date:
Subject: postmaster dies (6.5.3)