Re: general purpose array_sort

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Junwang Zhao <zhjwpku(at)gmail(dot)com>, jian he <jian(dot)universality(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: 2024-10-24 16:06:32
Message-ID: 2483529.1729785992@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> Composing function calls here seems quite undesirable from a performance
> standpoint, but maybe I over-estimate the cost of
> exploding-manipulating-freezing an array datum. Also, while I'm not in a
> good position to judge the challenge of implementing the sort parameters I
> would rather have them than not since the order by API has them (plus
> performance). I also, maybe unreasonably, believe that our extensible type
> system has already limited the maintenance burden.

Oh! I had not actually looked at the details of what was being
proposed here. I imagined "array_sort(anyarray)" and the sort would
use the default sort order for the array's element type. This
business with a textual representation of a sort clause seems like
over-engineering ... except that it's also under-engineered, because
the parsing is lame and incomplete. (No USING option, and the fact
that collation comes from somewhere else seems impossibly confusing.)
Let's drop that. As already noted, if you need a non-default sort
order you can build what you want with a sub-select. The ambition
here should be to make easy cases easy.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2024-10-24 16:47:54 Re: general purpose array_sort
Previous Message Tom Lane 2024-10-24 15:47:52 Re: Better error reporting from extension scripts (Was: Extend ALTER OPERATOR)