From: | Victor Wagner <vitus(at)wagner(dot)pp(dot)ru> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: PostgreSQL 10 (latest beta) and older ICU |
Date: | 2017-07-26 06:33:53 |
Message-ID: | 20170726093353.3adbb111@fafnir.local.vm |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, 25 Jul 2017 16:50:38 -0400
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Victor Wagner <vitus(at)wagner(dot)pp(dot)ru> writes:
> > PostgreSQL 10 when build with --with-icu requires ICU 4.6 and above.
> > (because it searches for libicu using pkgconfig, and pgkconfig
> > support significantly changed in ICU version 4.6)
>
> > However, there are some reasons to build PostgreSQL with older
> > versions of ICU.
>
> No doubt, but making that happen seems like a feature, and IMO we're
> too late in the v10 beta test cycle to be taking new features on
May be PGDG people could integrate it as a patch for RPMS for
particular systems which are affected by the problem.
I'd rather say that it is bugfix. Relaxing too strict checking.
If we choose approach to allow non-strict language tags, it is oneline
patch.
If we choose more safe approach to ignore non-strict collations, it
would take about five lines
1. Replace one ereport(ERROR with ereport(WARINING
2. Return special value (NULL) after issuing this warning
3. Handle this special value in calling function by continuing to next
loop iteration
4,5 - curly braces around 1 and 2. see patch at the end
> board, especially ones with inherently-large portability risks. We
I don't think that there are so large portability risks. Patch can be
done such way that it would behave exactly as now if ICU version is 4.6
or above. Moreover, it is easy to make old ICU support separate
configure option (because another configure test is needed anyway).
> could maybe consider patches for this for v11 ... but will anyone
> still care by then?
Undoubtedly will. v11 is expedted to be released in 2018. And RHEL 6
is supported until 2020, and extended support would end in Nov 2023.
And it is possible that some derived distribution would last longer.
> (Concretely, my concern is that the alpha and beta testing that's
> happened so far hasn't covered pre-4.6 ICU at all. I'd be surprised
> if the incompatibility you found so far is the only one.)
diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c
index b6c14c9..9e5da98 100644
--- a/src/backend/commands/collationcmds.c
+++ b/src/backend/commands/collationcmds.c
@@ -442,11 +442,13 @@ get_icu_language_tag(const char *localename)
status = U_ZERO_ERROR;
uloc_toLanguageTag(localename, buf, sizeof(buf), TRUE, &status);
- if (U_FAILURE(status))
- ereport(ERROR,
+ if (U_FAILURE(status))
+ {
+ ereport(WARNING,
(errmsg("could not convert locale name \"%s\" to language tag: %s",
localename, u_errorName(status))));
-
+ return NULL;
+ }
return pstrdup(buf);
}
@@ -733,6 +735,10 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
char *localeid = psprintf("%s(at)collation=%s", name, val);
langtag = get_icu_language_tag(localeid);
+ if (langtag == NULL) {
+ /* No such collation in library, skip */
+ continue;
+ }
collcollate = U_ICU_VERSION_MAJOR_NUM >= 54 ? langtag : localeid;
/*
From | Date | Subject | |
---|---|---|---|
Next Message | Etsuro Fujita | 2017-07-26 06:38:34 | Re: UPDATE of partition key |
Previous Message | Ashutosh Bapat | 2017-07-26 06:32:20 | Re: Partition-wise join for join between (declaratively) partitioned tables |