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

2010-04-26 Thread Bruce Momjian
Hiroshi Inoue wrote: > Bruce Momjian wrote: > > Takahiro Itagaki wrote: > >> Takahiro Itagaki 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

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

2010-04-25 Thread Hiroshi Inoue
Bruce Momjian wrote: Takahiro Itagaki wrote: Takahiro Itagaki 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

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

2010-04-24 Thread Bruce Momjian
Takahiro Itagaki wrote: > > Takahiro Itagaki 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 remem

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

2010-04-21 Thread Takahiro Itagaki
Takahiro Itagaki 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. Regards, --- Takahiro Itagaki NTT Open Source Software Center -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgr

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

2010-04-20 Thread Takahiro Itagaki
Hiroshi Inoue wrote: > 1. How does it work when LC_MONETARY and LC_NUMERIC are different? I think it is rarely used, but possible. Fixed. > 2. Calling db_encoding_strdup() for lconv->grouping is appropriate? Ah, we didn't need it. Removed. Revised patch attached. Please test it. Regards, --

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

2010-04-20 Thread Hiroshi Inoue
Takahiro Itagaki wrote: Magnus Hagander wrote: 1. setlocale(LC_CTYPE, lc_monetary) 2. setlocale(LC_MONETARY, lc_monetary) 3. lc = localeconv() 4. pg_do_encoding_conversion(lc->xxx, FROM pg_get_encoding_from_locale(lc_monetary), TO GetDatabaseEncoding()) 5. Revert LC_CTYPE and LC_MONE

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

2010-04-20 Thread Bruce Momjian
Magnus Hagander wrote: > > Another idea is to use GetLocaleInfoW() [1], that is win32 native locale > > functions, instead of the libc one. It returns locale characters in wide > > chars, so we can safely convert them as UTF16->UTF8->db. But it requires > > an additional branch in our locale codes

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

