Re: Proposal: QUALIFY clause
От | Merlin Moncure |
---|---|
Тема | Re: Proposal: QUALIFY clause |
Дата | |
Msg-id | CAHyXU0wnmAC2aSJXE8mWarydvQ_gY9OEFrpRNZ9OQ3De3vXZ2A@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Proposal: QUALIFY clause (Pavel Stehule <pavel.stehule@gmail.com>) |
Ответы |
Re: Proposal: QUALIFY clause
|
Список | pgsql-hackers |
On Mon, Jul 21, 2025 at 9:19 PM Pavel Stehule <pavel.stehule@gmail.com> wrote:
just for curiosity - why the HAVING clause was not used?Any window functions are +/- an "aggregate" function, and then HAVING looks more natural to me.
Hm, HAVING requires to apply 'group by' which windows functions do not require (unlike aggregates).
superuser@postgres=# select * from (select 1 as v) q having true limit 1;
ERROR: column "q.v" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select * from (select 1 as v) q having true limit 1;
ERROR: column "q.v" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select * from (select 1 as v) q having true limit 1;
If a query has both window function and grouped aggregate, HAVING would be applying at different grains potentially? If so, seems sus.
merlin
В списке pgsql-hackers по дате отправления: