Re: Built-in CTYPE provider
Jeff Davis <pgsql@j-davis.com>
On Thu, 2024-01-18 at 13:53 +0100, Peter Eisentraut wrote: > I think that would be a terrible direction to take, because it would > regress the default sort order from "correct" to "useless". I don't agree that the current default is "correct". There are a lot of ways it can be wrong: * the environment variables at initdb time don't reflect what the users of the database actually want * there are so many different users using so many different applications connected to the database that no one "correct" sort order exists * libc has some implementation quirks * the version of Unicode that libc is based on is not what you expect * the version of libc is not what you expect > Aside from > the overall message this sends about how PostgreSQL cares about > locales > and Unicode and such. Unicode is primarily about the semantics of characters and their relationships. The patches I propose here do a great job of that. Collation (relationships between *strings*) is a part of Unicode, but not the whole thing or even the main thing. > Maybe you don't intend for this to be the default provider? I am not proposing that this provider be the initdb-time default. > But then > who would really use it? I mean, sure, some people would, but how > would > you even explain, in practice, the particular niche of users or use > cases? It's for users who want to respect Unicode support text from international sources in their database; but are not experts on the subject and don't know precisely what they want or understand the consequences. If and when such users do notice a problem with the sort order, they'd handle it at that time (perhaps with a COLLATE clause, or sorting in the application). > Maybe if this new provider would be called "minimal", it might > describe > the purpose better. "Builtin" communicates that it's available everywhere (not a dependency), that specific behaviors can be documented and tested, and that behavior doesn't change within a major version. I want to communicate all of those things. > I could see a use for this builtin provider if it also included the > default UCA collation (what COLLATE UNICODE does now). I won't rule that out, but I'm not proposing that right now and my proposal is already offering useful functionality. > There would still be a risk with that approach, since it would > permanently marginalize ICU functionality Yeah, ICU already does a good job offering the root collation. I don't think the builtin provider needs to do so. > I would be curious what your overall vision is here? Vision: * The builtin provider will offer Unicode character semantics, basic collation, platform-independence, and high performance. It can be used on its own or in combination with ICU via the COLLATE clause. * ICU offers COLLATE UNICODE, locale tailoring, case-insensitive matching, and customization with rules. It's the solution for everything from "slightly more advanced" to "very advanced". * libc would be for databases serving applications on the same machine where a matching sort order is helpful, risks to indexes are acceptable, and performance is not important. > Is switching the > default to ICU still your goal? Or do you want the builtin provider > to > be the default? It's hard to answer this question while initdb chooses the database default collation based on the environment. Neither ICU nor the builtin provider can reasonably handle whatever those environment variables might be set to. Stepping back from the focus on what initdb does, we should be providing the right encouragement in documentation and packaging to guide users toward the right provider based their needs and the vision outlined above. Regards, Jeff Davis
Commits
-
Support PG_UNICODE_FAST locale in the builtin collation provider.
- d3d098316913 18.0 landed
-
Support Unicode full case mapping and conversion.
- 286a365b9c25 18.0 landed
-
Fix test failures when language environment is not UTF-8.
- e2a235767180 17.0 landed
-
Add unicode_strtitle() for Unicode Default Case Conversion.
- 46e5441fa536 17.0 landed
-
Use version for builtin collations.
- 46a44dc37203 17.0 landed
-
Fix convert_case(), introduced in 5c40364dd6.
- 503c0ad976f5 17.0 landed
-
Inline basic UTF-8 functions.
- 9acae56ce0b0 17.0 landed
-
Support C.UTF-8 locale in the new builtin collation provider.
- f69319f2f1fb 17.0 landed
-
Fix another warning, introduced by 846311051e.
- 60769c62dc85 17.0 landed
-
Address more review comments on commit 2d819a08a1.
- 846311051e8f 17.0 landed
-
Fix unreachable code warning from commit 2d819a08a1.
- 61f352ece9e7 17.0 landed
-
Introduce "builtin" collation provider.
- 2d819a08a1cb 17.0 landed
-
Catalog changes preparing for builtin collation provider.
- f696c0cd5f29 17.0 landed
-
Unicode case mapping tables and functions.
- 5c40364dd6d9 17.0 landed
-
Add Unicode property tables.
- ad49994538c5 17.0 landed
-
Documentation update for Standard Collations.
- 875e46a0a246 17.0 landed
-
Cleanup for unicode-update build target and test.
- cf64d4e99f64 17.0 landed
-
Shrink Unicode category table.
- 719b342d36ce 17.0 landed
-
Make some error strings more generic
- 36a14afc0760 17.0 cited
-
pg_upgrade: copy locale and encoding information to new cluster.
- 9637badd9f92 16.0 cited
-
Update Unicode data to Unicode 15.0.0
- 1091b48cd761 16.0 cited
-
Create a new type category for "internal use" types.
- 07eee5a0dc64 15.0 cited