Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] trouble with to_char('L')

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Mikko <mhannesy(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] trouble with to_char('L')
Date: 2010-03-02 18:14:00
Message-ID: 201003021814.o22IE1s26092@momjian.us (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
Hiroshi Inoue wrote:
> >>>> I need someone with WIN32 experience to review and test this patch.
> >>> I don't understand why cache_locale_time() works on Windows.  It sets
> >>> the LC_CTYPE but does not do any encoding coversion.
> >> Doesn't strftime_win32 do the conversion?
> > 
> > Oh, I now see strftime is redefined as a macro in that C files.  Thanks.
> > 
> >>> Do month and
> >>> day-of-week names not work either, or do they work and the encoding
> >>> conversion for numeric/money, e.g. Euro, it not necessary?
> >> db_strdup does the conversion.
> > 
> > Should we pull the encoding conversion into a separate function and have
> > strftime_win32() and db_strdup() both call it?
> 
> We may be able to pull the conversion WideChars => UTF8 =>
> a PG encoding into an function.

OK, I have created a new function, win32_wchar_to_db_encoding(), to
share the conversion from wide characters to the database encoding.
New patch attached.

> BTW both PGLC_localeconv() and cache_locale_time() save the current
>   LC_CTYPE first and restore them just before returning the functions.
> I'm suspicious if it's OK when errors occur in middle of the functions.

Yea, I added a comment questioning if that is a problem.

-- 
  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do

Attachment: /pgpatches/pg_locale
Description: text/x-diff (11.9 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2010-03-02 18:30:15
Subject: Re: Re: Hot Standby query cancellation and Streaming Replication integration
Previous:From: Scott BaileyDate: 2010-03-02 17:10:40
Subject: Re: to_timestamp() and quarters

pgsql-general by date

Next:From: Ben EliottDate: 2010-03-02 18:22:17
Subject: createdb but revoke dropdb
Previous:From: Chander GanesanDate: 2010-03-02 18:09:33
Subject: Re: The OS Command for pg_hotbackup -- Use lvmsnapshot instead of tar cvzf

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group