From: | Aleksander Alekseev <aleksander(at)timescale(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Cc: | Viliam Ďurina <viliam(dot)durina(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: MIN/MAX functions for a record |
Date: | 2024-03-23 10:59:17 |
Message-ID: | CAJ7c6TNHUgrFXO8BmxnAN1U9W0R3bYKdci1tJcL=uMoJtLXr5g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Support-MIN-MAX-record-aggregates-WIP.patch | application/octet-stream | 2.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2024-03-23 12:37:20 | Re: SET ROLE documentation improvement |
Previous Message | Bharath Rupireddy | 2024-03-23 09:22:55 | Re: Switching XLog source from archive to streaming when primary available |