From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Junwang Zhao <zhjwpku(at)gmail(dot)com> |
Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, "andreas(at)proxel(dot)se" <andreas(at)proxel(dot)se>, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: general purpose array_sort |
Date: | 2025-03-31 17:11:58 |
Message-ID: | 4114454.1743441118@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Junwang Zhao <zhjwpku(at)gmail(dot)com> writes:
> On Mon, Mar 31, 2025 at 5:58 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> In v18, it's somewhat annoying that the typcache doesn't cache
>> the typarray field; we would not need a separate get_array_type()
>> lookup if it did. I doubt there is any real reason for that except
>> that pg_type.typarray didn't exist when the typcache was invented.
>> So I'm tempted to add it. But I looked at existing callers of
>> get_array_type() and none of them are adjacent to typcache lookups,
>> so only array_sort would be helped immediately. I left it alone
>> for the moment; wonder if anyone else has an opinion?
> The need for `elmtyp` and `array_type` here because a column can
> have arrays with varying dimensions. Maybe other callers don't share
> this behavior?
Maybe. I think some of what's going on here is that because for a
long time we only had pg_type.typelem and not pg_type.typarray,
code was written to not need to look up the array type if at all
possible. So there are simply not that many users. Anyway it
seems really cheap to add this field to the typcache now.
Attached 0001 is the same as v18, and then 0002 is the proposed
addition to typcache.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
v19-0001-Introduce-a-SQL-callable-function-array_sort-any.patch | text/x-diff | 18.3 KB |
v19-0002-Add-pg_type.typarray-to-the-typcache-s-collectio.patch | text/x-diff | 3.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2025-03-31 17:16:19 | Re: Non-text mode for pg_dumpall |
Previous Message | David G. Johnston | 2025-03-31 17:05:34 | Re: Make COPY format extendable: Extract COPY TO format implementations |