2010-04-20 Thread Bruce Momjian
Takahiro Itagaki wrote: > > Magnus Hagander wrote: > > > > 1. setlocale(LC_CTYPE, lc_monetary) > > > 2. setlocale(LC_MONETARY, lc_monetary) > > > 3. lc = localeconv() > > > 4. pg_do_encoding_conversion(lc->xxx, > > > FROM pg_get_encoding_from_locale(lc_monetary), > > > TO GetDatabaseEn

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

2010-04-20 Thread Bruce Momjian
Magnus Hagander wrote: > > One new idea would be to set LC_CTYPE to UTF16/widechars unconditionally > > on Win32 and then just convert that always to the server encoding with > > win32_wchar_to_db_encoding(), instead of using the encoding from > > LC_MONETARY to set LC_CTYPE and having to do double

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

2010-04-20 Thread Takahiro Itagaki
Magnus Hagander wrote: > > 1. setlocale(LC_CTYPE, lc_monetary) > > 2. setlocale(LC_MONETARY, lc_monetary) > > 3. lc = localeconv() > > 4. pg_do_encoding_conversion(lc->xxx, > > FROM pg_get_encoding_from_locale(lc_monetary), > > TO GetDatabaseEncoding()) > > 5. Revert LC_CTYPE and LC_MO

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

2010-04-19 Thread Magnus Hagander
On Mon, Apr 19, 2010 at 03:59, Takahiro Itagaki wrote: > > Magnus Hagander wrote: > >> But I'm unsure how that would work. We're talking about the output of >> localeconv(), right? I don't see a version of localeconv() that does >> wide chars anywhere. (You can't just set LC_CTYPE and use the reg

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

2010-04-18 Thread Takahiro Itagaki
Magnus Hagander wrote: > But I'm unsure how that would work. We're talking about the output of > localeconv(), right? I don't see a version of localeconv() that does > wide chars anywhere. (You can't just set LC_CTYPE and use the regular > function - Windows has a separate set of functions for d

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

2010-04-16 Thread Magnus Hagander
On Mon, Mar 22, 2010 at 9:14 PM, Bruce Momjian wrote: > Takahiro Itagaki wrote: >> >> Bruce Momjian wrote: >> >> > Takahiro Itagaki wrote: >> > > Since 9.0 has GetPlatformEncoding() for the purpose, we could simplify >> > > db_encoding_strdup() with the function. Like this: >> > >> > OK, I don't

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

2010-03-22 Thread Bruce Momjian
Takahiro Itagaki wrote: > > Bruce Momjian wrote: > > > Takahiro Itagaki wrote: > > > Since 9.0 has GetPlatformEncoding() for the purpose, we could simplify > > > db_encoding_strdup() with the function. Like this: > > > > OK, I don't have any Win32 people testing this patch so if we want this >

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

2010-03-17 Thread Takahiro Itagaki
Bruce Momjian wrote: > Takahiro Itagaki wrote: > > Since 9.0 has GetPlatformEncoding() for the purpose, we could simplify > > db_encoding_strdup() with the function. Like this: > > OK, I don't have any Win32 people testing this patch so if we want this > fixed for 9.0 someone is going to have t

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

2010-03-12 Thread Bruce Momjian
Takahiro Itagaki wrote: > > Bruce Momjian wrote: > > > 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. > > Since 9.0 has GetPlatformEncoding() for the purpose, we could simplify >

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

2010-03-11 Thread Takahiro Itagaki
Bruce Momjian wrote: > 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. Since 9.0 has GetPlatformEncoding() for the purpose, we could simplify db_encoding_strdup() with the function. L

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

2010-03-02 Thread Bruce Momjian
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 se

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

2010-03-02 Thread Hiroshi Inoue
Bruce Momjian wrote: Hiroshi Inoue wrote: Bruce Momjian wrote: Bruce Momjian wrote: Hiroshi Inoue wrote: Bruce Momjian wrote: Hiroshi Inoue wrote: Bruce Momjian wrote: Where are we on this issue? Oops I forgot it completely. I have a little improved version and would post it tonight. Ah,

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

2010-03-01 Thread Bruce Momjian
Hiroshi Inoue wrote: > Bruce Momjian wrote: > > Bruce Momjian wrote: > >> Hiroshi Inoue wrote: > >>> Bruce Momjian wrote: > Hiroshi Inoue wrote: > > Bruce Momjian wrote: > >> Where are we on this issue? > > Oops I forgot it completely. > > I have a little improved version and w

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

2010-03-01 Thread Hiroshi Inoue
Bruce Momjian wrote: Bruce Momjian wrote: Hiroshi Inoue wrote: Bruce Momjian wrote: Hiroshi Inoue wrote: Bruce Momjian wrote: Where are we on this issue? Oops I forgot it completely. I have a little improved version and would post it tonight. Ah, very good. Thanks. Attached is an improve

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

2010-02-28 Thread Bruce Momjian
Bruce Momjian wrote: > Hiroshi Inoue wrote: > > Bruce Momjian wrote: > > > Hiroshi Inoue wrote: > > >> Bruce Momjian wrote: > > >>> Where are we on this issue? > > >> Oops I forgot it completely. > > >> I have a little improved version and would post it tonight. > > > > > > Ah, very good. Thanks.

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

2010-02-27 Thread Bruce Momjian
Hiroshi Inoue wrote: > Bruce Momjian wrote: > > Hiroshi Inoue wrote: > >> Bruce Momjian wrote: > >>> Where are we on this issue? > >> Oops I forgot it completely. > >> I have a little improved version and would post it tonight. > > > > Ah, very good. Thanks. > > Attached is an improved version.

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

2009-06-03 Thread Hiroshi Inoue
Tom Lane wrote: > Hiroshi Inoue writes: >> Tom Lane wrote: >>> * This seems to be assuming that the user has set LC_MONETARY and >>> LC_NUMERIC the same. What if they're different? > >> Strictky speaking they should be handled individually. > > I thought about this some more, and I wonder why y

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

2009-06-03 Thread Tom Lane
Hiroshi Inoue writes: > Tom Lane wrote: >> * This seems to be assuming that the user has set LC_MONETARY and >> LC_NUMERIC the same. What if they're different? > Strictky speaking they should be handled individually. I thought about this some more, and I wonder why you did it like this at all.

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

2009-06-01 Thread Hiroshi Inoue
Tom Lane wrote: > Hiroshi Inoue writes: >> Tom Lane wrote: >>> I think what this suggests is that there probably needs to be some >>> encoding conversion logic near the places we examine localeconv() >>> output. > >> Attached is a patch to the current CVS. >> It uses a similar way like LC_TIME st

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

2009-05-29 Thread Tom Lane
Hiroshi Inoue writes: > Tom Lane wrote: >> I think what this suggests is that there probably needs to be some >> encoding conversion logic near the places we examine localeconv() >> output. > Attached is a patch to the current CVS. > It uses a similar way like LC_TIME stuff does. I'm not really