When I run this query the count(0) returns 21 for the set with zip='80005'.
select zip, avg(value), min(value), max(value), count(0) from values group by zip order by zip
There are really 109 rows with zip='80005'.
The following two queries both show 109 rows and they also return different values for min, max, and avg.
select avg(value), min(value), max(value), count(value) from values where zip='80005'
select zip, avg(value), min(value), max(value), count(value) from values group by zip having zip='80005'
There are no nulls for value.
Is there any reason why the first query is returning the wrong number of rows in the set for zip='80005'?
Maybe this is a bug in Postgresql.