Re: ANY_VALUE aggregate

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: ANY_VALUE aggregate
Дата
Msg-id CA+TgmoaKUOFGLDFeOOmxR7Z1KbLZ5fYWEMoXvx0hGAY4Op8OnQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: ANY_VALUE aggregate  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Mon, Dec 5, 2022 at 1:04 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "David G. Johnston" <david.g.johnston@gmail.com> writes:
> > Can we please add "first_value" and "last_value" if we are going to add
> > "some_random_value" to our library of aggregates?
>
> First and last according to what ordering?  We have those in the
> window-aggregate case, and I don't think we want to encourage people
> to believe that "first" and "last" are meaningful otherwise.
>
> ANY_VALUE at least makes it clear that you're getting an unspecified
> one of the inputs.

I have personally implemented first_value() and last_value() in the
past in cases where I had guaranteed the ordering myself, or didn't
care what ordering was used. I think they're perfectly sensible. But
if we don't add them to core, at least they're easy to add in
user-space.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: ANY_VALUE aggregate
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Using WaitEventSet in the postmaster