Re: PG compilation error with Visual Studio 2015/2017/2019 - Mailing list pgsql-hackers

From davinder singh
Subject Re: PG compilation error with Visual Studio 2015/2017/2019
Date
Msg-id CAHzhFSH6ASijnzyc8aEu0mBR9-eU2hHHf203OeftAPmKapA3jA@mail.gmail.com
Whole thread Raw
In response to Re: PG compilation error with Visual Studio 2015/2017/2019  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: PG compilation error with Visual Studio 2015/2017/2019  (davinder singh <davindersingh2692@gmail.com>)
List pgsql-hackers

On Fri, Apr 10, 2020 at 5:33 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> It seems the right direction to use GetLocaleInfoEx as we have already
> used it to handle a similar problem (lc_codepage is missing in
> _locale_t in higher versions of MSVC (cf commit 0fb54de9aa)) in
> chklocale.c.  However, I see that we have added a manual parsing there
> if GetLocaleInfoEx doesn't parse it.  I think that addresses your
> concern for _create_locale handling bigger sets.  Don't we need
> something equivalent here for the cases which GetLocaleInfoEx doesn't
> support?
I am in investigating in similar lines, I think the following explanation can help.
From Microsoft doc.
The locale argument to the setlocale, _wsetlocale, _create_locale, and _wcreate_locale is 
locale :: "locale-name"
    | "language[_country-region[.code-page]]"
    | ".code-page"
    | "C"
    | ""
    | NULL

For GetLocaleInfoEx locale argument is
<language>-<REGION>
<language>-<Script>-<REGION>

As we can see _create_locale will also accept the locale appended with code-page but that is not the case in lateral.
The important point is in our current issue we need locale name only and both
functions(GetLocaleInfoEx, _create_locale) support an equal number of locales
names if go by the syntax of the locale described on Microsoft documents. With that thought, I am parsing the input
string to remove the code-page and give it as input to GelLocaleInfoEx.
I have attached the new patch.

> How have you ensured the testing of this code?  I see that we have
> src\test\locale in our test directory.  Can we test using that?
I don't know how to use these tests on windows, but I had a look in these tests, I didn't found any test which could hit the function we are modifying. 
I m still working on testing this patch. If anyone has Idea please suggest.

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pgsql: Improve handling of parameter differences in physicalreplicatio
Next
From: Amit Langote
Date:
Subject: Re: index paths and enable_indexscan