Re: MIN/MAX functions for a record

Поиск
Список
Период
Сортировка
От Aleksander Alekseev
Тема Re: MIN/MAX functions for a record
Дата
Msg-id CAJ7c6TNHUgrFXO8BmxnAN1U9W0R3bYKdci1tJcL=uMoJtLXr5g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: MIN/MAX functions for a record  (Viliam Ďurina <viliam.durina@gmail.com>)
Ответы Re: MIN/MAX functions for a record  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

> Exactly Tom, I see no fundamental problem for it not to be implemented, since comparison operator is already
implemented.In fact, MIN/MAX should work for all types for which comparison operator is defined.
 

On second thought, this should work reasonably well.

PFA a WIP patch. At this point it implements only MAX(record), no MIN, no tests:

```
=# SELECT MAX(row(year, month)) FROM (VALUES(2025, 1), (2024,2)) x(year, month);
   max
----------
 (2025,1)
```

One thing I'm not 100% sure of is whether record_larger() should make
a copy of its arguments or the current implementation is safe.

-- 
Best regards,
Aleksander Alekseev

Вложения

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

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Switching XLog source from archive to streaming when primary available
Следующее
От: Robert Haas
Дата:
Сообщение: Re: SET ROLE documentation improvement