Typo in 2.7 Aggregate Functions

Started by PG Bug reporting formabout 3 years ago2 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/tutorial-agg.html
Description:

Near the end of Chapter 2.7 Aggregate Functions of the documentation, the
command FILTER is introduced. The full query is

SELECT city, max(temp_lo), count(*) FILTER (WHERE temp_lo < 30)
FROM weather
GROUP BY city
HAVING max(temp_lo) < 40;

and the output shows a count value of 5. This is an error.

In total we only have 3 rows in the table so far. Furthermore, none of the
rows have temp_lo < 30. If I'm not mistaken, the count value should be 0.

Thanks,
Jimmy

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PG Bug reporting form (#1)
Re: Typo in 2.7 Aggregate Functions

PG Doc comments form <noreply@postgresql.org> writes:

Near the end of Chapter 2.7 Aggregate Functions of the documentation, the
command FILTER is introduced. The full query is

SELECT city, max(temp_lo), count(*) FILTER (WHERE temp_lo < 30)
FROM weather
GROUP BY city
HAVING max(temp_lo) < 40;

and the output shows a count value of 5. This is an error.

Yeah :-(. This is already fixed in our source tree [1]https://git.postgresql.org/gitweb/?p=postgresql.git&amp;a=commitdiff&amp;h=f05a5e0003edfec027ee10d09082667036862e1c, as you
can see on the website if you look at the "devel" branch. But the
released-version docs won't update till our next releases, in
February.

Thanks for the report, anyway!

regards, tom lane

[1]: https://git.postgresql.org/gitweb/?p=postgresql.git&amp;a=commitdiff&amp;h=f05a5e0003edfec027ee10d09082667036862e1c