diff options
author | Jeff Davis <jdavis@postgresql.org> | 2023-03-21 15:49:18 -0700 |
---|---|---|
committer | Jeff Davis <jdavis@postgresql.org> | 2023-03-21 16:12:37 -0700 |
commit | 869650fa86adf74fca7f566c9317f6310f8b400c (patch) | |
tree | af7d8d55d8e5114f030ddd40926c46f59166a4f0 /src/backend/commands/collationcmds.c | |
parent | e8e1f96c497bda50ec02ed7360a6ed56c5f70f60 (diff) | |
download | postgresql-869650fa86adf74fca7f566c9317f6310f8b400c.tar.gz postgresql-869650fa86adf74fca7f566c9317f6310f8b400c.zip |
Support language tags in older ICU versions (53 and earlier).
By calling uloc_canonicalize() before parsing the attributes, the
existing locale attribute parsing logic works on language tags as
well.
Fix a small memory leak, too.
Discussion: http://postgr.es/m/60da0cecfb512a78b8666b31631a636215d8ce73.camel@j-davis.com
Reviewed-by: Peter Eisentraut
Diffstat (limited to 'src/backend/commands/collationcmds.c')
-rw-r--r-- | src/backend/commands/collationcmds.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c index 8949684afe1..3d0aea05685 100644 --- a/src/backend/commands/collationcmds.c +++ b/src/backend/commands/collationcmds.c @@ -950,7 +950,6 @@ pg_import_system_collations(PG_FUNCTION_ARGS) const char *name; char *langtag; char *icucomment; - const char *iculocstr; Oid collid; if (i == -1) @@ -959,20 +958,19 @@ pg_import_system_collations(PG_FUNCTION_ARGS) name = uloc_getAvailable(i); langtag = get_icu_language_tag(name); - iculocstr = U_ICU_VERSION_MAJOR_NUM >= 54 ? langtag : name; /* * Be paranoid about not allowing any non-ASCII strings into * pg_collation */ - if (!pg_is_ascii(langtag) || !pg_is_ascii(iculocstr)) + if (!pg_is_ascii(langtag)) continue; collid = CollationCreate(psprintf("%s-x-icu", langtag), nspid, GetUserId(), COLLPROVIDER_ICU, true, -1, - NULL, NULL, iculocstr, NULL, - get_collation_actual_version(COLLPROVIDER_ICU, iculocstr), + NULL, NULL, langtag, NULL, + get_collation_actual_version(COLLPROVIDER_ICU, langtag), true, true); if (OidIsValid(collid)) { |