forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitddb5fdc
committed
Further hacking on ICU collation creation and usage.
pg_import_system_collations() refused to create any ICU collations ifthe current database's encoding didn't support ICU. This is wrongheaded:initdb must initialize pg_collation in an encoding-independent waysince it might be used in other databases with different encodings.The reason for the restriction seems to be that get_icu_locale_comment()used icu_from_uchar() to convert the UChar-format display name, and thatunsurprisingly doesn't know what to do in unsupported encodings.But by the same token that the initial catalog contents must beencoding-independent, we can't allow non-ASCII characters in the commentstrings. So we don't really need icu_from_uchar() here: just check forUnicode codes outside the ASCII range, and if there are none, the formatconversion is trivial. If there are some, we can simply not install thecomment. (In my testing, this affects only Norwegian Bokmål, which hasgiven us trouble before.)For paranoia's sake, also check for non-ASCII characters in ICU localenames, and skip such locales, as we do for libc locales. I don'tcurrently have a reason to believe that this will ever reject anything,but then again the libc maintainers should have known better too.With just the import changes, ICU collations can be found in pg_collationin databases with unsupported encodings. This resulted in more or lessclean failures at runtime, but that's not how things act for unsupportedencodings with libc collations. Make it work the same as our traditionalbehavior for libc collations by having collation lookup take into accountwhether is_encoding_supported_by_icu().Adjust documentation to match. Also, expand Table 23.1 to show whichencodings are supported by ICU.catversion bump because of likely change in pg_collation/pg_descriptioninitial contents in ICU-enabled builds.Discussion:https://postgr.es/m/20c74bc3-d6ca-243d-1bbc-12f17fa4fe9a@gmail.com1 parenta15b47d commitddb5fdc
File tree
4 files changed
+194
-87
lines changed- doc/src/sgml
- src
- backend
- catalog
- commands
- include/catalog
4 files changed
+194
-87
lines changed0 commit comments
Comments
(0)