Re: [HACKERS] Can ICU be used for a database's default sort order? - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: [HACKERS] Can ICU be used for a database's default sort order?
Date
Msg-id 7e86a1aa-a942-4f6b-978e-e9013a4af3fb@manitou-mail.org
Whole thread Raw
In response to Re: [HACKERS] Can ICU be used for a database's default sort order?  (Andrey Borodin <x4mmm@yandex-team.ru>)
Responses Re: [HACKERS] Can ICU be used for a database's default sort order?
List pgsql-hackers
    Andrey Borodin wrote:

> Overall patch looks solid and thoughtful work and adds important
> functionality.

I tried the patch, with some minor changes to build with HEAD.

I was surprised by the interface, that is, the fact that a user is
not allowed to freely choose the ICU collation of a database, in
constrast with CREATE COLLATION.

AFAIU, when the "default collation provider" is ICU, CREATE DATABASE
still expects a libc locale in the lc_collate/lc_ctype arguments.
The code will automatically find an ICU equivalent by matching the
language, and it seems that the country is ignored?

So if we wanted a database with an ICU collation like, say,
"es@collation=traditional" or "es-u-co-trad" as expressed with a
BCP-47 tag, or anything that is not defined by only a language,
would it be possible? I have the impression it wouldn't.

This is not something that could be easily improved after the fact
because getting the ICU collation through a libc collation is a
user-interface choice.

I think users would rather be able to create a database with
something like:

CREATE DATABASE foo
  COLLPROVIDER='icu'
  LOCALE='icu_locale' |
      LC_COLLATE='icu_locale' | LC_CTYPE='icu_locale'
  ...
which would be in line with CREATE COLLATION.


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: New Defects reported by Coverity Scan for PostgreSQL
Next
From: Pavel Luzanov
Date:
Subject: Re: doc - add missing documentation for "acldefault"