Обсуждение: https://www.postgresql.org/docs/15/tutorial-agg.html

Поиск
Список
Период
Сортировка

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

От
PG Doc comments form
Дата:
The following documentation comment has been logged on the website:

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

city   | max | count
---------+-----+-------
 Hayward |  37 |     5
(1 row)
it's not right

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

  city   | max | count
---------+-----+-------
 Hayward |  35 |     0

because
SELECT city, max(temp_lo), count(*) FILTER (WHERE temp_lo < 30)
    FROM weather
    WHERE city LIKE 'S%'            -- (1)
    GROUP BY city
    HAVING max(temp_lo) < 40;
 city | max | count
------+-----+-------
(0 rows)

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

От
Tom Lane
Дата:
PG Doc comments form <noreply@postgresql.org> writes:
> Page: https://www.postgresql.org/docs/15/tutorial-agg.html
> Description:

> city   | max | count
> ---------+-----+-------
>  Hayward |  37 |     5
> (1 row)
> it's not right

Yeah, that example is broken.  You can see the repaired text at

https://www.postgresql.org/docs/devel/tutorial-agg.html

but it won't propagate to the released-version docs until
our next releases (scheduled for February).

            regards, tom lane