Re: [HACKERS] PostgreSQL 10 (latest beta) and older ICU

Поиск
Список
Период
Сортировка
От Victor Wagner
Тема Re: [HACKERS] PostgreSQL 10 (latest beta) and older ICU
Дата
Msg-id 20170726093353.3adbb111@fafnir.local.vm
обсуждение исходный текст
Ответ на Re: [HACKERS] PostgreSQL 10 (latest beta) and older ICU  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Tue, 25 Jul 2017 16:50:38 -0400
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Victor Wagner <vitus@wagner.pp.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
languagetag: %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@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;                              /*
 







В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ashutosh Bapat
Дата:
Сообщение: Re: [HACKERS] Partition-wise join for join between (declaratively)partitioned tables
Следующее
От: Etsuro Fujita
Дата:
Сообщение: Re: [HACKERS] UPDATE of partition key