Re: Question regarding UTF-8 data and "C" collation on definition of field of table

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dionisis Kontominas <dkontominas(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Question regarding UTF-8 data and "C" collation on definition of field of table
Date: 2023-02-06 01:14:44
Message-ID: CAH2-WzkbWXvDGq2=ytGckKgkj22a7kuweaphY6iOE55_aVjwsw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Feb 5, 2023 at 4:19 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> If there's a predominant language in the data, selecting a collation
> matching that seems like your best bet. Otherwise, maybe you should
> just shrug your shoulders and stick with C collation. It's likely
> to be faster than any alternative.

FWIW there are certain "compromise locales" supported by ICU/CLDR.
These include "English (Europe)", and, most notably, EOR (European
Ordering Rules):

https://en.wikipedia.org/wiki/European_ordering_rules

I'm not sure how widely used those are. EOR seems to have been
standardized by the EU or by an adjacent institution, so not sure how
widely used it really is.

It's also possible to use a custom collation with ICU, which is almost
infinitely flexible:

http://www.unicode.org/reports/tr10/#Customization

As an example, the rules about the relative ordering of each script
can be changed this way. There is also something called merged
tailorings.

The OP should see the Postgres ICU docs for hints on how to use these
facilities to make a custom collation that matches whatever their
requirements are:

https://www.postgresql.org/docs/current/collation.html#COLLATION-MANAGING

--
Peter Geoghegan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Smith 2023-02-06 01:16:58 Re: Support logical replication of DDLs
Previous Message Dionisis Kontominas 2023-02-06 01:07:01 Re: Question regarding UTF-8 data and "C" collation on definition of field of table