RE: ICU for global collation
Shinoda, Noriyoshi <noriyoshi.shinoda@hpe.com>
Attachments
- pg_database_iculocale_v1.diff (application/octet-stream) patch v1
Hi, Thank you to all the developers. I found that the description of the pg_database.daticulocale column was not written in the documentation. The attached small patch adds a description of the daticulocale column to catalogs.sgml. Regards, Noriyoshi Shinoda -----Original Message----- From: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Sent: Thursday, March 17, 2022 7:29 PM To: Julien Rouhaud <rjuju123@gmail.com> Cc: pgsql-hackers <pgsql-hackers@postgresql.org>; Daniel Verite <daniel@manitou-mail.org> Subject: Re: ICU for global collation On 15.03.22 08:41, Julien Rouhaud wrote: >>>> The locale object in ICU is an identifier that specifies a >>>> particular locale and has fields for language, country, and an >>>> optional code to specify further variants or subdivisions. These >>>> fields also can be represented as a string with the fields separated by an underscore. >> >> I think the Localization chapter needs to be reorganized a bit, but >> I'll leave that for a separate patch. > > WFM. I ended up writing a bit of content for that chapter. >>> While on that topic, the doc should probably mention that default >>> ICU collations can only be deterministic. >> >> Well, there is no option to do otherwise, so I'm not sure where/how >> to mention that. We usually don't document options that don't exist. >> ;-) > > Sure, but I'm afraid that users may still be tempted to use ICU > locales like > und-u-ks-level2 from the case_insensitive example in the doc and hope > that it will work accordingly. Or maybe it's just me that still sees > ICU as dark magic and want to be extra cautious. I have added this to the CREATE DATABASE ref page. > Unrelated, but I just realized that we have PGC_INTERNAL gucs for > lc_ctype and lc_collate. Should we add one for icu_locale too? I'm not sure. I think the existing ones are more for backward compatibility with the time before it was settable per database. >>> in AlterCollation(), pg_collation_actual_version(), >>> AlterDatabaseRefreshColl() and pg_database_collation_actual_version(): >>> >>> - datum = SysCacheGetAttr(COLLOID, tup, Anum_pg_collation_collcollate, &isnull); >>> - Assert(!isnull); >>> - newversion = get_collation_actual_version(collForm->collprovider, TextDatumGetCString(datum)); >>> + datum = SysCacheGetAttr(COLLOID, tup, collForm->collprovider == COLLPROVIDER_ICU ? Anum_pg_collation_colliculocale : Anum_pg_collation_collcollate, &isnull); >>> + if (!isnull) >>> + newversion = get_collation_actual_version(collForm->collprovider, TextDatumGetCString(datum)); >>> + else >>> + newversion = NULL; >>> >>> The columns are now nullable, but can you actually end up with a >>> null locale name in the expected field without manual DML on the >>> catalog, corruption or similar? I think it should be a plain error >>> explaining the inconsistency rather then silently assuming there's >>> no version. Note that at least >>> pg_newlocale_from_collation() asserts that the specific libc/icu >>> field it's interested in isn't null. >> >> This is required because the default collations's fields are null now. > > Yes I saw that, but that's a specific exception. Detecting whether > it's the DEFAULT_COLLATION_OID or not and raise an error when a null > value isn't expected seems like it could be worthwhile. I have fixed that as you suggest. > So apart from the few details mentioned above I'm happy with this patch! committed!
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add CHECK_FOR_INTERRUPTS while restoring changes during decoding.
- ce20f8b9f435 16.0 cited
-
Improve ICU option handling in CREATE DATABASE
- e59a67fb8fe1 16.0 landed
- 865b52af6104 15.0 landed
-
Don't allow creation of database with ICU locale with unsupported encoding
- c7db01e325a5 16.0 landed
- 148f66d59e2c 15.0 landed
-
Make locale option behavior more consistent
- da5d4ea5aaac 16.0 landed
- 3e694b318d20 15.0 landed
-
pg_dump: Dump colliculocale
- 72b6828da3f7 15.0 landed
- 396d348b046c 16.0 landed
-
Remove further unwanted linker flags from perl_embed_ldflags
- b4e936859dc4 16.0 cited
-
Doc: document possible need to raise kernel's somaxconn limit.
- 2c63b0930aee 15.0 cited
-
Reduce warnings with -Wshadow=compatible-local builds
- 92fce4e1eda9 16.0 cited
-
Remove redundant spaces in _outA_Expr() output
- 1c5818b9c68e 16.0 cited
-
Fix outdated --help message for postgres -f
- 63b64d827069 14.6 cited
-
pg_upgrade: Fix version comparison for global ICU support
- fa06a34d14ea 15.0 landed
-
Silence -Wmaybe-uninitialized compiler warning in dbcommands.c.
- 97bddda61b9a 15.0 landed
-
Add option to use ICU as global locale provider
- f2553d43060e 15.0 landed
-
DefineCollation() code cleanup
- e94bb1473eb3 15.0 landed
-
Change collate and ctype fields to type text
- 54637508f87b 15.0 landed
-
Call pg_newlocale_from_collation() also with default collation
- b99ccd2cb217 15.0 landed
-
Use libc version as a collation version on glibc systems.
- d5ac14f9ccdd 13.0 cited
-
Silence -Wmaybe-uninitialized compiler warnings in dbcommands.c.
- 3f6b3be39ca9 13.0 cited
-
Make LC_COLLATE and LC_CTYPE database-level settings. Collation and
- 61d967498802 8.4.0 cited