Re: Order changes in PG16 since ICU introduction
Jeff Davis <pgsql@j-davis.com>
On Fri, 2023-06-09 at 14:12 +0200, Daniel Verite wrote:
> > I implemented a compromise where initdb will
> > change C.UTF-8 to the built-in provider
>
> $ initdb --locale=C.UTF-8
...
> This setup is not what the user has asked for and leads to that kind
> of
> wrong results:
>
> $ psql -c "select upper('é')"
> ?column?
> ----------
> é
>
> whereas in v15 we would get the correct result 'É'.
I guess where I'm confused is: why would a user actually want their
database collation to be C.UTF-8? It's slower than C, our
implementation doesn't properly version it (as you pointed out), and
the semantics don't seem great ('Z' < 'a').
If the user specifies provider=libc, then of course we should honor
that and C.UTF-8 is a valid locale for libc.
But if they don't specify the provider, isn't it much more likely they
just don't care much about the locale, and would be happier with C?
Perhaps there's some better compromise here than the one I picked, but
I see this as a fairly small problem in comparison to the big problems
that we're solving.
> In general about the evolution of the patchset, your interpretation
> of "defaulting to ICU" seems to be "avoid libc at any cost", which
> IMV
> is unreasonably user-hostile.
The user can easily get libc behavior by specifying --locale-
provider=libc, so I don't see how you reached this conclusion.
Let me try to understand and address the points you raised here[1] in
more detail:
It looks like you are fine with 0003 applying LOCALE to whatever
provider is chosen, but you'd like to be smarter about choosing the
provider and to choose libc in at least some cases.
That is actually very much like option #2 in the list I presented
here[2], and has the same problems. How should the following behave?
initdb --locale=C --lc-collate=fr_FR.utf8
initdb --locale=en --lc-collate=fr_FR.utf8
If we switch to libc in the first case, then --locale will be ignored
and the collation will be fr_FR.utf8. But we will leave the second case
as ICU and the collation will be "en". I'm sure we can come up with
something there, but it feels like there's more room for confusion
along this path, and the builtin provider seems cleaner.
You also suggested that we consider switching the provider to libc any
time ICU doesn't support something. I'm not sure whether you meant a
static list (C, C.UTF-8, POSIX, ...?) or some kind of dynamic test. I'm
skeptical of being too smart here, but I'd like to hear what you mean.
I'm also not clear whether you think we should abandon the built-in
provider, or still select it for C/POSIX.
Regards,
Jeff Davis
[1]
https://www.postgresql.org/message-id/7de2dc15-5211-45b3-afcb-71dcaf7a08bb@manitou-mail.org
[2]
https://www.postgresql.org/message-id/daa9f060aa2349ebc84444515efece49e7b32c5d.camel@j-davis.com
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Introduce "builtin" collation provider.
- 2d819a08a1cb 17.0 landed
-
ICU: do not convert locale 'C' to 'en-US-u-va-posix'.
- f3a01af29b19 16.0 landed
- f7faa9976cc0 16.0 landed
-
initdb: change default --locale-provider back to libc.
- 2535c74b1a61 16.0 landed
-
CREATE DATABASE: make LOCALE apply to all collation providers.
- a14e75eb0b6a 16.0 landed
-
Remove read-only server settings lc_collate and lc_ctype
- b0f6c437160d 16.0 landed
-
ICU: use uloc_getDefault() for initdb.
- ec1264f01e37 16.0 landed
-
Doc fixes for commit 1e16af8ab5.
- f4a9422c0c37 16.0 landed
-
Doc: fix some rendering problems in the PDF docs build.
- b62381d9a23b 16.0 landed
-
Doc improvements for language tags and custom ICU collations.
- 1e16af8ab5d7 16.0 landed
-
ICU: check for U_STRING_NOT_TERMINATED_WARNING.
- 1c634f6647c2 16.0 landed
-
Reduce icu_validation_level default to WARNING.
- 6de31ce446e5 16.0 landed
-
Revert "ICU: do not convert locale 'C' to 'en-US-u-va-posix'."
- 455f948b0d03 16.0 landed
-
Fix initdb --no-locale.
- 5cd1a5af4d17 16.0 landed
-
Avoid character classification in regex escape parsing.
- c04c6c5d6f5f 16.0 cited