Re: Re: [COMMITTERS] pgsql: setlocale() on Windows doesn't work correctly if the locale name

Поиск
Список
Период
Сортировка
От Hiroshi Inoue
Тема Re: Re: [COMMITTERS] pgsql: setlocale() on Windows doesn't work correctly if the locale name
Дата
Msg-id 4DAEDCB6.4010000@tpf.co.jp
обсуждение исходный текст
Ответ на Re: Re: [COMMITTERS] pgsql: setlocale() on Windows doesn't work correctly if the locale name  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Ответы Re: Re: [COMMITTERS] pgsql: setlocale() on Windows doesn't work correctly if the locale name  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
(2011/04/20 15:30), Heikki Linnakangas wrote:
> On 20.04.2011 06:48, Hiroshi Inoue wrote:
>> I can find no concrete reference to problems about locale
>>    names containing dots. Is the following an example?
> 
> Yes.
> 
>> In my environment (Windows Vista using VC8)
>>
>>     setlocale(LC_XXXX, "Chinese (Traditional)_MCO.950");
>> works and
>>     setlocale(LC_XXXX, NULL);
>> returns
>>     Chinese (Traditional)_Macao S.A.R..950

but setlocale(LC_XXXX, "Chinese (Traditional)_Macao S.A.R..950");
fails.

I see another issue for the behavior.

For example, the following code in src/backend/utis/adt/pg_locale.c
won't work as expected in case the current locale is Hong Kong, Macao or
UAE because the last setlocale() in the code would fail. I can
find such save & restore operations of locales in several places.

bool
check_locale(int category, const char *value)
{char       *save;bool        ret;
save = setlocale(category, NULL);if (!save)    return false;            /* won't happen, we hope */
/* save may be pointing at a modifiable scratch variable, see above */save = pstrdup(save);
/* set the locale with setlocale, to see if it accepts it. */ret = (setlocale(category, value) != NULL);
setlocale(category, save);    /* assume this won't fail */pfree(save);
return ret;
}

regards,
Hiroshi Inoue


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Re: [COMMITTERS] pgsql: setlocale() on Windows doesn't work correctly if the locale name
Следующее
От: Robert Haas
Дата:
Сообщение: Re: time-delayed standbys