Lists: | pgsql-hackers |
---|
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-06 11:07:57 |
Message-ID: | CAHzhFSFoJEWezR96um4-rg5W6m2Rj9Ud2CNZvV4NWc9tXV7aXQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi All,
I am working on “pg_locale compilation error with Visual Studio 2017”,
Related threads[1],[2].
We are getting compilation error in static char *IsoLocaleName(const char
*winlocname) function in pg_locale.c file. This function is trying to
convert the locale name into the Unix style. For example, it will change
the locale name "en-US" into "en_US".
It is creating a locale using _locale_t _create_locale( int category, const
char *locale) and then trying to access the name of that locale by pointing
to internal elements of the structure loct->locinfo->locale_name[LC_CTYPE]
but it has been missing from the _locale_t since VS2015 which is causing
the compilation error. I found a few useful APIs that can be used here.
ResolveLocaleName and GetLocaleInfoEx both can take locale in the following
format.
<language>-<REGION>
<language>-<Script>-<REGION>
ResolveLocaleName will try to find the closest matching locale name to the
input locale name even if the input locale name is invalid given that the
<language> is correct.
en-something-YZ => en-US
ex-US => error
Aa-aaaa-aa => aa-ET represents (Afar,Ethiopia)
Aa-aaa-aa => aa-ET
Refer [4] for more details
But in the case of GetLocaleInfoEx, it will only check the format of the
input locale, as mentioned before, if correct it will return the name of
the locale otherwise it will return an error.
For example.
en-something-YZ => error
ex-US => ex-US
aa-aaaa-aa => aa-Aaaa-AA
aa-aaa-aa => error.
Refer [5] for more details.
Currently, it is using _create_locale it behaves similarly to
GetLocaleInfoEx i.e. it also only checks the format only difference is for
a bigger set.
I thought of using GetLocaleInfoEx for the fix because it behaves similarly
to the already existing and a similar issue was resolved earlier using the
same. I have attached the patch, let me know your thoughts.
[1]
/message-id/e317eec9-d40d-49b9-b776-e89cf1d18c82@postgrespro.ru
[2] /message-id/23073.1526049547%40sss.pgh.pa.us
[3] https://docs.microsoft.com/en-us/windows/win32/intl/locale-names
[4]
https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-resolvelocalename
[5]
https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getlocaleinfoex
--
Regards,
Davinder.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019.patch | application/octet-stream | 3.8 KB |
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | davinder singh <davindersingh2692(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-06 14:47:17 |
Message-ID: | CAC+AXB3XvPekJ2c_X2jG6y+zyRkcaDxVBW2=rVyRLbGZOz8qpg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Apr 6, 2020 at 1:08 PM davinder singh <davindersingh2692(at)gmail(dot)com>
wrote:
>
> I am working on “pg_locale compilation error with Visual Studio 2017”,
> Related threads[1],[2].
> We are getting compilation error in static char *IsoLocaleName(const char
> *winlocname) function in pg_locale.c file. This function is trying to
> convert the locale name into the Unix style. For example, it will change
> the locale name "en-US" into "en_US".
>
How do you reproduce this issue with Visual Studio? I see there is an ifdef
directive above IsoLocaleName():
#if defined(WIN32) && defined(LC_MESSAGES)
I would expect defined(LC_MESSAGES) to be false in MSVC.
Regards,
Juan José Santamaría Flecha
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-07 05:43:59 |
Message-ID: | CAHzhFSGFSSMfX2uPV+CVfP73KtHVFEt7=BP+ZzGaJ54W+jYStQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Apr 6, 2020 at 8:17 PM Juan José Santamaría Flecha <
juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> How do you reproduce this issue with Visual Studio? I see there is an
> ifdef directive above IsoLocaleName():
>
> #if defined(WIN32) && defined(LC_MESSAGES)
>
> I would expect defined(LC_MESSAGES) to be false in MSVC.
>
You need to enable NLS support in the config file. Let me know if that
answers your question.
--
Regards,
Davinder.
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | davinder singh <davindersingh2692(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-07 15:00:18 |
Message-ID: | CAC+AXB2uv36fbZC7jeCMuLzxycwM+Pkqgqe34Jq-jHknbuDy+A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 7, 2020 at 7:44 AM davinder singh <davindersingh2692(at)gmail(dot)com>
wrote:
>
> You need to enable NLS support in the config file. Let me know if that
> answers your question.
>
Yes, I can see where this is coming from now, thanks.
Currently, it is using _create_locale it behaves similarly to
> GetLocaleInfoEx i.e. it also only checks the format only difference is for
> a bigger set.
> I thought of using GetLocaleInfoEx for the fix because it behaves
> similarly to the already existing and a similar issue was resolved earlier
> using the same. I have attached the patch, let me know your thoughts.
>
You are right, that the way to get the locale name information is through
GetLocaleInfoEx().
A couple of comments on the patch:
* I think you could save a couple of code lines, and make it clearer, by
merging both tests on _MSC_VER into a single #if... #else and leaving as
common code:
+ }
+ else
+ return NULL;
+#endif /*_MSC_VER && _MSC_VER < 1900*/
* The logic on "defined(_MSC_VER) && (_MSC_VER >= 1900)" is defined as
"_WIN32_WINNT >= 0x0600" on other parts of the code. I would
recommend using the later.
* This looks like a spurious change:
- sizeof(iso_lc_messages), NULL);
+ sizeof(iso_lc_messages), NULL);
Regards,
Juan José Santamaría Flecha
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-08 07:02:51 |
Message-ID: | CAHzhFSHudQRufGzH3KmjMxxQqTEPsewf-4Dck29fEuKw6QAkcw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 7, 2020 at 8:30 PM Juan José Santamaría Flecha <
juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> * The logic on "defined(_MSC_VER) && (_MSC_VER >= 1900)" is defined as
> "_WIN32_WINNT >= 0x0600" on other parts of the code. I would
> recommend using the later.
>
I think "_WIN32_WINNT >= 0x0600" represents windows versions only and
doesn't include any information about Visual Studio versions. So I am
sticking to " defined(_MSC_VER) && (_MSC_VER >= 1900)".
I have resolved other comments. I have attached a new version of the patch.
--
Regards,
Davinder.
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019.patch | application/octet-stream | 3.7 KB |
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | davinder singh <davindersingh2692(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-08 14:09:33 |
Message-ID: | CAC+AXB1ryKj6P9X-PEqT92vhLH5JJc7GkR3eVGdqZBE9PHaAoQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 8, 2020 at 9:03 AM davinder singh <davindersingh2692(at)gmail(dot)com>
wrote:
> On Tue, Apr 7, 2020 at 8:30 PM Juan José Santamaría Flecha <
> juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
>>
>> * The logic on "defined(_MSC_VER) && (_MSC_VER >= 1900)" is defined as
>> "_WIN32_WINNT >= 0x0600" on other parts of the code. I would
>> recommend using the later.
>>
> I think "_WIN32_WINNT >= 0x0600" represents windows versions only and
> doesn't include any information about Visual Studio versions. So I am
> sticking to " defined(_MSC_VER) && (_MSC_VER >= 1900)".
>
Let me explain further, in pg_config_os.h you can check that the value of
_WIN32_WINNT is solely based on checking _MSC_VER. This patch should also
be meaningful for WIN32 builds using MinGW, or we might see this issue
reappear in those systems if update the MIN_WINNT value to more current
OS versions. So, I still think _WIN32_WINNT is a better option.
I have resolved other comments. I have attached a new version of the patch.
>
I still see the same last lines in both #ifdef blocks, and pgindent might
change a couple of lines to:
+ MultiByteToWideChar(CP_ACP, 0, winlocname, -1, wc_locale_name,
+ LOCALE_NAME_MAX_LENGTH);
+
+ if ((GetLocaleInfoEx(wc_locale_name, LOCALE_SNAME,
+ (LPWSTR)&buffer, LOCALE_NAME_MAX_LENGTH)) > 0)
+ {
But that is pretty trivial stuff.
Please open an item in the commitfest for this patch.
Regards,
Juan José Santamaría Flecha
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-09 08:25:22 |
Message-ID: | CAHzhFSE4EA4K0U5ht5L=kA2=gfy=YjyaECp2ghC0y1_3uUzkMA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 8, 2020 at 7:39 PM Juan José Santamaría Flecha
> Let me explain further, in pg_config_os.h you can check that the value of
> _WIN32_WINNT is solely based on checking _MSC_VER. This patch should also
> be meaningful for WIN32 builds using MinGW, or we might see this issue
> reappear in those systems if update the MIN_WINNT value to more current
> OS versions. So, I still think _WIN32_WINNT is a better option.
>
Thanks for explanation, I was not aware of that, you are right it make
sense to use " _WIN32_WINNT", Now I am using this only.
I still see the same last lines in both #ifdef blocks, and pgindent might
> change a couple of lines to:
> + MultiByteToWideChar(CP_ACP, 0, winlocname, -1, wc_locale_name,
> + LOCALE_NAME_MAX_LENGTH);
> +
> + if ((GetLocaleInfoEx(wc_locale_name, LOCALE_SNAME,
> + (LPWSTR)&buffer, LOCALE_NAME_MAX_LENGTH)) > 0)
> + {
>
Now I have resolved these comments also, Please check updated version of
the patch.
> Please open an item in the commitfest for this patch.
>
I have created with same title.
--
Regards,
Davinder
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019.patch | application/octet-stream | 3.7 KB |
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | davinder singh <davindersingh2692(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-10 12:03:06 |
Message-ID: | CAA4eK1JAPdBnf2iD+M2_4A5P=+MTaL_7Fz9zft4w=SkoqZ5RDA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Apr 6, 2020 at 4:38 PM davinder singh
<davindersingh2692(at)gmail(dot)com> wrote:
>
> Hi All,
>
> I am working on “pg_locale compilation error with Visual Studio 2017”, Related threads[1],[2].
> We are getting compilation error in static char *IsoLocaleName(const char *winlocname) function in pg_locale.c file. This function is trying to convert the locale name into the Unix style. For example, it will change the locale name "en-US" into "en_US".
> It is creating a locale using _locale_t _create_locale( int category, const char *locale) and then trying to access the name of that locale by pointing to internal elements of the structure loct->locinfo->locale_name[LC_CTYPE] but it has been missing from the _locale_t since VS2015 which is causing the compilation error. I found a few useful APIs that can be used here.
>
> ResolveLocaleName and GetLocaleInfoEx both can take locale in the following format.
> <language>-<REGION>
> <language>-<Script>-<REGION>
>
> ResolveLocaleName will try to find the closest matching locale name to the input locale name even if the input locale name is invalid given that the <language> is correct.
>
> en-something-YZ => en-US
> ex-US => error
> Aa-aaaa-aa => aa-ET represents (Afar,Ethiopia)
> Aa-aaa-aa => aa-ET
>
> Refer [4] for more details
>
> But in the case of GetLocaleInfoEx, it will only check the format of the input locale, as mentioned before, if correct it will return the name of the locale otherwise it will return an error.
> For example.
>
> en-something-YZ => error
> ex-US => ex-US
> aa-aaaa-aa => aa-Aaaa-AA
> aa-aaa-aa => error.
>
> Refer [5] for more details.
>
> Currently, it is using _create_locale it behaves similarly to GetLocaleInfoEx i.e. it also only checks the format only difference is for a bigger set.
> I thought of using GetLocaleInfoEx for the fix because it behaves similarly to the already existing and a similar issue was resolved earlier using the same.
>
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?
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?
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | davinder singh <davindersingh2692(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-10 12:05:31 |
Message-ID: | CAA4eK1Ktofh=oJhjpfmEnQs72iiMFWF0dansrk6hYn6kcF5F6w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 7, 2020 at 8:30 PM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> * I think you could save a couple of code lines, and make it clearer, by merging both tests on _MSC_VER into a single #if... #else and leaving as common code:
> + }
> + else
> + return NULL;
> +#endif /*_MSC_VER && _MSC_VER < 1900*/
>
> * The logic on "defined(_MSC_VER) && (_MSC_VER >= 1900)" is defined as "_WIN32_WINNT >= 0x0600" on other parts of the code. I would recommend using the later.
>
I see that we have used _MSC_VER form of checks in win32_langinfo
(chklocale.c) for a similar kind of handling. So, isn't it better to
be consistent with that? Which exact part of the code you are
referring to?
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | davinder singh <davindersingh2692(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-10 12:25:45 |
Message-ID: | CAA4eK1+xF1qtt_EWiMTbpUoRow_EZN1CqXWhpE_GWjhGkrHm4A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, Apr 10, 2020 at 5:35 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Tue, Apr 7, 2020 at 8:30 PM Juan José Santamaría Flecha
> <juanjo(dot)santamaria(at)gmail(dot)com> wrote:
> >
> > * I think you could save a couple of code lines, and make it clearer, by merging both tests on _MSC_VER into a single #if... #else and leaving as common code:
> > + }
> > + else
> > + return NULL;
> > +#endif /*_MSC_VER && _MSC_VER < 1900*/
> >
> > * The logic on "defined(_MSC_VER) && (_MSC_VER >= 1900)" is defined as "_WIN32_WINNT >= 0x0600" on other parts of the code. I would recommend using the later.
> >
>
> I see that we have used _MSC_VER form of checks in win32_langinfo
> (chklocale.c) for a similar kind of handling. So, isn't it better to
> be consistent with that? Which exact part of the code you are
> referring to?
>
I see that the kind of check you are talking is recently added by
commit 352f6f2d. I think it is better to be consistent in all places.
Let's pick one and use that if possible.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | davinder singh <davindersingh2692(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-10 15:05:26 |
Message-ID: | CAC+AXB3q34+SMkLZMrDobpJnTmeLBhmnBfz7KmpRG=FSppfaFw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, Apr 10, 2020 at 2:25 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> I see that the kind of check you are talking is recently added by
> commit 352f6f2d. I think it is better to be consistent in all places.
> Let's pick one and use that if possible.
Currently there are two constructs to test the same logic, which is not
great. I think that using _MSC_VER makes it seem as MSVC exclusive code,
when MinGW should also be considered.
In the longterm aligning Postgres with MS product obsolescence will make
these tests unneeded, but I can propose a patch for making the test
consistent in all cases, on a different thread since this has little to do
with $SUBJECT.
Regards,
Juan José Santamaría Flecha
>
>
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-14 07:37:40 |
Message-ID: | CAHzhFSH6ASijnzyc8aEu0mBR9-eU2hHHf203OeftAPmKapA3jA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, Apr 10, 2020 at 5:33 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)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.
[1] https://docs.microsoft.com/en-us/windows/win32/intl/locale-names
[2]
https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getlocaleinfoex
[3]
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/create-locale-wcreate-locale?view=vs-2019
--
Regards,
Davinder
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v03.patch | application/octet-stream | 2.2 KB |
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-15 06:08:16 |
Message-ID: | CAHzhFSFowCDeuFG9+CLGeN4j8u_Dk0GCF2scTf=mVQNVRRNzjg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Thanks for the review comments.
On Tue, Apr 14, 2020 at 9:12 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> >>I m still working on testing this patch. If anyone has Idea please
> suggest.
> I still see problems with this patch.
>
> 1. Variable loct have redundant initialization, it would be enough to
> declare so: _locale_t loct;
> 2. Style white space in variable rc declaration.
> 3. Style variable cp_index can be reduced.
> if (tmp != NULL) {
> size_t cp_index;
>
> cp_index = (size_t)(tmp - winlocname);
> strncpy(loc_name, winlocname, cp_index);
> loc_name[cp_index] = '\0';
> 4. Memory leak if _WIN32_WINNT >= 0x0600 is true, _free_locale(loct); is
> not called.
>
I resolved the above comments.
> 5. Why call _create_locale if _WIN32_WINNT >= 0x0600 is true and loct is
> not used?
>
_create_locale can take bigger input than GetLocaleInfoEx. But we are
interested in
*language[_country-region[.code-page]]*. We are using _create_locale to
validate
the given input. The reason is we can't verify the locale name if it is
appended with
code-page by using GetLocaleInfoEx. So before parsing, we verify if the
whole input
locale name is valid by using _create_locale. I hope that answers your
question.
I have attached the patch.
--
Regards,
Davinder
EnterpriseDB: http://www.enterprisedb.com
On Tue, Apr 14, 2020 at 1:07 PM davinder singh <davindersingh2692(at)gmail(dot)com>
wrote:
>
> On Fri, Apr 10, 2020 at 5:33 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)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.
>
> [1] https://docs.microsoft.com/en-us/windows/win32/intl/locale-names
> [2]
> https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getlocaleinfoex
> [3]
> https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/create-locale-wcreate-locale?view=vs-2019
> --
> Regards,
> Davinder
> EnterpriseDB: http://www.enterprisedb.com
>
--
Regards,
Davinder
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v04.patch | application/octet-stream | 2.2 KB |
From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | davinder singh <davindersingh2692(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-15 14:45:40 |
Message-ID: | CAEudQAqohr5ij4eWQatcKRyygQbQGcvjjyD0d_-nr-tKX5MXdg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Em qua., 15 de abr. de 2020 às 03:08, davinder singh <
davindersingh2692(at)gmail(dot)com> escreveu:
>
> Thanks for the review comments.
>
> On Tue, Apr 14, 2020 at 9:12 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
>
>> >>I m still working on testing this patch. If anyone has Idea please
>> suggest.
>> I still see problems with this patch.
>>
>> 1. Variable loct have redundant initialization, it would be enough to
>> declare so: _locale_t loct;
>> 2. Style white space in variable rc declaration.
>> 3. Style variable cp_index can be reduced.
>> if (tmp != NULL) {
>> size_t cp_index;
>>
>> cp_index = (size_t)(tmp - winlocname);
>> strncpy(loc_name, winlocname, cp_index);
>> loc_name[cp_index] = '\0';
>> 4. Memory leak if _WIN32_WINNT >= 0x0600 is true, _free_locale(loct); is
>> not called.
>>
> I resolved the above comments.
>
Ok, thanks.
>
>> 5. Why call _create_locale if _WIN32_WINNT >= 0x0600 is true and loct is
>> not used?
>>
> _create_locale can take bigger input than GetLocaleInfoEx. But we are
> interested in
> *language[_country-region[.code-page]]*. We are using _create_locale to
> validate
> the given input. The reason is we can't verify the locale name if it is
> appended with
> code-page by using GetLocaleInfoEx. So before parsing, we verify if the
> whole input
> locale name is valid by using _create_locale. I hope that answers your
> question.
>
Understood. In this case, _create_locale, is being used only to validate
the input.
Perhaps, in addition, you could create an additional function, which only
validates winlocname, without having to create structures or use malloc, to
be used when _WIN32_WINNT> = 0x0600 is true, but it is only a suggestion,
if you think it is necessary.
But have a last problem, in case GetLocaleInfoEx fail, there is still one
memory leak,
before return NULL is needed call: _free_locale(loct);
Another suggestion, if GetLocaleInfoEx fail wouldn't it be good to log the
error and the error number?
regards,
Ranier Vilela
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-15 18:27:58 |
Message-ID: | CAC+AXB1DOJ-ogZ60Fe4qM7x22ybG2-nf85XfN36hK6pLVS9vpg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 15, 2020 at 4:46 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> Em qua., 15 de abr. de 2020 às 03:08, davinder singh <
> davindersingh2692(at)gmail(dot)com> escreveu:
>
>>
>> 5. Why call _create_locale if _WIN32_WINNT >= 0x0600 is true and loct is
>>> not used?
>>>
>> _create_locale can take bigger input than GetLocaleInfoEx. But we are
>> interested in
>> *language[_country-region[.code-page]]*. We are using _create_locale to
>> validate
>> the given input. The reason is we can't verify the locale name if it is
>> appended with
>> code-page by using GetLocaleInfoEx. So before parsing, we verify if the
>> whole input
>> locale name is valid by using _create_locale. I hope that answers your
>> question.
>>
> Understood. In this case, _create_locale, is being used only to validate
> the input.
> Perhaps, in addition, you could create an additional function, which only
> validates winlocname, without having to create structures or use malloc, to
> be used when _WIN32_WINNT> = 0x0600 is true, but it is only a suggestion,
> if you think it is necessary.
>
Looking at the comments for IsoLocaleName() I see: "MinGW headers declare
_create_locale(), but msvcrt.dll lacks that symbol". This is outdated
[1][2], and _create_locale() could be used from Windows 8, but I think we
should use GetLocaleInfoEx() as a complete alternative to _create_locale().
Please find attached a patch for so.
[1]
https://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/?limit=250&page=2
[2] https://github.com/mirror/mingw-w64/commit/b508bb87ad
Regards,
Juan José Santamaría Flecha
>
>
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v05.patch | application/octet-stream | 4.0 KB |
From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-15 19:12:08 |
Message-ID: | CAEudQAq+13rWjj8h=zT61Lv5RrHi-FPAZSedezyj5fU-PSGAig@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Em qua., 15 de abr. de 2020 às 15:28, Juan José Santamaría Flecha <
juanjo(dot)santamaria(at)gmail(dot)com> escreveu:
>
>
> On Wed, Apr 15, 2020 at 4:46 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
>
>> Em qua., 15 de abr. de 2020 às 03:08, davinder singh <
>> davindersingh2692(at)gmail(dot)com> escreveu:
>>
>>>
>>> 5. Why call _create_locale if _WIN32_WINNT >= 0x0600 is true and loct is
>>>> not used?
>>>>
>>> _create_locale can take bigger input than GetLocaleInfoEx. But we are
>>> interested in
>>> *language[_country-region[.code-page]]*. We are using _create_locale to
>>> validate
>>> the given input. The reason is we can't verify the locale name if it is
>>> appended with
>>> code-page by using GetLocaleInfoEx. So before parsing, we verify if the
>>> whole input
>>> locale name is valid by using _create_locale. I hope that answers your
>>> question.
>>>
>> Understood. In this case, _create_locale, is being used only to validate
>> the input.
>> Perhaps, in addition, you could create an additional function, which only
>> validates winlocname, without having to create structures or use malloc, to
>> be used when _WIN32_WINNT> = 0x0600 is true, but it is only a suggestion,
>> if you think it is necessary.
>>
>
> Looking at the comments for IsoLocaleName() I see: "MinGW headers declare
> _create_locale(), but msvcrt.dll lacks that symbol". This is outdated
> [1][2], and _create_locale() could be used from Windows 8, but I think we
> should use GetLocaleInfoEx() as a complete alternative to _create_locale().
>
Sounds good to me, the exception maybe log error in case fail?
regards,
Ranier Vilela
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-17 08:32:50 |
Message-ID: | CAA4eK1LFXLUg5+2R2G+DoZ=D52WcELtzt3=4VMSqu6gA+ou61A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 15, 2020 at 11:58 PM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> On Wed, Apr 15, 2020 at 4:46 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
>>
>> Em qua., 15 de abr. de 2020 às 03:08, davinder singh <davindersingh2692(at)gmail(dot)com> escreveu:
>>>
>>>
>>>> 5. Why call _create_locale if _WIN32_WINNT >= 0x0600 is true and loct is not used?
>>>
>>> _create_locale can take bigger input than GetLocaleInfoEx. But we are interested in
>>> language[_country-region[.code-page]]. We are using _create_locale to validate
>>> the given input. The reason is we can't verify the locale name if it is appended with
>>> code-page by using GetLocaleInfoEx. So before parsing, we verify if the whole input
>>> locale name is valid by using _create_locale. I hope that answers your question.
>>
>> Understood. In this case, _create_locale, is being used only to validate the input.
>> Perhaps, in addition, you could create an additional function, which only validates winlocname, without having to create structures or use malloc, to be used when _WIN32_WINNT> = 0x0600 is true, but it is only a suggestion, if you think it is necessary.
>
>
> Looking at the comments for IsoLocaleName() I see: "MinGW headers declare _create_locale(), but msvcrt.dll lacks that symbol". This is outdated [1][2], and _create_locale() could be used from Windows 8, but I think we should use GetLocaleInfoEx() as a complete alternative to _create_locale().
>
I see some differences in the output when _create_locale() is used vs.
when GetLocaleInfoEx() is used. Forex.
Set LC_MESSAGES="English_New Zealand";
-- returns en-NZ, then code changes it to en_NZ when _create_locale()
is used whereas GetLocaleInfoEx returns error.
Set LC_MESSAGES="English_Republic of the Philippines";
-- returns en-PH, then code changes it to en_PH when _create_locale()
is used whereas GetLocaleInfoEx returns error.
Set LC_MESSAGES="English_New Zealand";
-- returns en-NZ, then code changes it to en_NZ when _create_locale()
is used whereas GetLocaleInfoEx returns error.
Set LC_MESSAGES="French_Canada";
--returns fr-CA when _create_locale() is used whereas GetLocaleInfoEx
returns error.
The function IsoLocaleName() header comment says "Convert a Windows
setlocale() argument to a Unix-style one", so I was expecting above
cases which gives valid values with _create_locale() should also work
with GetLocaleInfoEx(). If it is fine for GetLocaleInfoEx() to return
an error for the above cases, then we need an explanation of the same
and probably add a few comments as well. So, I am not sure if we can
conclude that GetLocaleInfoEx() is an alternative to _create_locale()
at this stage.
I have used the attached hack to make _create_locale work on the
latest MSVC. Just to be clear this is mainly for the purpose of
testing the behavior _create_locale.
On the code side,
+ GetLocaleInfoEx(wc_locale_name, LOCALE_SNAME, (LPWSTR) &buffer,
+ LOCALE_NAME_MAX_LENGTH);
/* Locale names use only ASCII, any conversion locale suffices. */
- rc = wchar2char(iso_lc_messages, loct->locinfo->locale_name[LC_CTYPE],
- sizeof(iso_lc_messages), NULL);
+ rc = wchar2char(iso_lc_messages, buffer, sizeof(iso_lc_messages), NULL);
Check the return value of GetLocaleInfoEx and if it is successful,
then only use wchar2char, otherwise, this function will return an
empty string ("") instead of NULL.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
fix_create_locate_1.patch | application/octet-stream | 1.1 KB |
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-17 18:43:35 |
Message-ID: | CAC+AXB3tdnzvci=piTNqbgXx3m1T42hPQmyU6_+-3W_QLw5VWQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, Apr 17, 2020 at 10:33 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
wrote:
>
> I see some differences in the output when _create_locale() is used vs.
> when GetLocaleInfoEx() is used. Forex.
>
Thanks for the thorough review.
> The function IsoLocaleName() header comment says "Convert a Windows
> setlocale() argument to a Unix-style one", so I was expecting above
> cases which gives valid values with _create_locale() should also work
> with GetLocaleInfoEx(). If it is fine for GetLocaleInfoEx() to return
> an error for the above cases, then we need an explanation of the same
> and probably add a few comments as well. So, I am not sure if we can
> conclude that GetLocaleInfoEx() is an alternative to _create_locale()
> at this stage.
>
We can get a match for those locales in non-ISO format by enumerating
available locales with EnumSystemLocalesEx(), and trying to find a match.
Please find a new patch for so.
Regards,
Juan José Santamaría Flecha
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v06.patch | application/octet-stream | 5.0 KB |
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-18 04:07:15 |
Message-ID: | CAA4eK1+DUPo7Ah5gSekVdvJKh+W=qskk_5zcdiUf1yrQwK3uog@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sat, Apr 18, 2020 at 12:14 AM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
>
> We can get a match for those locales in non-ISO format by enumerating available locales with EnumSystemLocalesEx(), and trying to find a match.
>
> Please find a new patch for so.
>
I have not reviewed or tested the new patch but one thing I would like
to see is the impact of setting LC_MESAGGES with different locale
information. Basically, the error messages after setting the locale
with _create_locale and with the new method being discussed. This
will help us in ensuring that we didn't break anything which was
working with prior versions of MSVC. Can you or someone try to test
and share the results of the same?
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-18 11:42:27 |
Message-ID: | CAEudQAo5fANyo4Dn8R6EnJGDFjdNMVOkeWKiqSpiW6PJY4iYgw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Em sex., 17 de abr. de 2020 às 15:44, Juan José Santamaría Flecha <
juanjo(dot)santamaria(at)gmail(dot)com> escreveu:
>
> On Fri, Apr 17, 2020 at 10:33 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
>
>>
>> I see some differences in the output when _create_locale() is used vs.
>> when GetLocaleInfoEx() is used. Forex.
>>
>
> Thanks for the thorough review.
>
>
>> The function IsoLocaleName() header comment says "Convert a Windows
>> setlocale() argument to a Unix-style one", so I was expecting above
>> cases which gives valid values with _create_locale() should also work
>> with GetLocaleInfoEx(). If it is fine for GetLocaleInfoEx() to return
>> an error for the above cases, then we need an explanation of the same
>> and probably add a few comments as well. So, I am not sure if we can
>> conclude that GetLocaleInfoEx() is an alternative to _create_locale()
>> at this stage.
>>
>
> We can get a match for those locales in non-ISO format by enumerating
> available locales with EnumSystemLocalesEx(), and trying to find a match.
>
> Please find a new patch for so.
>
I have some observations about this patch, related to style, if you will
allow me.
1. argv variable on function enum_locales_fn can be reduced.
2. Var declaration len escapes the Postgres style.
3. Why call wcslen(test_locale), again, when var len have the size?
+static BOOL CALLBACK
+enum_locales_fn(LPWSTR pStr, DWORD dwFlags, LPARAM lparam)
+{
+ WCHAR test_locale[LOCALE_NAME_MAX_LENGTH];
+
+ memset(test_locale, 0, sizeof(test_locale));
+ if (GetLocaleInfoEx(pStr, LOCALE_SENGLISHLANGUAGENAME,
+ test_locale, LOCALE_NAME_MAX_LENGTH) > 0)
+ {
+ size_t len;
+
+ wcscat(test_locale, L"_");
+ len = wcslen(test_locale);
+ if (GetLocaleInfoEx(pStr, LOCALE_SENGLISHCOUNTRYNAME,
+ test_locale + len, LOCALE_NAME_MAX_LENGTH - len) > 0)
+ {
+ WCHAR **argv = (WCHAR **) lparam;
+
+ if (wcsncmp(argv[0], test_locale, len) == 0)
+ {
+ wcscpy(argv[1], pStr);
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+}
regards,
Ranier Vilela
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-19 10:16:32 |
Message-ID: | CAC+AXB0-qCyjt3e88e=gZS1HggECuoAO55KMaQvW+9UhaM1XYg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sat, Apr 18, 2020 at 6:07 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Sat, Apr 18, 2020 at 12:14 AM Juan José Santamaría Flecha
> <juanjo(dot)santamaria(at)gmail(dot)com> wrote:
> >
> > We can get a match for those locales in non-ISO format by enumerating
> available locales with EnumSystemLocalesEx(), and trying to find a match.
>
> I have not reviewed or tested the new patch but one thing I would like
> to see is the impact of setting LC_MESAGGES with different locale
> information. Basically, the error messages after setting the locale
> with _create_locale and with the new method being discussed. This
> will help us in ensuring that we didn't break anything which was
> working with prior versions of MSVC. Can you or someone try to test
> and share the results of the same?
>
I cannot find a single place where all supported locales are listed, but I
have created a small test program (WindowsNLSLocales.c) based on:
<language>[_<location>] format locales [1], additional supported language
strings [2], and additional supported country and region strings [3]. Based
on the results from this test program, it is possible to to do a good job
with the <language>[_<location>] types using the proposed logic, but the
two later cases are Windows specific, and there is no way arround a
lookup-table.
The attached results (WindowsNLSLocales.ods) come from Windows 10 (1903)
and Visual C++ build 1924, 64-bit.
On Sat, Apr 18, 2020 at 1:43 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> I have some observations about this patch, related to style, if you will
> allow me.
>
Please find attached a revised version.
[1]
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c
[2] https://docs.microsoft.com/en-us/cpp/c-runtime-library/language-strings
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/language-strings?view=vs-2019>
[3]
https://docs.microsoft.com/en-us/cpp/c-runtime-library/country-region-strings
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/country-region-strings?view=vs-2019>
Attachment | Content-Type | Size |
---|---|---|
WindowsNLSLocales.c | text/plain | 5.9 KB |
WindowsNLSLocales.ods | application/vnd.oasis.opendocument.spreadsheet | 18.3 KB |
0001-PG-compilation-error-with-VS-2015-2017-2019_v07.patch | application/octet-stream | 5.5 KB |
From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-19 11:56:39 |
Message-ID: | CAEudQAoFcXDSeZgk1EML-qMVVyTN4=tgqd-GNi3Vtz0bO=XJnA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Em dom., 19 de abr. de 2020 às 07:16, Juan José Santamaría Flecha <
juanjo(dot)santamaria(at)gmail(dot)com> escreveu:
>
> On Sat, Apr 18, 2020 at 6:07 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
>
>> On Sat, Apr 18, 2020 at 12:14 AM Juan José Santamaría Flecha
>> <juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>> >
>> > We can get a match for those locales in non-ISO format by enumerating
>> available locales with EnumSystemLocalesEx(), and trying to find a match.
>>
>> I have not reviewed or tested the new patch but one thing I would like
>> to see is the impact of setting LC_MESAGGES with different locale
>> information. Basically, the error messages after setting the locale
>> with _create_locale and with the new method being discussed. This
>> will help us in ensuring that we didn't break anything which was
>> working with prior versions of MSVC. Can you or someone try to test
>> and share the results of the same?
>>
>
> I cannot find a single place where all supported locales are listed, but I
> have created a small test program (WindowsNLSLocales.c) based on:
> <language>[_<location>] format locales [1], additional supported language
> strings [2], and additional supported country and region strings [3]. Based
> on the results from this test program, it is possible to to do a good job
> with the <language>[_<location>] types using the proposed logic, but the
> two later cases are Windows specific, and there is no way arround a
> lookup-table.
>
> The attached results (WindowsNLSLocales.ods) come from Windows 10 (1903)
> and Visual C++ build 1924, 64-bit.
>
> On Sat, Apr 18, 2020 at 1:43 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
>
>> I have some observations about this patch, related to style, if you will
>> allow me.
>>
>
> Please find attached a revised version.
>
Looks good to me, but, sorry, I think I missed a glitch in the previous
review..
+#else /* _WIN32_WINNT < 0x0600 */
+ _locale_t loct;
+
+ loct = _create_locale(LC_CTYPE, winlocname);
+ if (loct != NULL)
+{
+ rc = wchar2char(iso_lc_messages, loct->locinfo->locale_name[LC_CTYPE],
+ sizeof(iso_lc_messages), NULL);
_free_locale(loct);
+}
+#endif /* _WIN32_WINNT >= 0x0600 */
If _create_locale fail, no need to call _free_locale(loct);.
Another point is, what is the difference between pg_mbstrlen and wcslen?
It would not be better to use only wcslen?
Attached have the patch with this comments.
regards,
Ranier Vilela
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v08.patch | application/octet-stream | 5.5 KB |
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-19 15:33:38 |
Message-ID: | CAC+AXB2JN=cFokx+K_uNQP100viD7jpeHMSR2Sv7WG2H=TKOWQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, Apr 19, 2020 at 1:58 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> Em dom., 19 de abr. de 2020 às 07:16, Juan José Santamaría Flecha <
> juanjo(dot)santamaria(at)gmail(dot)com> escreveu:
>
>> On Sat, Apr 18, 2020 at 1:43 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
>> wrote:
>>
>>> I have some observations about this patch, related to style, if you will
>>> allow me.
>>>
>> Please find attached a revised version.
>>
> Looks good to me, but, sorry, I think I missed a glitch in the previous
> review.
> If _create_locale fail, no need to call _free_locale(loct);.
>
> Another point is, what is the difference between pg_mbstrlen and wcslen?
> It would not be better to use only wcslen?
>
pg_mbstrlen() is for multibyte strings and wcslen() is for wide-character
strings, the "pg" equivalent would be pg_wchar_strlen().
Attached have the patch with this comments.
>
+ } else
This line needs a break, other than that LGTM.
Regards,
Juan José Santamaría Flecha
From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-19 18:59:50 |
Message-ID: | CAEudQAoS2oEjrBoG2cyeKtv72Xhp0A-1bFh3=bFy2NjXg88Biw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Em dom., 19 de abr. de 2020 às 12:34, Juan José Santamaría Flecha <
juanjo(dot)santamaria(at)gmail(dot)com> escreveu:
>
> On Sun, Apr 19, 2020 at 1:58 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
>
>> Em dom., 19 de abr. de 2020 às 07:16, Juan José Santamaría Flecha <
>> juanjo(dot)santamaria(at)gmail(dot)com> escreveu:
>>
>>> On Sat, Apr 18, 2020 at 1:43 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
>>> wrote:
>>>
>>>> I have some observations about this patch, related to style, if you
>>>> will allow me.
>>>>
>>> Please find attached a revised version.
>>>
>> Looks good to me, but, sorry, I think I missed a glitch in the previous
>> review.
>> If _create_locale fail, no need to call _free_locale(loct);.
>>
>> Another point is, what is the difference between pg_mbstrlen and wcslen?
>> It would not be better to use only wcslen?
>>
>
> pg_mbstrlen() is for multibyte strings and wcslen() is for wide-character
> strings, the "pg" equivalent would be pg_wchar_strlen().
>
> Attached have the patch with this comments.
>>
>
> + } else
>
> This line needs a break, other than that LGTM.
>
Sure. Attached new patch with this revision.
regards,
Ranier Vilela
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v09.patch | application/octet-stream | 5.5 KB |
From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-19 23:02:08 |
Message-ID: | 20200419230208.GC436587@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, Apr 19, 2020 at 03:59:50PM -0300, Ranier Vilela wrote:
> Em dom., 19 de abr. de 2020 às 12:34, Juan José Santamaría Flecha <
> juanjo(dot)santamaria(at)gmail(dot)com> escreveu:
>> This line needs a break, other than that LGTM.
>
> Sure. Attached new patch with this revision.
Amit, are you planning to look at this patch? I may be able to spend
a couple of hours on this thread this week and that's an area of the
code I have worked with in the past, though I am not sure.
--
Michael
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-20 04:40:40 |
Message-ID: | CAA4eK1LaT=0JZ3shApsK0UEz4EKauJmdZ=+U+nz7i5T9nHy9ZA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Apr 20, 2020 at 4:32 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Sun, Apr 19, 2020 at 03:59:50PM -0300, Ranier Vilela wrote:
> > Em dom., 19 de abr. de 2020 às 12:34, Juan José Santamaría Flecha <
> > juanjo(dot)santamaria(at)gmail(dot)com> escreveu:
> >> This line needs a break, other than that LGTM.
> >
> > Sure. Attached new patch with this revision.
>
> Amit, are you planning to look at this patch?
>
Yes, I am planning to look into it. Actually, I think the main thing
here is to ensure that we don't break something which was working with
_create_locale API.
> I may be able to spend
> a couple of hours on this thread this week and that's an area of the
> code I have worked with in the past, though I am not sure.
>
Okay, that will be good.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-20 08:53:03 |
Message-ID: | CAHzhFSG9JTszu_9jsms9SvsjyCFUqB=yEjXc6nTLM+jMieNqGg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Apr 20, 2020 at 10:10 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
wrote:
> Yes, I am planning to look into it. Actually, I think the main thing
> here is to ensure that we don't break something which was working with
> _create_locale API.
I am trying to understand how lc_messages affect the error messages on
Windows,
but I haven't seen any change in the error message like on the Linux system
we change lc_messages.
Can someone help me with this? Please let me know if there is any
configuration setting that I need to adjust.
--
Regards,
Davinder
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-20 13:02:21 |
Message-ID: | CAA4eK1K945Mma-rwVqWDEc+Km_ametR_UKmy1eg9D1XNc9mJQQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, Apr 19, 2020 at 3:46 PM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
>
> On Sat, Apr 18, 2020 at 6:07 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>> On Sat, Apr 18, 2020 at 12:14 AM Juan José Santamaría Flecha
>> <juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>> >
>> > We can get a match for those locales in non-ISO format by enumerating available locales with EnumSystemLocalesEx(), and trying to find a match.
>>
>> I have not reviewed or tested the new patch but one thing I would like
>> to see is the impact of setting LC_MESAGGES with different locale
>> information. Basically, the error messages after setting the locale
>> with _create_locale and with the new method being discussed. This
>> will help us in ensuring that we didn't break anything which was
>> working with prior versions of MSVC. Can you or someone try to test
>> and share the results of the same?
>
>
> I cannot find a single place where all supported locales are listed, but I have created a small test program (WindowsNLSLocales.c) based on: <language>[_<location>] format locales [1], additional supported language strings [2], and additional supported country and region strings [3]. Based on the results from this test program, it is possible to to do a good job with the <language>[_<location>] types using the proposed logic, but the two later cases are Windows specific, and there is no way arround a lookup-table.
>
> The attached results (WindowsNLSLocales.ods) come from Windows 10 (1903) and Visual C++ build 1924, 64-bit.
>
I think these are quite intensive tests but I wonder do we need to
test some locales with code_page? Generally speaking, in this case it
should not matter as we are trying to get the locale name but no harm
in testing. Also, I think it would be good if we can test how this
impacts the error messages as Davinder is trying to do.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-21 07:21:06 |
Message-ID: | CAA4eK1JWMuLsgZigORXXBtLYiTjYyDJZEdj-1=S3JW1dmSnQfQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Apr 20, 2020 at 6:32 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Sun, Apr 19, 2020 at 3:46 PM Juan José Santamaría Flecha
> <juanjo(dot)santamaria(at)gmail(dot)com> wrote:
> >
> > I cannot find a single place where all supported locales are listed, but I have created a small test program (WindowsNLSLocales.c) based on: <language>[_<location>] format locales [1], additional supported language strings [2], and additional supported country and region strings [3]. Based on the results from this test program, it is possible to to do a good job with the <language>[_<location>] types using the proposed logic, but the two later cases are Windows specific, and there is no way arround a lookup-table.
> >
> > The attached results (WindowsNLSLocales.ods) come from Windows 10 (1903) and Visual C++ build 1924, 64-bit.
> >
>
> I think these are quite intensive tests but I wonder do we need to
> test some locales with code_page? Generally speaking, in this case it
> should not matter as we are trying to get the locale name but no harm
> in testing. Also, I think it would be good if we can test how this
> impacts the error messages as Davinder is trying to do.
>
I have tried a simple test with the latest patch and it failed for me.
Set LC_MESSAGES="English_United Kingdom";
-- returns en-GB, then code changes it to en_NZ when _create_locale()
is used whereas with the patch it returns "" (empty string).
There seem to be two problems here (a) The input to enum_locales_fn
doesn't seem to get the input name as "English_United Kingdom" due to
which it can't find a match even if the same exists. (b) After
executing EnumSystemLocalesEx, there is no way the patch can detect if
it is successful in finding the passed name due to which it appends
empty string in such cases.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-21 10:40:50 |
Message-ID: | CAA4eK1+J_sEjywJJTjLmayRKsvaxY=Mm=74FuFVLY=1Zr9B0cg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 21, 2020 at 12:51 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Mon, Apr 20, 2020 at 6:32 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Sun, Apr 19, 2020 at 3:46 PM Juan José Santamaría Flecha
> > <juanjo(dot)santamaria(at)gmail(dot)com> wrote:
> > >
> > > I cannot find a single place where all supported locales are listed, but I have created a small test program (WindowsNLSLocales.c) based on: <language>[_<location>] format locales [1], additional supported language strings [2], and additional supported country and region strings [3]. Based on the results from this test program, it is possible to to do a good job with the <language>[_<location>] types using the proposed logic, but the two later cases are Windows specific, and there is no way arround a lookup-table.
> > >
> > > The attached results (WindowsNLSLocales.ods) come from Windows 10 (1903) and Visual C++ build 1924, 64-bit.
> > >
> >
> > I think these are quite intensive tests but I wonder do we need to
> > test some locales with code_page? Generally speaking, in this case it
> > should not matter as we are trying to get the locale name but no harm
> > in testing. Also, I think it would be good if we can test how this
> > impacts the error messages as Davinder is trying to do.
> >
>
>
> I have tried a simple test with the latest patch and it failed for me.
>
> Set LC_MESSAGES="English_United Kingdom";
> -- returns en-GB, then code changes it to en_NZ when _create_locale()
> is used whereas with the patch it returns "" (empty string).
>
> There seem to be two problems here (a) The input to enum_locales_fn
> doesn't seem to get the input name as "English_United Kingdom" due to
> which it can't find a match even if the same exists. (b) After
> executing EnumSystemLocalesEx, there is no way the patch can detect if
> it is successful in finding the passed name due to which it appends
> empty string in such cases.
>
Few more comments:
1. I have tried the first one in the list provided by you and that
also didn't work. Basically, I got empty string when I tried Set
LC_MESSAGES='Afar';
2. Getting below warning
pg_locale.c(1072): warning C4133: 'function': incompatible types -
from 'const char *' to 'const wchar_t *'
3.
+ if (GetLocaleInfoEx(pStr, LOCALE_SENGLISHCOUNTRYNAME,
+ test_locale + len, LOCALE_NAME_MAX_LENGTH - len) > 0)
All > or <= 0 checks should be changed to "!" types which mean to
check whether the call toGetLocaleInfoEx is success or not.
4. In the patch, first, we try to get with LCType as LOCALE_SNAME and
then with LOCALE_SENGLISHLANGUAGENAME and LOCALE_SENGLISHCOUNTRYNAME.
I think we should add comments indicating why we try to get the locale
information with three LCTypes and why the specific order of trying
those types is required.
5. In one of the previous emails, you asked whether we have a list of
supported locales. I don't find any such list. I think it depends on
Windows locales for which you can get the information from
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-21 12:01:39 |
Message-ID: | CAC+AXB30gDdLbtrUz+aPTDNu2kp8a8bcx9ZjqVW9YpOZf+S44g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 21, 2020 at 12:41 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
wrote:
> On Tue, Apr 21, 2020 at 12:51 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
> >
> > I have tried a simple test with the latest patch and it failed for me.
> >
> > Set LC_MESSAGES="English_United Kingdom";
> > -- returns en-GB, then code changes it to en_NZ when _create_locale()
> > is used whereas with the patch it returns "" (empty string).
> >
> > There seem to be two problems here (a) The input to enum_locales_fn
> > doesn't seem to get the input name as "English_United Kingdom" due to
> > which it can't find a match even if the same exists. (b) After
> > executing EnumSystemLocalesEx, there is no way the patch can detect if
> > it is successful in finding the passed name due to which it appends
> > empty string in such cases.
>
> Few more comments:
> 1. I have tried the first one in the list provided by you and that
> also didn't work. Basically, I got empty string when I tried Set
> LC_MESSAGES='Afar';
>
I cannot reproduce any of these errors on my end. When using
_create_locale(), returning "en_NZ" is also a wrong result.
> 2. Getting below warning
> pg_locale.c(1072): warning C4133: 'function': incompatible types -
> from 'const char *' to 'const wchar_t *'
>
Yes, that is a regression.
> 3.
> + if (GetLocaleInfoEx(pStr, LOCALE_SENGLISHCOUNTRYNAME,
> + test_locale + len, LOCALE_NAME_MAX_LENGTH - len) > 0)
>
> All > or <= 0 checks should be changed to "!" types which mean to
> check whether the call toGetLocaleInfoEx is success or not.
>
MSVC does not recommend "!" in all cases, but GetLocaleInfoEx() looks fine,
so agreed.
4. In the patch, first, we try to get with LCType as LOCALE_SNAME and
> then with LOCALE_SENGLISHLANGUAGENAME and LOCALE_SENGLISHCOUNTRYNAME.
> I think we should add comments indicating why we try to get the locale
> information with three LCTypes and why the specific order of trying
> those types is required.
>
Agreed.
> 5. In one of the previous emails, you asked whether we have a list of
> supported locales. I don't find any such list. I think it depends on
> Windows locales for which you can get the information from
>
> https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c
Yes, that is the information we get from EnumSystemLocalesEx(), without the
additional entries _create_locale() has.
Please find attached a new version addressing the above mentioned, and so
adding a debug message for trying to get more information on the failed
cases.
Regards,
Juan José Santamaría Flecha
.
>
>
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v10.patch | application/octet-stream | 5.9 KB |
From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-21 12:20:31 |
Message-ID: | CAEudQAqOqSjoQ_AVFqxgeaKYAziSLKAF3QCq9mCJrM7KD=9hkQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Em ter., 21 de abr. de 2020 às 09:02, Juan José Santamaría Flecha <
juanjo(dot)santamaria(at)gmail(dot)com> escreveu:
>
> On Tue, Apr 21, 2020 at 12:41 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
>
>> On Tue, Apr 21, 2020 at 12:51 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
>> wrote:
>> >
>> > I have tried a simple test with the latest patch and it failed for me.
>> >
>> > Set LC_MESSAGES="English_United Kingdom";
>> > -- returns en-GB, then code changes it to en_NZ when _create_locale()
>> > is used whereas with the patch it returns "" (empty string).
>> >
>> > There seem to be two problems here (a) The input to enum_locales_fn
>> > doesn't seem to get the input name as "English_United Kingdom" due to
>> > which it can't find a match even if the same exists. (b) After
>> > executing EnumSystemLocalesEx, there is no way the patch can detect if
>> > it is successful in finding the passed name due to which it appends
>> > empty string in such cases.
>>
>> Few more comments:
>> 1. I have tried the first one in the list provided by you and that
>> also didn't work. Basically, I got empty string when I tried Set
>> LC_MESSAGES='Afar';
>>
>
> I cannot reproduce any of these errors on my end. When using
> _create_locale(), returning "en_NZ" is also a wrong result.
>
>
>> 2. Getting below warning
>> pg_locale.c(1072): warning C4133: 'function': incompatible types -
>> from 'const char *' to 'const wchar_t *'
>>
>
> Yes, that is a regression.
>
>
>> 3.
>> + if (GetLocaleInfoEx(pStr, LOCALE_SENGLISHCOUNTRYNAME,
>> + test_locale + len, LOCALE_NAME_MAX_LENGTH - len) > 0)
>>
>> All > or <= 0 checks should be changed to "!" types which mean to
>> check whether the call toGetLocaleInfoEx is success or not.
>>
>
> MSVC does not recommend "!" in all cases, but GetLocaleInfoEx() looks
> fine, so agreed.
>
> 4. In the patch, first, we try to get with LCType as LOCALE_SNAME and
>> then with LOCALE_SENGLISHLANGUAGENAME and LOCALE_SENGLISHCOUNTRYNAME.
>> I think we should add comments indicating why we try to get the locale
>> information with three LCTypes and why the specific order of trying
>> those types is required.
>>
>
> Agreed.
>
>
>> 5. In one of the previous emails, you asked whether we have a list of
>> supported locales. I don't find any such list. I think it depends on
>> Windows locales for which you can get the information from
>>
>> https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c
>
>
> Yes, that is the information we get from EnumSystemLocalesEx(), without
> the additional entries _create_locale() has.
>
> Please find attached a new version addressing the above mentioned, and so
> adding a debug message for trying to get more information on the failed
> cases.
>
More few comments.
1. Comments about order:
/*
* Callback function for EnumSystemLocalesEx.
* Stop enumerating if a match is found for a locale with the format
* <Language>_<Country>.
* The order for search locale is essential:
* Find LCType first as LOCALE_SNAME, if not found try
LOCALE_SENGLISHLANGUAGENAME and
* finally LOCALE_SENGLISHCOUNTRYNAME, before return.
*/
Typo "enumarating".
2. Maybe the fail has here:
if (hyphen == NULL || underscore == NULL)
Change || to &&, the logical is wrong?
3. Why iso_lc_messages[0] = '\0'?
If we go call strchr, soon after, it's a waste.
regards,
Ranier Vilela
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-21 12:49:41 |
Message-ID: | CAC+AXB1OjP+UHcG4C0v6T2QOPvD+cHKfiQNSY5YWNU8uhYP0Zg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 21, 2020 at 2:22 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> More few comments.
>
> 1. Comments about order:
> /*
> * Callback function for EnumSystemLocalesEx.
> * Stop enumerating if a match is found for a locale with the format
> * <Language>_<Country>.
> * The order for search locale is essential:
> * Find LCType first as LOCALE_SNAME, if not found try
> LOCALE_SENGLISHLANGUAGENAME and
> * finally LOCALE_SENGLISHCOUNTRYNAME, before return.
> */
>
> Typo "enumarating".
>
I would not call the order essential, is just meant to try the easier ways
first: is already "ISO" formatted !-> is just a "language" !-> is a full
"language_country" tag.
I take note about "enumarating".
2. Maybe the fail has here:
>
> if (hyphen == NULL || underscore == NULL)
>
> Change || to &&, the logical is wrong?
>
If the Windows locale does not have a hyphen ("aa") *or* the lc_message
does not have an underscore ("Afar"), only a comparison on language is
needed.
3. Why iso_lc_messages[0] = '\0'?
>
> If we go call strchr, soon after, it's a waste.
>
Less code churn, and strchr() againts an empty string did not look too
awful.
I would like to find were the errors come from before sending a new
version, can you reproduce them?
Regards,
Juan José Santamaría Flecha
>
>
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-22 11:43:12 |
Message-ID: | CAA4eK1JFV6WorNMwqmm_f-4ZeVPgmPuMvsD-_MHmwqspAucZTQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 21, 2020 at 5:32 PM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> On Tue, Apr 21, 2020 at 12:41 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>> On Tue, Apr 21, 2020 at 12:51 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>> >
>> > I have tried a simple test with the latest patch and it failed for me.
>> >
>> > Set LC_MESSAGES="English_United Kingdom";
>> > -- returns en-GB, then code changes it to en_NZ when _create_locale()
>> > is used whereas with the patch it returns "" (empty string).
>> >
>> > There seem to be two problems here (a) The input to enum_locales_fn
>> > doesn't seem to get the input name as "English_United Kingdom" due to
>> > which it can't find a match even if the same exists. (b) After
>> > executing EnumSystemLocalesEx, there is no way the patch can detect if
>> > it is successful in finding the passed name due to which it appends
>> > empty string in such cases.
>>
>> Few more comments:
>> 1. I have tried the first one in the list provided by you and that
>> also didn't work. Basically, I got empty string when I tried Set
>> LC_MESSAGES='Afar';
>
>
> I cannot reproduce any of these errors on my end.
>
The first problem related to the English_United Kingdom was due to the
usage of wcslen instead of pg_mbstrlen to compute the length of
winlocname. So, this is fixed with your latest patch. I have
debugged the case for 'Afar' and found that _create_locale also didn't
return anything for that in my machine, so probably that locale
information is not there in my environment.
> When using _create_locale(), returning "en_NZ" is also a wrong result.
>
Hmm, that was a typo, it should be en_GB instead.
>
>> 4. In the patch, first, we try to get with LCType as LOCALE_SNAME and
>> then with LOCALE_SENGLISHLANGUAGENAME and LOCALE_SENGLISHCOUNTRYNAME.
>> I think we should add comments indicating why we try to get the locale
>> information with three LCTypes and why the specific order of trying
>> those types is required.
>
>
> Agreed.
>
But, I don't see much in the comments?
Few more comments:
1.
if (rc == -1 || rc == sizeof(iso_lc_messages))
- return NULL;
+
iso_lc_messages[0] = '\0';
I don't think this change is required. The caller expects NULL in
case the API is not successful so that it can point result directly to
the locale passed. I have changed this back to the original code in
the attached patch.
2.
I see some differences in the output of GetLocaleInfoEx and
_create_locale for some locales as mentioned in one of the documents
shared by you. Ex.
Bemba_Zambia bem-ZM bem
Bena_Tanzania bez-TZ bez
Bulgarian_Bulgaria bg-BG bg
Now, these might be okay but I think unless we test such things by
seeing the error message changes due to these locales we can't be
sure.
3. In the attached patch, I have handled one of the problem reported
earlier aka "After executing EnumSystemLocalesEx, there is no way the
patch can detect if it is successful in finding the passed name due to
which it appends empty string in such cases."
4. I think for the matter of this API, it is better to use _MSC_VER
related checks instead of _WIN32_WINNT so as to be consistent with
similar usage in chklocale.c (see win32_langinfo). We can later
change the checks at all places to _WIN32_WINNT if required. I have
changed this as well in the attached patch.
5. I am slightly nervous about the usage of wchar functions like
_wcsicmp, wcslen, etc. as those are not used anywhere in the code.
OTOH, I don't see any problem with that. There is pg_wchar datatype
in the code and some corresponding functions to manipulate it. Have
you considered using it?
6. I have additionally done some cosmetic changes in the attached patch.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v11.patch | application/octet-stream | 6.1 KB |
From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-22 14:06:29 |
Message-ID: | CAEudQArZHcK_dR4UiQyCqVi11U4c-bq=xqD5k-FNe7zHVnSVig@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Em qua., 22 de abr. de 2020 às 08:43, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
escreveu:
> On Tue, Apr 21, 2020 at 5:32 PM Juan José Santamaría Flecha
> <juanjo(dot)santamaria(at)gmail(dot)com> wrote:
> >
> > On Tue, Apr 21, 2020 at 12:41 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
> >>
>
6. I have additionally done some cosmetic changes in the attached patch.
>
I made some style changes too.
1. Change:
strcpy(iso_lc_messages, "C");
to
iso_lc_messages[0] = 'C';
iso_lc_messages[1] = '\0';
2. Remove vars hyphen and underscore;
3. Avoid call second wcsrchr, if hyphen is not found.
If it's not too much perfectionism.
regards,
Ranier Vilela
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v12.patch | application/octet-stream | 6.0 KB |
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-22 15:56:42 |
Message-ID: | CAC+AXB06h4aJKT65AKe_1KQUqzWh1ADnqEBGVwDMZ4dMc19y_Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 22, 2020 at 1:43 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Tue, Apr 21, 2020 at 5:32 PM Juan José Santamaría Flecha
> <juanjo(dot)santamaria(at)gmail(dot)com> wrote:
> >
> > I cannot reproduce any of these errors on my end.
> >
> The first problem related to the English_United Kingdom was due to the
> usage of wcslen instead of pg_mbstrlen to compute the length of
> winlocname. So, this is fixed with your latest patch. I have
> debugged the case for 'Afar' and found that _create_locale also didn't
> return anything for that in my machine, so probably that locale
> information is not there in my environment.
>
> > When using _create_locale(), returning "en_NZ" is also a wrong result.
>
> Hmm, that was a typo, it should be en_GB instead.
>
I am glad we could clear that out, sorry because it was on my hand to
prevent.
> >> 4. In the patch, first, we try to get with LCType as LOCALE_SNAME and
> >> then with LOCALE_SENGLISHLANGUAGENAME and LOCALE_SENGLISHCOUNTRYNAME.
> >> I think we should add comments indicating why we try to get the locale
> >> information with three LCTypes and why the specific order of trying
> >> those types is required.
> >
> >
> > Agreed.
> >
>
> But, I don't see much in the comments?
>
I take notice.
> Few more comments:
> 1.
> if (rc == -1 || rc == sizeof(iso_lc_messages))
> - return NULL;
> +
> iso_lc_messages[0] = '\0';
>
> I don't think this change is required. The caller expects NULL in
> case the API is not successful so that it can point result directly to
> the locale passed. I have changed this back to the original code in
> the attached patch.
>
I did not want to return anything without logging its value.
> 2.
> I see some differences in the output of GetLocaleInfoEx and
> _create_locale for some locales as mentioned in one of the documents
> shared by you. Ex.
>
> Bemba_Zambia bem-ZM bem
> Bena_Tanzania bez-TZ bez
> Bulgarian_Bulgaria bg-BG bg
>
> Now, these might be okay but I think unless we test such things by
> seeing the error message changes due to these locales we can't be
> sure.
>
There are some cases where the language tag does not match, although I do
not think is wrong:
Asu asa Asu
Edo bin Edo
Ewe ee Ewe
Rwa rwk Rwa
To check the messages, do you have a regression test in mind?
> 3. In the attached patch, I have handled one of the problem reported
> earlier aka "After executing EnumSystemLocalesEx, there is no way the
> patch can detect if it is successful in finding the passed name due to
> which it appends empty string in such cases."
>
LGTM.
> 4. I think for the matter of this API, it is better to use _MSC_VER
> related checks instead of _WIN32_WINNT so as to be consistent with
> similar usage in chklocale.c (see win32_langinfo). We can later
> change the checks at all places to _WIN32_WINNT if required. I have
> changed this as well in the attached patch.
>
Ok, there is substance for a cleanup patch.
5. I am slightly nervous about the usage of wchar functions like
> _wcsicmp, wcslen, etc. as those are not used anywhere in the code.
> OTOH, I don't see any problem with that. There is pg_wchar datatype
> in the code and some corresponding functions to manipulate it. Have
> you considered using it?
>
In Windows wchar_t is 2 bytes, so we would have to do make UTF16 to UFT32
conversions back and forth. Not sure if it is worth the effort.
Regards,
Juan José Santamaría Flecha
>
>
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-23 03:13:50 |
Message-ID: | CAA4eK1J5w2LKW2fnJnYMW5eyGrPFHPO6LhBtgdhLD+8iqgJw9Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 22, 2020 at 7:37 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
>
> Em qua., 22 de abr. de 2020 às 08:43, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> escreveu:
>>
>> On Tue, Apr 21, 2020 at 5:32 PM Juan José Santamaría Flecha
>> <juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>> >
>> > On Tue, Apr 21, 2020 at 12:41 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>> >>
>>
>> 6. I have additionally done some cosmetic changes in the attached patch.
>
> I made some style changes too.
>
> 1. Change:
> strcpy(iso_lc_messages, "C");
> to
> iso_lc_messages[0] = 'C';
> iso_lc_messages[1] = '\0';
>
This is an existing code and this patch has no purpose to touch it.
So, I don't think we should make this change.
> 2. Remove vars hyphen and underscore;
> 3. Avoid call second wcsrchr, if hyphen is not found.
>
> If it's not too much perfectionism.
>
(2) and (3) are improvements, so we can take those.
Thanks for participating in the review and development of this patch.
It really helps if more people help in improving the patch.
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-23 03:30:18 |
Message-ID: | CAA4eK1KcbNxeEiJ0hRLfGDzGNfUZZQj4rDTma9xE8c3MEgS0uw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 22, 2020 at 9:27 PM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
>
> On Wed, Apr 22, 2020 at 1:43 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>>
>> >> 4. In the patch, first, we try to get with LCType as LOCALE_SNAME and
>> >> then with LOCALE_SENGLISHLANGUAGENAME and LOCALE_SENGLISHCOUNTRYNAME.
>> >> I think we should add comments indicating why we try to get the locale
>> >> information with three LCTypes and why the specific order of trying
>> >> those types is required.
>> >
>> >
>> > Agreed.
>> >
>>
>> But, I don't see much in the comments?
>
>
> I take notice.
>
Okay, I hope we will see better comments in the next version.
>>
>> Few more comments:
>> 1.
>> if (rc == -1 || rc == sizeof(iso_lc_messages))
>> - return NULL;
>> +
>> iso_lc_messages[0] = '\0';
>>
>> I don't think this change is required. The caller expects NULL in
>> case the API is not successful so that it can point result directly to
>> the locale passed. I have changed this back to the original code in
>> the attached patch.
>
>
> I did not want to return anything without logging its value.
>
Hmm, if you really want to log the value then do it in the caller. I
don't think making special arrangements just for logging this value is
a good idea.
>>
>> 2.
>> I see some differences in the output of GetLocaleInfoEx and
>> _create_locale for some locales as mentioned in one of the documents
>> shared by you. Ex.
>>
>> Bemba_Zambia bem-ZM bem
>> Bena_Tanzania bez-TZ bez
>> Bulgarian_Bulgaria bg-BG bg
>>
>> Now, these might be okay but I think unless we test such things by
>> seeing the error message changes due to these locales we can't be
>> sure.
>
>
> There are some cases where the language tag does not match, although I do not think is wrong:
>
> Asu asa Asu
> Edo bin Edo
> Ewe ee Ewe
> Rwa rwk Rwa
>
> To check the messages, do you have a regression test in mind?
>
I think we can check with simple error messages. So, basically after
setting a particular value of LC_MESSAGES, execute a query which
returns syntax or any other error, if the error message is the same
irrespective of the locale name returned by _create_locale and
GetLocaleInfoEx, then we should be fine. I want to especially try
where the return value is slightly different by _create_locale and
GetLocaleInfoEx. I know Davinder is trying something like this but
if you can also try then it would be good.
>
>> 5. I am slightly nervous about the usage of wchar functions like
>> _wcsicmp, wcslen, etc. as those are not used anywhere in the code.
>> OTOH, I don't see any problem with that. There is pg_wchar datatype
>> in the code and some corresponding functions to manipulate it. Have
>> you considered using it?
>
>
> In Windows wchar_t is 2 bytes, so we would have to do make UTF16 to UFT32 conversions back and forth. Not sure if it is worth the effort.
>
Yeah, I am also not sure about this. So, let us see if anyone else
has any thoughts on this point, otherwise, we can go with wchar
functions as you have in the patch.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-23 12:07:09 |
Message-ID: | CAC+AXB06EBrTcD1a4O1GFfAYmMvrsvY4jQPS63LznahxLi-qxA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Apr 23, 2020 at 5:30 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> Okay, I hope we will see better comments in the next version.
>
I have focused on improving comments in this version.
> Hmm, if you really want to log the value then do it in the caller. I
> don't think making special arrangements just for logging this value is
> a good idea.
>
Agreed.
> I think we can check with simple error messages. So, basically after
> setting a particular value of LC_MESSAGES, execute a query which
> returns syntax or any other error, if the error message is the same
> irrespective of the locale name returned by _create_locale and
> GetLocaleInfoEx, then we should be fine. I want to especially try
> where the return value is slightly different by _create_locale and
> GetLocaleInfoEx. I know Davinder is trying something like this but
> if you can also try then it would be good.
>
I have composed a small set of queries to test the output with
different lc_message settings (lc_messages_test.sql). Please find attached
the output from debug3 logging using both EnumSystemLocalesEx
(lc_messages_EnumSystemLocalesEx.log) and _create_locale
(lc_messages_create_locale.log).
> In Windows wchar_t is 2 bytes, so we would have to do make UTF16 to
> UFT32 conversions back and forth. Not sure if it is worth the effort.
>
> Yeah, I am also not sure about this. So, let us see if anyone else
> has any thoughts on this point, otherwise, we can go with wchar
> functions as you have in the patch.
>
Ok, the attached version still uses that approach.
Regards,
Juan José Santamaría Flecha
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v13.patch | application/octet-stream | 6.9 KB |
lc_messages_create_locale.log | application/octet-stream | 3.6 KB |
lc_messages_EnumSystemLocalesEx.log | application/octet-stream | 3.6 KB |
lc_messages_test.sql | application/octet-stream | 1.0 KB |
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-23 13:00:21 |
Message-ID: | CAA4eK1LEOY52C56JZ634GHnr2vyjz4_cGJuoxgZmRVY6=PqxHQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Apr 23, 2020 at 5:37 PM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
>
> On Thu, Apr 23, 2020 at 5:30 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>>
>> I think we can check with simple error messages. So, basically after
>> setting a particular value of LC_MESSAGES, execute a query which
>> returns syntax or any other error, if the error message is the same
>> irrespective of the locale name returned by _create_locale and
>> GetLocaleInfoEx, then we should be fine. I want to especially try
>> where the return value is slightly different by _create_locale and
>> GetLocaleInfoEx. I know Davinder is trying something like this but
>> if you can also try then it would be good.
>
>
> I have composed a small set of queries to test the output with different lc_message settings (lc_messages_test.sql). Please find attached the output from debug3 logging using both EnumSystemLocalesEx (lc_messages_EnumSystemLocalesEx.log) and _create_locale (lc_messages_create_locale.log).
>
Thanks, I will verify these. BTW, have you done something special to
get the error messages which are not in English because on my Windows
box I am not getting that in spite of setting it to the appropriate
locale. Did you use ICU or something else?
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-23 13:18:54 |
Message-ID: | CAC+AXB0tFmedkqBCOAmZQBRTP1wE+3cz4TuK4+2gA78Bvmt97A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Apr 23, 2020 at 3:00 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> Thanks, I will verify these. BTW, have you done something special to
> get the error messages which are not in English because on my Windows
> box I am not getting that in spite of setting it to the appropriate
> locale. Did you use ICU or something else?
>
If you are trying to view the messages using a CMD, I do not think is
possible unless you have the OS language installed. I read the results from
the log file.
Regards,
Juan José Santamaría Flecha
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-24 05:46:52 |
Message-ID: | CAHzhFSHqGXRQytmA2MbJ6KNEsf+90V-Ct7m1zYKKUmN_kqyCqQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Apr 23, 2020 at 6:49 PM Juan José Santamaría Flecha <
juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> On Thu, Apr 23, 2020 at 3:00 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
>
>>
>> Thanks, I will verify these. BTW, have you done something special to
>> get the error messages which are not in English because on my Windows
>> box I am not getting that in spite of setting it to the appropriate
>> locale. Did you use ICU or something else?
>>
>
> If you are trying to view the messages using a CMD, I do not think is
> possible unless you have the OS language installed. I read the results from
> the log file.
>
I have checked the log file also but still, I am not seeing any changes in
error message language. I am checking two log files one is by enabling
Logging_collector in the conf file and the second is generated using
"pg_ctl -l" option.
I am using windows 10.
Is there another way you are generating the log file?
Did you install any of the locales manually you mentioned in the test file?
Also after initdb I am seeing only following standard locales in the
pg_collation catalog.
postgres=# select * from pg_collation;
oid | collname | collnamespace | collowner | collprovider |
collisdeterministic | collencoding | collcollate | collctype | collversion
-------+-----------+---------------+-----------+--------------+---------------------+--------------+-------------+-----------+-------------
100 | default | 11 | 10 | d | t | -1 | | |
950 | C | 11 | 10 | c | t | -1 | C | C |
951 | POSIX | 11 | 10 | c | t | -1 | POSIX |
POSIX |
12327 | ucs_basic | 11 | 10 | c | t | 6 | C |
C |
(4 rows)
Maybe Postgres is not able to get all the installed locales from the system
in my case. Can you confirm if you are getting different results in
pg_collation?
--
Regards,
Davinder
EnterpriseDB: http://www.enterprisedb.com
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | davinder singh <davindersingh2692(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-24 08:54:31 |
Message-ID: | CAC+AXB0xO=nAxEwk5+aytN-XmTvjmizgJz1HQMiBttnnqwPZdA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, Apr 24, 2020 at 7:47 AM davinder singh <davindersingh2692(at)gmail(dot)com>
wrote:
> On Thu, Apr 23, 2020 at 6:49 PM Juan José Santamaría Flecha <
> juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
>> On Thu, Apr 23, 2020 at 3:00 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
>> wrote:
>>
>>>
>>> Thanks, I will verify these. BTW, have you done something special to
>>> get the error messages which are not in English because on my Windows
>>> box I am not getting that in spite of setting it to the appropriate
>>> locale. Did you use ICU or something else?
>>>
>>
>> If you are trying to view the messages using a CMD, I do not think is
>> possible unless you have the OS language installed. I read the results from
>> the log file.
>>
> I have checked the log file also but still, I am not seeing any changes in
> error message language. I am checking two log files one is by enabling
> Logging_collector in the conf file and the second is generated using
> "pg_ctl -l" option.
> I am using windows 10.
> Is there another way you are generating the log file?
> Did you install any of the locales manually you mentioned in the test file?
> Maybe Postgres is not able to get all the installed locales from the
> system in my case. Can you confirm if you are getting different results in
> pg_collation?
> <http://www.enterprisedb.com/>
>
Hmm, my building environment only has en_US and es_ES installed, and the
db has the same collations.
I am not sure it is a locale problem, the only thing that needed some
configuration on my end to make the build was related to gettext. I got the
libintl library from the PHP repositories [1] (libintl-0.18.3-5,
precompiled at [2]) and the utilities from MinGW (mingw32-libintl
0.18.3.2-2).
[1] https://github.com/winlibs/gettext
[2] https://windows.php.net/downloads/php-sdk/
Regards,
Juan José Santamaría Flecha
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-27 11:20:38 |
Message-ID: | CAA4eK1JV5pJLm4mNFhahLBM1dxPKOWoqAXDF2s9D+fSJi++8Bw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Apr 23, 2020 at 6:30 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Thu, Apr 23, 2020 at 5:37 PM Juan José Santamaría Flecha
> <juanjo(dot)santamaria(at)gmail(dot)com> wrote:
> >
> > I have composed a small set of queries to test the output with different lc_message settings (lc_messages_test.sql). Please find attached the output from debug3 logging using both EnumSystemLocalesEx (lc_messages_EnumSystemLocalesEx.log) and _create_locale (lc_messages_create_locale.log).
> >
>
> Thanks, I will verify these.
>
The result looks good to me. However, I think we should test a few
more locales, especially where we know there is some difference in
what _create_locale returns and what we get via enumerating locales
and using GetLocaleInfoEx. Also, we should test some more locales
with the code page. For ex.
Bemba_Zambia
Bena_Tanzania
Bulgarian_Bulgaria
Swedish_Sweden.1252
Swedish_Sweden
Then, I think we can also test a few where you mentioned that the
language tag is different.
Asu asa Asu
Edo bin Edo
Ewe ee Ewe
Rwa rwk Rwa
BTW, we have a list of code page which can be used for this testing in
below link. I think we can primarily test Windows code page
identifiers (like 1250, 1251, .. 1258) from the link [1].
I think we should backpatch this till 9.5 as I could see the changes
made by commit 0fb54de9 to support MSVC2015 are present in that branch
and the same is mentioned in the commit message. Would you like to
prepare patches (and test those) for back-branches?
I have made few cosmetic changes in the attached patch which includes
adding/editing a few comments, ran pgindent, etc. I have replaced the
reference of "IETF-standardized" with "Unix-style" as we are already
using it at other places in the comments as well.
[1] - https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v14.patch | application/octet-stream | 7.3 KB |
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-28 15:15:47 |
Message-ID: | CAHzhFSFO4DF60a10P=As5XCNfVWBmDwS6AwP9WGLvrqZusLGdw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Apr 27, 2020 at 4:50 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> Bemba_Zambia
> Bena_Tanzania
> Bulgarian_Bulgaria
> Swedish_Sweden.1252
> Swedish_Sweden
>
I have tested with different locales with codepages including above. There
are few which return different locale code but the error messages in both
the cases are the same. I have attached the test and log files.
But there was one case, where locale code and error messages both are
different.
Portuguese_Brazil.1252
log from [1]
2020-04-28 14:27:39.785 GMT [2284] DEBUG: IsoLocaleName() executed;
locale: "pt"
2020-04-28 14:27:39.787 GMT [2284] ERROR: division by zero
2020-04-28 14:27:39.787 GMT [2284] STATEMENT: Select 1/0;
log from [2]
2020-04-28 14:36:20.666 GMT [14608] DEBUG: IsoLocaleName() executed;
locale: "pt_BR"
2020-04-28 14:36:20.673 GMT [14608] ERRO: divisão por zero
2020-04-28 14:36:20.673 GMT [14608] COMANDO: Select 1/0;
[1] full_locale_lc_message_test_create_locale_1.txt: log generated by using
the old patch (it uses _create_locale API to get locale info)
[2] full_locale_lc_message_test_getlocale_1.txt: log generated using the
patch v13
--
Regards,
Davinder
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
full_locale_lc_message_test_create_locale_1.txt | text/plain | 38.7 KB |
full_locale_lc_message_test_1.sql | application/octet-stream | 9.1 KB |
full_locale_lc_message_test_getlocale_1.txt | text/plain | 39.4 KB |
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-28 18:08:57 |
Message-ID: | CAC+AXB3nHv2Xo6txjVW36Fz7-+8GT4N2SVTGTv_nfofksSBDYg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Apr 27, 2020 at 1:20 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> I think we should backpatch this till 9.5 as I could see the changes
> made by commit 0fb54de9 to support MSVC2015 are present in that branch
> and the same is mentioned in the commit message. Would you like to
> prepare patches (and test those) for back-branches?
>
I do not have means to test these patches using Visual Studio previous to
2012, but please find attached patches for 9.5-9.6 and 10-11-12 as of
version 14. The extension is 'txt' not to break the cfbot.
> I have made few cosmetic changes in the attached patch which includes
> adding/editing a few comments, ran pgindent, etc. I have replaced the
> reference of "IETF-standardized" with "Unix-style" as we are already
> using it at other places in the comments as well.
LGTM.
Regards,
Juan José Santamaría Flecha
>
>
Attachment | Content-Type | Size |
---|---|---|
0001-PG10-compilation-error-with-VS-2015-2017-2019_v14..txt | text/plain | 8.2 KB |
0001-PG9_5-compilation-error-with-VS-2015-2017-2019_v14.txt | text/plain | 8.2 KB |
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | davinder singh <davindersingh2692(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-28 18:14:55 |
Message-ID: | CAC+AXB0=+prvRgYWnc36Vfcb+v8-DSpd0fFeWHnLLDmPh20Qdg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 28, 2020 at 5:16 PM davinder singh <davindersingh2692(at)gmail(dot)com>
wrote:
> On Mon, Apr 27, 2020 at 4:50 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
>
>> Bemba_Zambia
>> Bena_Tanzania
>> Bulgarian_Bulgaria
>> Swedish_Sweden.1252
>> Swedish_Sweden
>>
>
> I have tested with different locales with codepages including above. There
> are few which return different locale code but the error messages in both
> the cases are the same. I have attached the test and log files.
>
But there was one case, where locale code and error messages both are
> different.
> Portuguese_Brazil.1252
>
> log from [1]
> 2020-04-28 14:27:39.785 GMT [2284] DEBUG: IsoLocaleName() executed;
> locale: "pt"
> 2020-04-28 14:27:39.787 GMT [2284] ERROR: division by zero
> 2020-04-28 14:27:39.787 GMT [2284] STATEMENT: Select 1/0;
>
> log from [2]
> 2020-04-28 14:36:20.666 GMT [14608] DEBUG: IsoLocaleName() executed;
> locale: "pt_BR"
> 2020-04-28 14:36:20.673 GMT [14608] ERRO: divisão por zero
> 2020-04-28 14:36:20.673 GMT [14608] COMANDO: Select 1/0;
>
AFAICT, the good result is coming from the new logic.
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | davinder singh <davindersingh2692(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-28 19:53:19 |
Message-ID: | CAC+AXB2fz7-0xdmtMDiMgp-o3K8QPZhy6xq-DFrbKv1mwEE1Qw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 28, 2020 at 9:38 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> "pt" means portuguese language.
> "pt_BR" means portuguese language from Brazil, "divisão por zero", is
> correct.
> "pt_PT" means portuguese language from Portugal, "division by zero"?
> poderia ser "divisão por zero", too.
>
> Why "pt_PT" do not is translated?
>
The translation files are generated as 'pt_BR.po', so this is the expected
behaviour.
With my limited knowledge of Portuguese, it makes little sense to have a
localized version.
Regards,
Juan José Santamaría Flecha
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-29 02:51:32 |
Message-ID: | CAA4eK1+SK=1qTScSuVmfo8WE1kVrC4cBwM16Ey6q=S7OZUFceQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 29, 2020 at 1:32 AM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
>
> Em ter., 28 de abr. de 2020 às 16:53, Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> escreveu:
>>
>>
>>
>> On Tue, Apr 28, 2020 at 9:38 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
>>>
>>> "pt" means portuguese language.
>>> "pt_BR" means portuguese language from Brazil, "divisão por zero", is correct.
>>> "pt_PT" means portuguese language from Portugal, "division by zero"? poderia ser "divisão por zero", too.
>>>
>>> Why "pt_PT" do not is translated?
>>
>>
>> The translation files are generated as 'pt_BR.po', so this is the expected behaviour.
>>
>> With my limited knowledge of Portuguese, it makes little sense to have a localized version.
>
> Well, both are PORTUGUE language, but, do not the same words.
> pt_PT.po, obviously is missing, I can provide a version, but still, it wouldn't be 100%, but it's something.
> Would it be useful?
>
I am not sure but that doesn't seem to be related to this patch. If
it is not related to this patch then it is better to start a separate
thread (probably on pgsql-translators list).
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-29 02:54:06 |
Message-ID: | CAA4eK1JpK38iApmvfezL4i_pRnfPHFpqh34n=xoRa9zAsJ3m3A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 29, 2020 at 8:21 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Wed, Apr 29, 2020 at 1:32 AM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> >
> > Em ter., 28 de abr. de 2020 às 16:53, Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> escreveu:
> >>
> >>
> >>
> >> On Tue, Apr 28, 2020 at 9:38 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> >>>
> >>> "pt" means portuguese language.
> >>> "pt_BR" means portuguese language from Brazil, "divisão por zero", is correct.
> >>> "pt_PT" means portuguese language from Portugal, "division by zero"? poderia ser "divisão por zero", too.
> >>>
> >>> Why "pt_PT" do not is translated?
> >>
> >>
> >> The translation files are generated as 'pt_BR.po', so this is the expected behaviour.
> >>
> >> With my limited knowledge of Portuguese, it makes little sense to have a localized version.
> >
> > Well, both are PORTUGUE language, but, do not the same words.
> > pt_PT.po, obviously is missing, I can provide a version, but still, it wouldn't be 100%, but it's something.
> > Would it be useful?
> >
>
> I am not sure but that doesn't seem to be related to this patch. If
> it is not related to this patch then it is better to start a separate
> thread (probably on pgsql-translators list).
>
BTW, do you see any different results for pt_PT with create_locale
version or the new patch version being discussed here?
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-29 05:19:28 |
Message-ID: | CAHzhFSG3mnCskGsXFFsyYiyDaEXRtyr29ORdPoy4SyKG+mhHcg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 29, 2020 at 8:24 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> BTW, do you see any different results for pt_PT with create_locale
> version or the new patch version being discussed here?
>
No, there is no difference for pt_PT. The difference you are noticing is
because of the previous locale setting.
--
Regards,
Davinder
EnterpriseDB: http://www.enterprisedb.com
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-29 05:20:38 |
Message-ID: | CAHzhFSGOX_84QcQKiTpRhGdrGVhX-przi7O83obj8EO++CkuLw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 28, 2020 at 11:45 PM Juan José Santamaría Flecha <
juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> On Tue, Apr 28, 2020 at 5:16 PM davinder singh <
> davindersingh2692(at)gmail(dot)com> wrote:
>
>> I have tested with different locales with codepages including above.
>> There are few which return different locale code but the error messages in
>> both the cases are the same. I have attached the test and log files.
>>
> But there was one case, where locale code and error messages both are
>> different.
>> Portuguese_Brazil.1252
>>
>> log from [1]
>> 2020-04-28 14:27:39.785 GMT [2284] DEBUG: IsoLocaleName() executed;
>> locale: "pt"
>> 2020-04-28 14:27:39.787 GMT [2284] ERROR: division by zero
>> 2020-04-28 14:27:39.787 GMT [2284] STATEMENT: Select 1/0;
>>
>> log from [2]
>> 2020-04-28 14:36:20.666 GMT [14608] DEBUG: IsoLocaleName() executed;
>> locale: "pt_BR"
>> 2020-04-28 14:36:20.673 GMT [14608] ERRO: divisão por zero
>> 2020-04-28 14:36:20.673 GMT [14608] COMANDO: Select 1/0;
>>
>
> AFAICT, the good result is coming from the new logic.
>
Yes, I also feel the same.
--
Regards,
Davinder
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-29 12:27:22 |
Message-ID: | CAA4eK1L-rQZUKfCV4_7AvZcW3DEO_OBeAaRPMK1Hx+52mcoVHQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 28, 2020 at 11:39 PM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
>
> On Mon, Apr 27, 2020 at 1:20 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>> I think we should backpatch this till 9.5 as I could see the changes
>> made by commit 0fb54de9 to support MSVC2015 are present in that branch
>> and the same is mentioned in the commit message. Would you like to
>> prepare patches (and test those) for back-branches?
>
>
> I do not have means to test these patches using Visual Studio previous to 2012, but please find attached patches for 9.5-9.6 and 10-11-12 as of version 14. The extension is 'txt' not to break the cfbot.
>
I see some problems with these patches.
1.
+ loct = _create_locale(LC_CTYPE, winlocname);
+ if (loct != NULL)
+ {
+ lcid = loct->locinfo->lc_handle[LC_CTYPE];
+ if (lcid == 0)
+ lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
+ _free_locale(loct);
+ }
if (!GetLocaleInfoA(lcid, LOCALE_SISO639LANGNAME, isolang, sizeof(isolang)))
return NULL;
if (!GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, isocrty, sizeof(isocrty)))
return NULL;
In the above change even if loct is NULL, we call GetLocaleInfoA()
which is wrong and the same is not a problem without the patch.
2. I think the code in IsoLocaleName is quite confusing and difficult
to understand in back branches and the changes due to this bug-fix
made it more complicated. I am thinking to refactor it such that the
code for (_MSC_VER >= 1700 && _MSC_VER < 1900), (_MSC_VER >= 1900)
and last #else code (the code for version < 17) resides in their own
functions. That might make this function easier to understand, what
do you think?
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-29 12:32:57 |
Message-ID: | CAA4eK1LRSZGsi7p5Q=UhRoC-jcPOhUzr32Yq_0jXh_2L_8iz7g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Apr 27, 2020 at 4:50 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> I think we should backpatch this till 9.5 as I could see the changes
> made by commit 0fb54de9 to support MSVC2015 are present in that branch
> and the same is mentioned in the commit message.
>
Today, I was thinking about the pros and cons of backpatching this.
The pros are that this is bug-fix and is reported multiple times so it
is good to backpatch it. The cons are the code in the back branches
is not very straight forward and this change will make it a bit more
complicated, so we might want to do it only in HEAD. I am not
completely sure about this. What do others think?
Michael, others who have worked in this area, do you have any opinion
on this matter?
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-29 13:50:24 |
Message-ID: | CAA4eK1JeFE5n8XBFQhtAVuA7HXrTfsi3Uk-2SBaLj6OUiSVzLg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 29, 2020 at 5:57 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
>
> 2. I think the code in IsoLocaleName is quite confusing and difficult
> to understand in back branches and the changes due to this bug-fix
> made it more complicated. I am thinking to refactor it such that the
> code for (_MSC_VER >= 1700 && _MSC_VER < 1900), (_MSC_VER >= 1900)
> and last #else code (the code for version < 17) resides in their own
> functions.
>
Another possibility could be to add just a branch for (_MSC_VER >=
1900) and add that code in a separate function without touching other
parts of this function. That would avoid testing it various versions
of MSVC.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-29 16:05:31 |
Message-ID: | CAC+AXB242HemTage_NP=9dwUiyzAboD50KUjYpJu_w2sKUcdPQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 29, 2020 at 3:50 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Wed, Apr 29, 2020 at 5:57 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
> >
> > 2. I think the code in IsoLocaleName is quite confusing and difficult
> > to understand in back branches and the changes due to this bug-fix
> > made it more complicated. I am thinking to refactor it such that the
> > code for (_MSC_VER >= 1700 && _MSC_VER < 1900), (_MSC_VER >= 1900)
> > and last #else code (the code for version < 17) resides in their own
> > functions.
> >
>
> Another possibility could be to add just a branch for (_MSC_VER >=
> 1900) and add that code in a separate function without touching other
> parts of this function. That would avoid testing it various versions
> of MSVC.
>
I was not aware of how many switches IsoLocaleName() already had before
trying to backpatch. I think offering an alternative might be a cleaner
approach, I will work on that.
Regards,
Juan José Santamaría Flecha
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-04-30 03:06:55 |
Message-ID: | CAA4eK1+xNboW9yySitvxhZQRM9i+xY8-FOk6D2Tv6fxFnA-V_Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Apr 29, 2020 at 9:36 PM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> On Wed, Apr 29, 2020 at 3:50 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>> On Wed, Apr 29, 2020 at 5:57 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>> >
>> > 2. I think the code in IsoLocaleName is quite confusing and difficult
>> > to understand in back branches and the changes due to this bug-fix
>> > made it more complicated. I am thinking to refactor it such that the
>> > code for (_MSC_VER >= 1700 && _MSC_VER < 1900), (_MSC_VER >= 1900)
>> > and last #else code (the code for version < 17) resides in their own
>> > functions.
>> >
>>
>> Another possibility could be to add just a branch for (_MSC_VER >=
>> 1900) and add that code in a separate function without touching other
>> parts of this function. That would avoid testing it various versions
>> of MSVC.
>
>
> I was not aware of how many switches IsoLocaleName() already had before trying to backpatch. I think offering an alternative might be a cleaner approach, I will work on that.
>
Okay, thanks. The key point to keep in mind is to avoid touching the
code related to prior MSVC versions as we might not have set up to
test those.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-04 13:29:15 |
Message-ID: | CAC+AXB3j1GmpDSu2+Ndk-XhFbFN7bN9bd2=X=t=d9sjO+3gxQQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Apr 30, 2020 at 5:07 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > I was not aware of how many switches IsoLocaleName() already had before
> trying to backpatch. I think offering an alternative might be a cleaner
> approach, I will work on that.
> >
>
> Okay, thanks. The key point to keep in mind is to avoid touching the
> code related to prior MSVC versions as we might not have set up to
> test those.
>
Please find attached a new version following this approach.
Regards,
Juan José Santamaría Flecha
Attachment | Content-Type | Size |
---|---|---|
0001-PG9_5-compilation-error-with-VS-2015-2017-2019_v15.patch | application/octet-stream | 7.2 KB |
0001-PG_10-compilation-error-with-VS-2015-2017-2019_v15.patch | application/octet-stream | 7.1 KB |
0001-PG-compilation-error-with-VS-2015-2017-2019_v15.patch | application/octet-stream | 7.8 KB |
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-05 11:34:24 |
Message-ID: | CAA4eK1KsU5TV_ypLHZsok7LvqJLg1WSPsjcf2BR0a_Q5BuD9mw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, May 4, 2020 at 6:59 PM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> On Thu, Apr 30, 2020 at 5:07 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>>
>> Okay, thanks. The key point to keep in mind is to avoid touching the
>> code related to prior MSVC versions as we might not have set up to
>> test those.
>
>
> Please find attached a new version following this approach.
>
Thanks for the new version. I have found few problems and made
changes accordingly. In back-branch patches, I found one major
problem.
+#if (_MSC_VER >= 1900) /* Visual Studio 2015 or later */
+ rc = get_iso_localename(winlocname, iso_lc_messages);
+#else
Here, we need to free loct, otherwise, it will leak each time this
function is called on a newer MSVC version. Also, call to
_create_locale is redundant in _MSC_VER >= 1900. So, I have tried to
write it differently, see what do you think about it?
*
+ * BEWARE: this function is WIN32 specific, so wchar_t are UTF-16.
I am not sure how much relevant is this comment so removed for now.
Apart from that, I have made a few other changes in comments, fixed
typos, and ran pgindent. Let me know what do you think of attached
patches?
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v16.patch | application/octet-stream | 9.0 KB |
0001-PG_10-compilation-error-with-VS-2015-2017-2019_v16.patch | application/octet-stream | 8.3 KB |
0001-PG9_5-compilation-error-with-VS-2015-2017-2019_v16.patch | application/octet-stream | 8.3 KB |
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-05 22:48:28 |
Message-ID: | CAC+AXB26dVS8-4JK-w18ufRWgf8KJ2cOEzODkU65igZUaXzs0g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, May 5, 2020 at 1:34 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> Apart from that, I have made a few other changes in comments, fixed
> typos, and ran pgindent. Let me know what do you think of attached
> patches?
>
The patches are definitely in better shape.
I think that the definition of get_iso_localename() should be consistent
across all versions, that is HEAD like back-patched.
Regards,
Juan José Santamaría Flecha
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-06 04:40:54 |
Message-ID: | CAA4eK1Ku41-gzt4NfL0EPyjpwU6__rqYv-rB2_APyXbT-mSQ4Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, May 6, 2020 at 4:19 AM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> On Tue, May 5, 2020 at 1:34 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>>
>> Apart from that, I have made a few other changes in comments, fixed
>> typos, and ran pgindent. Let me know what do you think of attached
>> patches?
>
>
> The patches are definitely in better shape.
>
> I think that the definition of get_iso_localename() should be consistent across all versions, that is HEAD like back-patched.
>
Fair enough. I have changed such that get_iso_localename is the same
in HEAD as it is backbranch patches. I have attached backbranch
patches for the ease of verification.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
0001-PG-compilation-error-with-VS-2015-2017-2019_v17.patch | application/x-patch | 10.6 KB |
0001-PG9_5-compilation-error-with-VS-2015-2017-2019_v16.patch | application/x-patch | 8.3 KB |
0001-PG_10-compilation-error-with-VS-2015-2017-2019_v16.patch | application/x-patch | 8.3 KB |
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-06 17:30:50 |
Message-ID: | CAC+AXB0NtOqy7hLiVFh0MtMoyD-xRo9stRdRUZgqyhY1ai_N7A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, May 6, 2020 at 6:41 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Wed, May 6, 2020 at 4:19 AM Juan José Santamaría Flecha
> >
> > I think that the definition of get_iso_localename() should be consistent
> across all versions, that is HEAD like back-patched.
> >
>
> Fair enough. I have changed such that get_iso_localename is the same
> in HEAD as it is backbranch patches. I have attached backbranch
> patches for the ease of verification.
>
LGTM, and I see no regression in the manual SQL tests, so no further
comments from my part.
Regards,
Juan José Santamaría Flecha
From: | davinder singh <davindersingh2692(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-07 04:24:51 |
Message-ID: | CAHzhFSHAkgipjd_sT4L4+VOMr3Heb-gP0JrJ7=5NBumZpMqQVQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, May 6, 2020 at 10:11 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> > I think that the definition of get_iso_localename() should be consistent
> across all versions, that is HEAD like back-patched.
> >
>
> Fair enough. I have changed such that get_iso_localename is the same
> in HEAD as it is backbranch patches. I have attached backbranch
> patches for the ease of verification.
>
I have verified/tested the latest patches for all versions and didn't find
any problem.
--
Regards,
Davinder
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-07 05:51:04 |
Message-ID: | CAA4eK1JzXPvEwTOnUv24vWqZeSJxsVzrSfL+GxxBoXcMU-OZ7w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, May 6, 2020 at 11:01 PM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> On Wed, May 6, 2020 at 6:41 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>> On Wed, May 6, 2020 at 4:19 AM Juan José Santamaría Flecha
>> >
>> > I think that the definition of get_iso_localename() should be consistent across all versions, that is HEAD like back-patched.
>> >
>>
>> Fair enough. I have changed such that get_iso_localename is the same
>> in HEAD as it is backbranch patches. I have attached backbranch
>> patches for the ease of verification.
>
>
> LGTM, and I see no regression in the manual SQL tests, so no further comments from my part.
>
Thanks, Juan and Davinder for verifying the latest patches. I think
this patch is ready to commit unless someone else has any comments. I
will commit and backpatch this early next week (probably on Monday)
unless I see more comments.
To summarize, this is a longstanding issue of Windows build (NLS
enabled builds) for Visual Studio 2015 and later releases. Visual
Studio 2015 and later versions should still be able to do the same as
Visual Studio 2012, but the declaration of locale_name is missing in
_locale_t, causing the code compilation to fail, hence this patch
falls back
instead on to enumerating all system locales by using
EnumSystemLocalesEx to find the required locale name. If the input
argument is in Unix-style then we can get ISO Locale name directly by
using GetLocaleInfoEx() with LCType as LOCALE_SNAME.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-07 06:27:07 |
Message-ID: | 4269.1588832827@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> Thanks, Juan and Davinder for verifying the latest patches. I think
> this patch is ready to commit unless someone else has any comments. I
> will commit and backpatch this early next week (probably on Monday)
> unless I see more comments.
Monday is a back-branch release wrap day. If you push a back-patched
change on that day (or immediately before it), it had better be a security
fix.
regards, tom lane
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-07 08:46:32 |
Message-ID: | CAA4eK1LWtf5b8eJRpi3oSgiDBQ=2q7ZsyNrYk31QvNsKGBVsEA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, May 7, 2020 at 11:57 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> > Thanks, Juan and Davinder for verifying the latest patches. I think
> > this patch is ready to commit unless someone else has any comments. I
> > will commit and backpatch this early next week (probably on Monday)
> > unless I see more comments.
>
> Monday is a back-branch release wrap day. If you push a back-patched
> change on that day (or immediately before it), it had better be a security
> fix.
>
Okay. I'll wait in that case and will push it after that.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-07 10:40:17 |
Message-ID: | CAA4eK1KR_-+5XMG51Y4sSjbH83jndQcWW-VbjK94AVaouzKueA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, May 7, 2020 at 11:57 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> > Thanks, Juan and Davinder for verifying the latest patches. I think
> > this patch is ready to commit unless someone else has any comments. I
> > will commit and backpatch this early next week (probably on Monday)
> > unless I see more comments.
>
> Monday is a back-branch release wrap day.
>
How can I get the information about release wrap day? The minor
release dates are mentioned on the website [1], but this information
is not available. Do we keep it some-fixed number of days before
minor release?
[1] - /developer/roadmap/
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-07 13:21:31 |
Message-ID: | 22783.1588857691@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> On Thu, May 7, 2020 at 11:57 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Monday is a back-branch release wrap day.
> How can I get the information about release wrap day? The minor
> release dates are mentioned on the website [1], but this information
> is not available. Do we keep it some-fixed number of days before
> minor release?
Yes, we've been using the same release schedule for years. The
actual tarball wrap is always on a Monday --- if I'm doing it,
as is usually the case, I try to get it done circa 2100-2300 UTC.
There's a "quiet period" where we discourage nonessential commits
both before (starting perhaps on the Saturday) and after (until
the releases are tagged in git, about 24 hours after wrap).
The delay till public announcement on the Thursday is so the
packagers can produce their builds. Likewise, the reason for
a wrap-to-tag delay is in case the packagers find anything that
forces a re-wrap, which has happened a few times.
regards, tom lane
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-13 13:44:55 |
Message-ID: | CAA4eK1LpH4hhfK9O2Gvd1Cy20RekoDaFK72CW_-Bi4WUK+Nxyw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, May 7, 2020 at 6:51 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> > On Thu, May 7, 2020 at 11:57 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> Monday is a back-branch release wrap day.
>
> > How can I get the information about release wrap day? The minor
> > release dates are mentioned on the website [1], but this information
> > is not available. Do we keep it some-fixed number of days before
> > minor release?
>
> Yes, we've been using the same release schedule for years. The
> actual tarball wrap is always on a Monday --- if I'm doing it,
> as is usually the case, I try to get it done circa 2100-2300 UTC.
> There's a "quiet period" where we discourage nonessential commits
> both before (starting perhaps on the Saturday) and after (until
> the releases are tagged in git, about 24 hours after wrap).
> The delay till public announcement on the Thursday is so the
> packagers can produce their builds. Likewise, the reason for
> a wrap-to-tag delay is in case the packagers find anything that
> forces a re-wrap, which has happened a few times.
>
Now that branches are tagged, I would like to commit and backpatch
this patch tomorrow unless there are any more comments/objections.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-13 14:04:51 |
Message-ID: | 31279.1589378691@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> Now that branches are tagged, I would like to commit and backpatch
> this patch tomorrow unless there are any more comments/objections.
The "quiet period" is over as soon as the tags appear in git.
regards, tom lane
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-14 08:48:58 |
Message-ID: | CAA4eK1K6xOF=jJzLnnUOHeym-Fwf8wfyFhEjpHaLZkdUoqZhPA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, May 13, 2020 at 7:34 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> > Now that branches are tagged, I would like to commit and backpatch
> > this patch tomorrow unless there are any more comments/objections.
>
> The "quiet period" is over as soon as the tags appear in git.
>
Pushed.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-14 09:06:53 |
Message-ID: | CAEudQApyJ0ED6vLzuDcrJFig2Lz7wA79htEnRGNKYumBw8WEdw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Em qui., 14 de mai. de 2020 às 05:49, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
escreveu:
> On Wed, May 13, 2020 at 7:34 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >
> > Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> > > Now that branches are tagged, I would like to commit and backpatch
> > > this patch tomorrow unless there are any more comments/objections.
> >
> > The "quiet period" is over as soon as the tags appear in git.
> >
>
> Pushed.
>
Thank you for the commit.
regards,
Ranier Vilela
From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, davinder singh <davindersingh2692(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG compilation error with Visual Studio 2015/2017/2019 |
Date: | 2020-05-14 09:12:03 |
Message-ID: | CAC+AXB1F-aDPjOzdROFWJ7avE8rVgrPbfzUfsU2Rk2vkm-xdVg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, May 14, 2020 at 11:07 AM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> Em qui., 14 de mai. de 2020 às 05:49, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> escreveu:
>
>> On Wed, May 13, 2020 at 7:34 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> >
>> > Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
>> > > Now that branches are tagged, I would like to commit and backpatch
>> > > this patch tomorrow unless there are any more comments/objections.
>> >
>> > The "quiet period" is over as soon as the tags appear in git.
>> >
>>
>> Pushed.
>>
> Thank you for the commit.
>
Great. Thanks to everyone involved.