Re: general purpose array_sort
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Junwang Zhao <zhjwpku@gmail.com>,
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>,
Amit Langote <amitlangote09@gmail.com>, "andreas@proxel.se" <andreas@proxel.se>, Robert Haas <robertmhaas@gmail.com>
Date: 2025-03-16T13:49:58Z
Lists: pgsql-hackers
Attachments
- v17-0002-general-purpose-array_sort.patch (text/x-patch) patch v17-0002
- v17-0001-general-purpose-array_sort.patch (text/x-patch) patch v17-0001
hi.
before commit 4618045bee4a6d3efcb489c319649d8dd9aaa738 ([0])
select array_sort(array(select '1 4'::int2vector union all select '1
2'::int2vector));
array_sort
--------------------------
[1:2][0:1]={{1,2},{1,4}}
(1 row)
after
select array_sort(array(select '1 4'::int2vector union all select '1
2'::int2vector));
array_sort
---------------
{"1 2","1 4"}
(1 row)
now look closer, the second is the expected result...
I didn't dig deeper why commit 4618045bee made this patch result correct,
but I guess it would be best to include such a test case,
so I've attached a patch.
[0] https://git.postgresql.org/cgit/postgresql.git/commit/?id=4618045bee4a6d3efcb489c319649d8dd9aaa738
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