Re: ON EMPTY clause for aggregate and window functions

Поиск
Список
Период
Сортировка
Искать
От
Robert Haas
Тема
Re: ON EMPTY clause for aggregate and window functions
Дата
Msg-id
CA+TgmoYfZW9y_T8A1nykRUcvJ2FQtMpBjgkq=+TCdq0-odF4=w@mail.gmail.com
Список
Дерево обсуждения
Re: ON EMPTY clause for aggregate and window functions Tom Lane <tgl@sss.pgh.pa.us>
Re: ON EMPTY clause for aggregate and window functions Vik Fearing <vik@postgresfriends.org>
Re: ON EMPTY clause for aggregate and window functions Tom Lane <tgl@sss.pgh.pa.us>
On Sat, Sep 12, 2026 at 9:19 AM Jeevan Chalke
 wrote:
> ON EMPTY is now implemented as exactly:
>
>     agg(args, default ON EMPTY)  ==  COALESCE(agg(args), default)
>
> for both plain and window aggregates: compute the aggregate's ordinary
> result exactly as without ON EMPTY, and substitute the default only if that
> result is NULL. No new expression-evaluation step, no per-row bookkeeping,
> and no restriction on partial/parallel aggregation.

This seems pretty useless -- the new syntax is more work for us to
maintain, and doesn't really add any value over just using COALESCE.

To be clear, I expect to lose this argument on the grounds that
apparently this syntax is in the spec and therefore we ought to
support it. But I don't understand why the spec -- or we -- should
spend time inventing new ways to spell existing behaviors. That just
seems confusing (and this particular choice of syntax seems
extra-confusing).

-- 
Robert Haas


В списке pgsql-hackers по дате отправления
От: Hayato Kuroda (Fujitsu)
Дата:
От: Manuel Reyes Bravo
Дата:
FAQ