Re: [HACKERS] Can ICU be used for a database's default sort order?

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Andrey Borodin" <x4mmm(at)yandex-team(dot)ru>
Cc: "Peter Geoghegan" <pg(at)bowt(dot)ie>,"Peter Eisentraut" <peter(dot)eisentraut(at)2ndquadrant(dot)com>,"Vladimir Borodin" <root(at)simply(dot)name>,"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>,"PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>,"Marina Polyakova" <m(dot)polyakova(at)postgrespro(dot)ru>
Subject: Re: [HACKERS] Can ICU be used for a database's default sort order?
Date: 2018-08-01 13:40:14
Message-ID: 7e86a1aa-a942-4f6b-978e-e9013a4af3fb@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Luzanov 2018-08-01 13:41:44 Re: doc - add missing documentation for "acldefault"
Previous Message PG Bug reporting form 2018-08-01 13:35:13 BUG #15307: Low numerical precision of (Co-) Variance