Re: Collation & ctype method table, and extension hooks
Andreas Karlsson <andreas@proxel.se>
From: Andreas Karlsson <andreas@proxel.se>
To: Jeff Davis <pgsql@j-davis.com>, pgsql-hackers@postgresql.org
Date: 2024-12-02T15:39:11Z
Lists: pgsql-hackers
Attachments
- v9-0001-Perform-provider-specific-initialization-code-in-.patch (text/x-patch) patch v9-0001
- v9-0002-Move-check-for-ucol_strcollUTF8-to-pg_locale_icu..patch (text/x-patch) patch v9-0002
- v9-0003-Move-code-for-collation-version-into-provider-spe.patch (text/x-patch) patch v9-0003
- v9-0004-Move-ICU-database-encoding-check-into-validation-.patch (text/x-patch) patch v9-0004
- v9-0005-Move-provider-specific-code-when-looking-up-local.patch (text/x-patch) patch v9-0005
- v9-0006-Control-collation-behavior-with-a-method-table.patch (text/x-patch) patch v9-0006
- v9-0007-Control-ctype-behavior-internally-with-a-method-t.patch (text/x-patch) patch v9-0007
- v9-0008-Remove-provider-field-from-pg_locale_t.patch (text/x-patch) patch v9-0008
- v9-0009-Make-provider-data-in-pg_locale_t-an-opaque-point.patch (text/x-patch) patch v9-0009
- v9-0010-Don-t-include-ICU-headers-in-pg_locale.h.patch (text/x-patch) patch v9-0010
- v9-0011-Introduce-hooks-for-creating-custom-pg_locale_t.patch (text/x-patch) patch v9-0011
Hi, I have not looked at the later patches in the series yet as I got sidetracked while reviewing and decided to clean up some related collation things which I added to the patch set (feel free to ignore them if you want). The goal of my added patches is to move provider specific code into fewer places and not have provider specific logic all over the codebase. I feel your first patch in the series is something you can just commit. It looks good and is simple, obvious refactoring. In theory we could share the code which does the lookup in the catalog table but I do not think it would be worth it. I fixed a small issue with it and the function prototypes in pg_collation.c. I will look at the rest of your patches later. My patches: = v9-0002-Move-check-for-ucol_strcollUTF8-to-pg_locale_icu..patch Broken out from v9-0010-Don-t-include-ICU-headers-in-pg_locale.h.patch. = v9-0003-Move-code-for-collation-version-into-provider-spe.patch Moves some code from pg_collate.c into provider specific files. = v9-0004-Move-ICU-database-encoding-check-into-validation-.patch Makes the ICU code more similar to the built-in provider plus reduces some code duplication. I feel we could go one step further and also only normalize built-in when "if (!IsBinaryUpgrade && dblocale != src_locale)" but I leave that for another patch if that is something we actually want to unify. = v9-0005-Move-provider-specific-code-when-looking-up-local.patch I did not like how namespace.c had knowledge of ICU. Andreas
Commits
-
Remove provider field from pg_locale_t.
- 8af0d0ab01b4 19 (unreleased) landed
-
Control ctype behavior internally with a method table.
- 5a38104b3642 19 (unreleased) landed
-
Control collation behavior with a method table.
- a2f17f004d22 18.0 landed
-
Move code for collation version into provider-specific files.
- 4f5cef2607c1 18.0 landed
-
Refactor string case conversion into provider-specific files.
- 86a5d6006aff 18.0 landed
-
Move check for ucol_strcollUTF8 to pg_locale_icu.c
- 7167e05fc7d1 18.0 landed
-
Perform provider-specific initialization in new functions.
- 1ba0782ce90c 18.0 landed
-
Refactor the code to create a pg_locale_t into new function.
- 3aa2373c1141 18.0 landed