From: Daniel Verite <daniel@manitou-mail.org>
To: rihad <rihad@mail.ru>
Cc: Peter Geoghegan <pg@bowt.ie>
Cc: pgsql-general General <pgsql-general@postgresql.org>
Subject: Re: Upgrading locale issues
Date: Thu, 02 May 2019 15:36:29 +0200
Message-ID: <f113b2da-eef3-4c55-b5f9-e60032603ee3@manitou-mail.org> (raw)
In-Reply-To: <c8ceefea-88af-08a9-08ed-a4fc6ed223c7@mail.ru>
rihad wrote:
> Thanks for the reply. Do you know what would a "decent" ICU collation be
> to bind to a field's schema definition so it would mimic a UTF-8
> encoding for a multilingual column? Maybe und-x-icu? We aren't as much
> concerned about their sortability in most cases, we just want indexes to
> better handle future PG/ICU upgrades. But what does und(efined) even
> mean with respect to collations?
"undefined" in this context means unspecified language and
unspecified country or region. It implies that no language-specific
nor regional rule will be applied to compare strings.
Using C.UTF-8 as the collation for text fields to index may be the
best trade-off in your case. It should be immune to libc and ICU
upgrades.
With C.UTF-8, a string like 'BC' will sort before 'ab', and punctuation
and accents will also sort differently than with a linguistic-aware
collation.
If your applications care about that, it can be fixed by simply
adding COLLATE "default" to the ORDER BY clause of the queries that
are meant to present data to users.
COLLATE "default" means the collation of the database, which
presumably would be something like "language_REGION.UTF-8" in your
case. If you never specified it explicitly, it came from initdb which
itself got it from the environment of the server.
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: daniel@manitou-mail.org, rihad@mail.ru, pg@bowt.ie
Subject: Re: Upgrading locale issues
In-Reply-To: <f113b2da-eef3-4c55-b5f9-e60032603ee3@manitou-mail.org>
References: <c8ceefea-88af-08a9-08ed-a4fc6ed223c7@mail.ru> <f113b2da-eef3-4c55-b5f9-e60032603ee3@manitou-mail.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox