Re: plperl vs LC_COLLATE (was Re: Possible savepoint bug)

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paesold <mpaesold(at)gmx(dot)at>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plperl vs LC_COLLATE (was Re: Possible savepoint bug)
Date: 2006-01-08 00:58:21
Message-ID: 43C063AD.1030101@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan wrote:

>
>
> Tom Lane wrote:
>
>> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>>
>>
>>> However, to the best of my knowledge, Windows does NOT consult the
>>> environment when set_locale is called. ISTM we probably need to call
>>> set_locale ourselves on Windows with the desired values.
>>>
>>
>>
>> We already do, during process startup. The question becomes where the
>> heck is Perl looking for the locale information, when on Windows?
>>
>>
>
> The Windows docs at
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_setlocale.2c_._wsetlocale.asp
> say:
>
> |setlocale( LC_ALL, "" );|
> Sets the locale to the default, which is the user-default ANSI code
> page obtained from the operating system.
>
> Does libperl call this only at interpreter startup? If so, maybe we
> should probably save out the settings and then restore them after the
> interpreter has started.
>
>

After some analysis of perl's locale.c, I came up with the attached
patch, which seems to cure the previously observed problem on my Windows
box.

The questions are:
a) is this an acceptable solution, and
b) should we do this for all the LC_* settings (on Windows at least)?
Especially, should we do it for LC_CTYPE?

cheers

andrew

Attachment Content-Type Size
localefix.patch text/x-patch 1.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2006-01-08 03:12:31 ISO 8601 Intervals
Previous Message Jeremy Drake 2006-01-08 00:57:33 Re: catalog corruption bug