Thread: win32 locale fixes

win32 locale fixes

From
"Magnus Hagander"
Date:
The following patch fixes locale support under win32.

* Saves and reloads LC_COLLATE and LC_CTYPE when a new backend is
execed. Also preserved in pgstat even though it's supposedly not used
there at the moment, to be on the safe side for the future. With this
patch, passes regression tests with regional settings set to != english.

* This is not necessary (see previous discussion) to do for the other
LC_xxx types. These are all set in GUC, and are handled by the routines
to save/restore all nondefault GUC varilables.

* setlocale(LC_MESSAGES,"") returns NULL on win32. And it's always
called as part of GUC setup. Patch changes code to ignore the result if
we set it to "". (Can someone confirm that this is not totally unsafe?
From what I can tell, LC_MESSAGS is only set to ""


Oh, and how do I change a locale:d system into english? Mine picks up
swedish from the environment...


After this, the only remaining regression error on win32 is the join one
(the "unimportant ordering" one)

//Magnus


Attachment

Re: win32 locale fixes

From
Tom Lane
Date:
"Magnus Hagander" <mha@sollentuna.net> writes:
> The following patch fixes locale support under win32.

I've applied the change in pg_locale.c, and will fold the other changes
into an upcoming rewrite of the EXEC_BACKEND code.

            regards, tom lane

Re: win32 locale fixes

From
Claudio Natoli
Date:
Hi Tom,

> other changes into an upcoming rewrite of the EXEC_BACKEND code.

are you planning on doing this for 7.5? I was at some stage, as promised,
but not for 7.5.

Cheers,
Claudio

---
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>

Re: win32 locale fixes

From
Bruce Momjian
Date:
Claudio Natoli wrote:
>
> Hi Tom,
>
> > other changes into an upcoming rewrite of the EXEC_BACKEND code.
>
> are you planning on doing this for 7.5? I was at some stage, as promised,
> but not for 7.5.

I think Tom is doing it now.  He has to merge the checkpointer into the
background writer, so he already has to hit that code, and if I am
lucky, he will have time to create a PITR process for me too, so it
doesn't make sense to want for 7.6.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: win32 locale fixes

From
Claudio Natoli
Date:
Bruce Momjian wrote:
> Claudio Natoli wrote:
> >
> > Hi Tom,
> >
> > > other changes into an upcoming rewrite of the EXEC_BACKEND code.
> >
> > are you planning on doing this for 7.5? I was at some stage, as
promised,
> > but not for 7.5.
>
> I think Tom is doing it now.  He has to merge the checkpointer into the
> background writer, so he already has to hit that code, and if I am
> lucky, he will have time to create a PITR process for me too, so it
> doesn't make sense to want for 7.6.

Ah, that's fine. Just feel bad since I promised Tom I'd do it when "the dust
settled", but I think we'll both live :-)

Cheers,
Claudio

---
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>

Re: win32 locale fixes

From
Bruce Momjian
Date:
Looks like Tom put this all in.

---------------------------------------------------------------------------

Magnus Hagander wrote:
> The following patch fixes locale support under win32.
>
> * Saves and reloads LC_COLLATE and LC_CTYPE when a new backend is
> execed. Also preserved in pgstat even though it's supposedly not used
> there at the moment, to be on the safe side for the future. With this
> patch, passes regression tests with regional settings set to != english.
>
> * This is not necessary (see previous discussion) to do for the other
> LC_xxx types. These are all set in GUC, and are handled by the routines
> to save/restore all nondefault GUC varilables.
>
> * setlocale(LC_MESSAGES,"") returns NULL on win32. And it's always
> called as part of GUC setup. Patch changes code to ignore the result if
> we set it to "". (Can someone confirm that this is not totally unsafe?
> From what I can tell, LC_MESSAGS is only set to ""
>
>
> Oh, and how do I change a locale:d system into english? Mine picks up
> swedish from the environment...
>
>
> After this, the only remaining regression error on win32 is the join one
> (the "unimportant ordering" one)
>
> //Magnus
>

Content-Description: locale_win32.patch

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073