On Thursday, April 16, 2026, PG Doc comments form <
noreply@postgresql.org> wrote:
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/18/tutorial-agg.html
Description:
(This restriction exists because the WHERE clause determines which
rows will be included in the aggregate calculation; so obviously it has to
be evaluated before aggregate functions are computed.)
This would be better off if it's mentioned that in this particular case, we
actually need the aggregate function to be computed before the WHERE clause
and that's why we are using a subquery.
That is what the parenthetical says, though without introducing the term subquery.
Without a question or a concrete proposed alternative leaving this as-is seems reasonable. I have no qualms with it at least.
David J.