Re: general purpose array_sort
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Junwang Zhao <zhjwpku@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>,
Aleksander Alekseev <aleksander@timescale.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Tom Lane <tgl@sss.pgh.pa.us>, "David G. Johnston" <david.g.johnston@gmail.com>,
jian he <jian.universality@gmail.com>, Amit Langote <amitlangote09@gmail.com>,
"andreas@proxel.se" <andreas@proxel.se>
Date: 2024-11-07T14:29:05Z
Lists: pgsql-hackers
On Thu, Nov 7, 2024 at 8:56 AM Junwang Zhao <zhjwpku@gmail.com> wrote:
> Yeah, this is reasonable but one case I can't be sure:
>
> SELECT array_sort('{{2,3,4}}'::xid[]);
>
> This will return the array as is, but xid doesn't have a LT_OPR, should
> I error out in this case? like:
>
> could not identify ordering operator for type xid[]
Yes, I think that case needs to error out. It seems best to identify
the ordering operator before you decide whether or not you have >1
element.
--
Robert Haas
EDB: http://www.enterprisedb.com
Commits
-
Introduce a SQL-callable function array_sort(anyarray).
- 6c12ae09f5a5 18.0 landed
-
Fix ARRAY_SUBLINK and ARRAY[] for int2vector and oidvector input.
- 4618045bee4a 18.0 cited
-
Re-implement the ereport() macro using __VA_ARGS__.
- e3a87b4991cc 13.0 cited