Re: MIN/MAX functions for a record

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Aleksander Alekseev <aleksander(at)timescale(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Viliam Ďurina <viliam(dot)durina(at)gmail(dot)com>
Subject: Re: MIN/MAX functions for a record
Date: 2024-07-11 16:00:12
Message-ID: 2140405.1720713612@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier <michael(at)paquier(dot)xyz> writes:
> On Mon, Jul 08, 2024 at 12:20:30PM +0300, Aleksander Alekseev wrote:
> - and arrays of any of these types.
> + and also arrays and records of any of these types.

> This update of the docs is incorrect, no? Records could include much
> more types than the ones currently supported for min()/max().

Yeah, actually the contained data types could be anything with
btree sort support. This is true for arrays too, so the text
was wrong already. I changed it to

+ and also arrays and composite types containing sortable data types.

(Using "composite type" not "record" is a judgment call here, but
I don't see anyplace else in func.sgml preferring "record" for this
meaning.)

> I am not sure to get the concerns of upthread regarding the type
> caching in the context of an aggregate, which is the business with
> lookup_type_cache(), especially since there is a btree operator
> relying on record_cmp(). Tom, what were your concerns here?

Re-reading, I was just mentioning that as something to check,
not a major problem. It isn't, because array min/max are already
relying on the ability to use fcinfo->flinfo->fn_extra as cache space
in an aggregate. (Indeed, the array aggregate code is almost
identical to where we ended up.)

AFAICS this is good to go. I made a couple of tiny cosmetic
adjustments, added a catversion bump, and pushed.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Sabino Mullane 2024-07-11 16:09:23 Re: Logging which local address was connected to in log_line_prefix
Previous Message Dave Page 2024-07-11 15:49:00 Re: tests fail on windows with default git settings