Hiroshi Inoue wrote:
> Bruce Momjian wrote:
> > Takahiro Itagaki wrote:
> >> Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp> wrote:
> >>
> >>> Revised patch attached. Please test it.
> >> I applied this version of the patch.
> >> Please check wheter the bug is fixed and any buildfarm failures.
> >
> > Great. I have merged in my C comments into the code with the attached
> > patch so we remember why the code is setup as it is.
> >
> > One thing I am confused about is that, for Win32, our numeric/monetary
> > handling sets lc_ctype to match numeric/monetary, while our time code in
> > the same file uses that method _and_ uses wcsftime() to return the value
> > in wide characters. So, why do we do both for time? Is there any value
> > to that?
>
> Unfortunately wcsftime() is a halfway conveniece function which uses
> ANSI version of functionalities internally.
> AFAIC the only way to remove the dependency to LC_CTYPE is to call
> GeLocaleInfoW() directly.
Thanks. I have documented this fact in a C comment; patch attached.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
Index: src/backend/utils/adt/pg_locale.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/pg_locale.c,v
retrieving revision 1.55
diff -c -c -r1.55 pg_locale.c
*** src/backend/utils/adt/pg_locale.c 24 Apr 2010 22:54:56 -0000 1.55
--- src/backend/utils/adt/pg_locale.c 26 Apr 2010 13:30:03 -0000
***************
*** 627,633 ****
save_lc_time = pstrdup(save_lc_time);
#ifdef WIN32
! /* See the WIN32 comment near the top of PGLC_localeconv() */
/* save user's value of ctype locale */
save_lc_ctype = setlocale(LC_CTYPE, NULL);
if (save_lc_ctype)
--- 627,641 ----
save_lc_time = pstrdup(save_lc_time);
#ifdef WIN32
! /*
! * On WIN32, there is no way to get locale-specific time values in a
! * specified locale, like we do for monetary/numeric. We can only get
! * CP_ACP (see strftime_win32) or UTF16. Therefore, we get UTF16 and
! * convert it to the database locale. However, wcsftime() internally
! * uses LC_CTYPE, so we set it here. See the WIN32 comment near the
! * top of PGLC_localeconv().
! */
!
/* save user's value of ctype locale */
save_lc_ctype = setlocale(LC_CTYPE, NULL);
if (save_lc_ctype)