public inbox for [email protected]
help / color / mirror / Atom feedFrom: Matt Magoffin <[email protected]>
To: [email protected]
Subject: Collation with upper and numeric comparing in unexpected way
Date: Wed, 21 Jan 2026 07:36:42 +1300
Message-ID: <[email protected]> (raw)
I am using Postgres 17 and trying to configure a collation that sorts upper case before lower case and includes numeric sorting:
CREATE COLLATION testsort (provider = icu, locale = 'und-u-kf-upper-kn’);
These comparisons are working as I expected:
SELECT 'id-45' < 'id-123' COLLATE testsort; -- true (45 before 123)
SELECT 'id' < 'ID' COLLATE testsort; -- false (upper case before lower case)
However combining them resulted in an unexpected result:
SELECT 'id-45' < 'ID-123' COLLATE testsort; -- true
I thought that last one would be false because “ID” would come before “id”. Is there a way to configure the collation to achieve that? I’m trying to match the sorting behaviour in external application code.
Thanks for any help,
Matt
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Collation with upper and numeric comparing in unexpected way
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox