Re: [Minor] Clarification on "2.7. Aggregate Functions"

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: matematica(dot)a3k(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: [Minor] Clarification on "2.7. Aggregate Functions"
Date: 2026-09-29 12:47:54
Message-ID: CAApHDvqHPe+jX+mXnLY8Sq=8VmrV33y76SU-NYjutT5-g4pA=w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Tue, 29 Sept 2026 at 21:34, PG Doc comments form
<noreply(at)postgresql(dot)org> wrote:
>
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/18/tutorial-agg.html
> Description:
>
> Where it says: "FILTER is much like WHERE, except that it removes rows only
> from the input of the particular aggregate function that it is attached to.
> Here, the count aggregate counts only rows with temp_lo below 45; but the
> max aggregate is still applied to all rows, so it still finds the reading of
> 46."
> Should say "FILTER is much like WHERE, except that it removes rows only from
> the input of the particular aggregate function that it is attached to. Here,
> the count aggregate counts only rows with temp_lo below 45; but the max
> aggregate is still applied to all rows being considered with the GROUP BY
> clause, so it still finds the reading of 46."
>
> Wording may vary, I think a clarification on this should be an improvement.

i.e. you're suggesting that " being considered with the GROUP BY
clause," is added.

The GROUP BY clause only controls how input rows are grouped and has
no bearing on which rows are aggregated. So, IMO "being considered
with the GROUP BY clause" doesn't seem like an improvement.

I can't quite understand where the ambiguity is that you're trying to
fix. If the reader assumes "all rows" means all rows in the table, or
all rows visited during the execution of the query, they're correct as
the query has no WHERE clause and those two things are the same.

David

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Daniel Gustafsson 2026-09-29 12:55:16 Re: Table 9.31. to_char Examples
Previous Message Oli Sennhauser 2026-09-29 09:20:06 Little formatting issues in doc