Re: Use of HAVING (Select/Group By) on a output-name of an aggregate function causes SYNTAX ERROR

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Use of HAVING (Select/Group By) on a output-name of an aggregate function causes SYNTAX ERROR
Дата
Msg-id 3011179.1612046789@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Use of HAVING (Select/Group By) on a output-name of an aggregate function causes SYNTAX ERROR  ("Carlos Sotto Maior \(UOL\)" <csotto@uol.com.br>)
Список pgsql-bugs
"Carlos Sotto Maior \(UOL\)" <csotto@uol.com.br> writes:
> In other words: Postgresql is matching <HAVING> arguments to columns at
> table level instead of matching to a group by result level.

That's per SQL standard.  The fact that we allow the case in
GROUP BY is an anachronism.  (You'll find also that we only allow it
for GROUP BY items that are *just* an output column name, not any
more-complicated expression.  The equivalent restriction for HAVING
would make such a feature near useless anyway.)

            regards, tom lane



В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Carlos Sotto Maior \(UOL\)"
Дата:
Сообщение: Use of HAVING (Select/Group By) on a output-name of an aggregate function causes SYNTAX ERROR
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #16846: "retrieved too many tuples in a bounded sort"