Re: [HACKERS] Getting server crash on Windows when using ICU collation

Поиск
Список
Период
Сортировка
От Ashutosh Sharma
Тема Re: [HACKERS] Getting server crash on Windows when using ICU collation
Дата
Msg-id CAE9k0Pmzu=QiOrkOaYxDGL-L59UuCQDfDexq66+b7VWQpkzscQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Getting server crash on Windows when using ICUcollation  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: [HACKERS] Getting server crash on Windows when using ICU collation  (Amit Kapila <amit.kapila16@gmail.com>)
Re: [HACKERS] Getting server crash on Windows when using ICUcollation  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
Hi,

On Thu, Jun 15, 2017 at 8:36 PM, Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> On 6/12/17 00:38, Ashutosh Sharma wrote:
>> PFA patch that fixes the issue described in above thread. As mentioned
>> in the above thread, the crash is basically happening in varstr_cmp()
>> function and  it's  only happening on Windows because in varstr_cmp(),
>> if the collation provider is ICU, we don't even think of calling ICU
>> functions to compare the string. Infact, we directly attempt to call
>> the OS function wsccoll*() which is not expected. Thanks.
>
> Maybe just
>
> diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
> index a0dd391f09..2506f4eeb8 100644
> --- a/src/backend/utils/adt/varlena.c
> +++ b/src/backend/utils/adt/varlena.c
> @@ -1433,7 +1433,7 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid)
>
>  #ifdef WIN32
>                 /* Win32 does not have UTF-8, so we need to map to UTF-16 */
> -               if (GetDatabaseEncoding() == PG_UTF8)
> +               if (GetDatabaseEncoding() == PG_UTF8 && (!mylocale || mylocale->provider == COLLPROVIDER_LIBC))
>                 {
>                         int                     a1len;
>                         int                     a2len;

Oh, yes, this looks like the simplest and possibly the ideal way to
fix the issue. Attached is the patch. Thanks for the inputs.

-- 
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Вложения

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

Предыдущее
От: Ashutosh Sharma
Дата:
Сообщение: Re: [HACKERS] Getting server crash on Windows when using ICU collation
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: [HACKERS] Get stuck when dropping a subscription duringsynchronizing table