Skip to content

Commit 7eb6e6b

Browse files
committed
Add comments about why we set LC_CTYPE in WIN32 for time when we don't
actually access it, per information from Hiroshi.
1 parent ab93cd9 commit 7eb6e6b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/backend/utils/adt/pg_locale.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 2002-2010, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.55 2010/04/24 22:54:56 momjian Exp $
7+
* $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.56 2010/04/26 14:17:52 momjian Exp $
88
*
99
*-----------------------------------------------------------------------
1010
*/
@@ -627,7 +627,15 @@ cache_locale_time(void)
627627
save_lc_time = pstrdup(save_lc_time);
628628

629629
#ifdef WIN32
630-
/* See the WIN32 comment near the top of PGLC_localeconv() */
630+
/*
631+
* On WIN32, there is no way to get locale-specific time values in a
632+
* specified locale, like we do for monetary/numeric. We can only get
633+
* CP_ACP (see strftime_win32) or UTF16. Therefore, we get UTF16 and
634+
* convert it to the database locale. However, wcsftime() internally
635+
* uses LC_CTYPE, so we set it here. See the WIN32 comment near the
636+
* top of PGLC_localeconv().
637+
*/
638+
631639
/* save user's value of ctype locale */
632640
save_lc_ctype = setlocale(LC_CTYPE, NULL);
633641
if (save_lc_ctype)

0 commit comments

Comments
 (0)