Re: to_char and i18n

Lists: pgsql-hackerspgsql-patches
From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Subject: to_char and i18n
Date: 2005-12-22 03:16:26
Message-ID: m3ek45stx1.fsf@conexa.fciencias.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Now that Oracle supports i18n dependant behavior in its to_char
formatting functions (at least for its 10g release) I was wondering if
a patch to support this in PostgreSQL will get accepted. I was hoping
to work on this now that I have some spare time.

Regards,
Manuel.


From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2005-12-22 03:49:45
Message-ID: dod7mi$1jsd$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


"Manuel Sugawara" <masm(at)fciencias(dot)unam(dot)mx> wrote
> Now that Oracle supports i18n dependant behavior in its to_char
> formatting functions (at least for its 10g release) I was wondering if
> a patch to support this in PostgreSQL will get accepted. I was hoping
> to work on this now that I have some spare time.
>

Can you give a small introduction of i18n and what's your plan in
PostgreSQL?

Regards,
Qingqing


From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2005-12-22 04:10:43
Message-ID: m33bklsrek.fsf@conexa.fciencias.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

"Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu> writes:

> Can you give a small introduction of i18n and what's your plan in
> PostgreSQL?

i18n == Internationalization (maybe I should say l10n ==
localization). This means that to_char functions might lead to
different results depending on the i18n settings. For instance,
nowadays, select to_char(now(), 'dd-mon-yy') returns 21-dec-05
regardless of the i18n settings. This should lead 21-dic-05 in the
es_MX localization. This also applies to the concurrency symbol,
thousand separator, etc.

(Some time ago I proposed an--incomplete--patch and it was rejectd by
Karel arguing that to_char functions should behave *exactly* the same
way that they do in Oracle.)

Regards,
Manuel.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
Cc: pgsql-hackers(at)postgresql(dot)org, Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Subject: Re: to_char and i18n
Date: 2005-12-22 04:17:08
Message-ID: 18819.1135225028@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx> writes:
> Now that Oracle supports i18n dependant behavior in its to_char
> formatting functions (at least for its 10g release) I was wondering if
> a patch to support this in PostgreSQL will get accepted.

I thought to_char already had i18n behavior. What exactly are you
thinking of changing?

regards, tom lane


From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Subject: Re: to_char and i18n
Date: 2005-12-22 04:20:05
Message-ID: m3y82drcei.fsf@conexa.fciencias.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> I thought to_char already had i18n behavior. What exactly are you
> thinking of changing?

The modifiers that are suitable to localize. Month and day names comes
to mind and maybe others, I'm not sure what the state of the code is,
but I can say that, at least, the 'month' and 'day' modifiers does not
behave in a localized way.

Regards,
Manuel.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
Cc: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2005-12-22 04:28:18
Message-ID: 18904.1135225698@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx> writes:
> (Some time ago I proposed an--incomplete--patch and it was rejectd by
> Karel arguing that to_char functions should behave *exactly* the same
> way that they do in Oracle.)

That is the accepted plan for to_char ... of course, if Oracle changes
to_char every so often, it'll get more interesting to decide what to do.

regards, tom lane


From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2005-12-22 04:37:52
Message-ID: dodah1$o39$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


"Manuel Sugawara" <masm(at)fciencias(dot)unam(dot)mx> wrote
>
> i18n == Internationalization (maybe I should say l10n ==
> localization).

Good hint, I got it :-) Just like a crossword puzzle. 18 means there are 18
characters between 'i' and 'n' ...

Regards,
Qingqing


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2005-12-22 04:38:53
Message-ID: 200512220438.jBM4cru24839@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Qingqing Zhou wrote:
>
> "Manuel Sugawara" <masm(at)fciencias(dot)unam(dot)mx> wrote
> >
> > i18n == Internationalization (maybe I should say l10n ==
> > localization).
>
> Good hint, I got it :-) Just like a crossword puzzle. 18 means there are 18
> characters between 'i' and 'n' ...

Huh? I don't understand.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
Cc: pgsql-hackers(at)postgresql(dot)org, Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Subject: Re: to_char and i18n
Date: 2005-12-22 04:50:14
Message-ID: 19091.1135227014@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>> I thought to_char already had i18n behavior. What exactly are you
>> thinking of changing?

> The modifiers that are suitable to localize. Month and day names comes
> to mind and maybe others, I'm not sure what the state of the code is,
> but I can say that, at least, the 'month' and 'day' modifiers does not
> behave in a localized way.

Can we spell the names differently but keep to the same field widths?
I can see where it might cause problems to change the widths --- other
than that, no objection.

regards, tom lane


From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Subject: Re: to_char and i18n
Date: 2005-12-22 04:58:47
Message-ID: m3mzitram0.fsf@conexa.fciencias.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Can we spell the names differently but keep to the same field widths?
> I can see where it might cause problems to change the widths --- other
> than that, no objection.

Quite impossible. But if someone is relaying in the current behavior
of to_char she might set lc_time accordingly as this parameter is not
used in the code, AFAIK

Regards,
Manuel.


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2005-12-22 05:10:00
Message-ID: Pine.LNX.4.58.0512221549190.10835@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Wed, 21 Dec 2005, Tom Lane wrote:

> Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx> writes:
> > (Some time ago I proposed an--incomplete--patch and it was rejectd by
> > Karel arguing that to_char functions should behave *exactly* the same
> > way that they do in Oracle.)
>
> That is the accepted plan for to_char ... of course, if Oracle changes
> to_char every so often, it'll get more interesting to decide what to do.

There's some functionality in 10g which PostgreSQL does not have:

TZD - returns the short timezone string with daylight saving information,
eg: PDT

TZM - timezone offset minutes part

TZH - timezone offset hours part

TZR - timezone region (US/Pacific, for example)

RR/RRRR - accept 'rounded' years, eg 99-1-1 = 1999-1-1 (kind of pointless)

FF - specify how many digits to the right of the decimal place to display,
when looking at factions of seconds. Eg: HH:MM:SS.FF3 would produce
15:56:22.123

X - the local radix character. Eg: HH:MM:SSXFF would produce 15:56:22.123

E - Era name (like, Japanese Imperial) (kind of pointless)
EE - Full era name

DS - Locale formatted short date. For example, DD/MM/YYYY for the Brits,
MM/DD/YYYY for the Yanks

DL - Locale formatted long date. Eg: fmDay, dd. Month yyyy in Germany

SCC - Like 'CC', but will carry a - (minus) for BC dates (I'm not sure if
this implies that Oracle wants BC dates to be marked 'BC'. I don't have
an Oracle system around at the moment to check though :-()

TS - Locale formatted short time.

YEAR - Year in words

SYEAR - Year in words, prefixed by minus sign for BC dates

SYYYY - YYYY, prefixed by minus sign for BC dates

Gavin


From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2005-12-22 05:50:06
Message-ID: m3oe394r5d.fsf@conexa.fciencias.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:

> There's some functionality in 10g which PostgreSQL does not have:

Good to know. I'm not an Oracle expert, actually I knew this reading
an article in a past issue of the Oracle's magazine about i18n;
essentially they were talking about how easy was for an Oracle
database to get i18n as each parameter in the to_char functions will
behave accordingly to the i18n settings.

Regards,
Manuel.


From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2005-12-22 08:27:47
Message-ID: 1135240067.8425.30.camel@petra
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Wed, 2005-12-21 at 23:50 -0500, Tom Lane wrote:
> Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx> writes:
> > Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> >> I thought to_char already had i18n behavior. What exactly are you
> >> thinking of changing?
>
> > The modifiers that are suitable to localize. Month and day names comes
> > to mind and maybe others, I'm not sure what the state of the code is,
> > but I can say that, at least, the 'month' and 'day' modifiers does not
> > behave in a localized way.

The names for months and days are hardcoded to to_char code and it's in
English only.

> Can we spell the names differently but keep to the same field widths?

That's important point. How resolve this problem Oracle? Maybe we can
say (in docs) that with non-English locales it works with days/months
names as in FM (fill) mode.

# select length( to_char(now(), 'Day') ) as Normal,
length( to_char(now(), 'FMDay') ) as FM;
normal | fm
--------+----
9 | 8

It means 'FM' uses variable size of Day/Month field -- without FM is the
size fixed to 9 chars.

I think that for backward compatibility the locale sensitive to_char()
should be implemented as separate call "to_char(datetime, format,
locale)" or we should add new modifiers to the current to_char,
something like "to_char(datetime, "LCMonth") or both.

I don't have any time to work on to_char(), I can help to review patches
only.

Karel

--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>


From: Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br>
To: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2005-12-22 13:59:35
Message-ID: 20051222135935.505.qmail@web32711.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

--- Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> escreveu:

I have a patch like this. But this was for 7.4.x. I have to take a look
at it.

> That's important point. How resolve this problem Oracle? Maybe we can
> say (in docs) that with non-English locales it works with days/months
> names as in FM (fill) mode.
>
Yeah. We could make the new mode (TM?) ignores the FX mode and write a
note in docs.

> I think that for backward compatibility the locale sensitive
> to_char()
> should be implemented as separate call "to_char(datetime, format,
> locale)" or we should add new modifiers to the current to_char,
> something like "to_char(datetime, "LCMonth") or both.
>
I vote for another modifier (TM?). That's more flexible than another
function overload because to_char() implements modifiers yet.

> I don't have any time to work on to_char(), I can help to review
> patches
> only.
>
OK. I'll send a revised patch ASAP.

Euler Taveira de Oliveira
euler[at]yahoo_com_br



_______________________________________________________
Yahoo! doce lar. Faça do Yahoo! sua homepage.
http://br.yahoo.com/homepageset.html


From: Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br>
To: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] to_char and i18n
Date: 2005-12-25 20:56:03
Message-ID: 20051225205603.54434.qmail@web32702.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

--- Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br> escreveu:

> I have a patch like this. But this was for 7.4.x. I have to take a
> look
> at it.
>
The patch is attached. It implements day and month i18n. I fixed a few
misspelling comments. Docs is attached too.

template1=# select to_char(now(), 'Day, DD Month YYYY');
to_char
------------------------------
Sunday , 25 December 2005
(1 registro)

template1=# select to_char(now(), 'TMDay, DD TMMonth YYYY');
to_char
---------------------------
Domingo, 25 Dezembro 2005
(1 registro)

template1=#

Comments?

Euler Taveira de Oliveira
euler[at]yahoo_com_br



_______________________________________________________
Yahoo! doce lar. Faça do Yahoo! sua homepage.
http://br.yahoo.com/homepageset.html

Attachment Content-Type Size
i18n-date.diff application/octet-stream 12.2 KB

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] to_char and i18n
Date: 2005-12-26 18:26:29
Message-ID: 1135621589.9937.8.camel@petra
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Sun, 2005-12-25 at 17:56 -0300, Euler Taveira de Oliveira wrote:
> --- Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br> escreveu:
>
> > I have a patch like this. But this was for 7.4.x. I have to take a
> > look
> > at it.
> >
> The patch is attached. It implements day and month i18n. I fixed a few
> misspelling comments. Docs is attached too.
>
> template1=# select to_char(now(), 'Day, DD Month YYYY');
> to_char
> ------------------------------
> Sunday , 25 December 2005
> (1 registro)
>
> template1=# select to_char(now(), 'TMDay, DD TMMonth YYYY');
> to_char
> ---------------------------
> Domingo, 25 Dezembro 2005
> (1 registro)
>
> template1=#
>
>
> Comments?

I think it looks like a good patch. There's small problem that the
current to_char() output is possible use as argument for to_timestamp()
or to_date() function. It means you should implement vice-versa
conversion from string with TMMonth/TMDay to timestamp.

to_timestamp('Domingo, 25 Dezembro 2005', 'TMDay, DD TMMonth YYYY')

Or.. at least describe in the docs that this way is unsupported
for 'TM' prefix.

Karel

--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br>
Cc: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2005-12-29 17:15:23
Message-ID: 200512291715.jBTHFNb08012@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------

Euler Taveira de Oliveira wrote:
> --- Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br> escreveu:
>
> > I have a patch like this. But this was for 7.4.x. I have to take a
> > look
> > at it.
> >
> The patch is attached. It implements day and month i18n. I fixed a few
> misspelling comments. Docs is attached too.
>
> template1=# select to_char(now(), 'Day, DD Month YYYY');
> to_char
> ------------------------------
> Sunday , 25 December 2005
> (1 registro)
>
> template1=# select to_char(now(), 'TMDay, DD TMMonth YYYY');
> to_char
> ---------------------------
> Domingo, 25 Dezembro 2005
> (1 registro)
>
> template1=#
>
>
> Comments?
>
> Euler Taveira de Oliveira
> euler[at]yahoo_com_br
>
>
>
>
>
>
>
>
> _______________________________________________________
> Yahoo! doce lar. Fa?a do Yahoo! sua homepage.
> http://br.yahoo.com/homepageset.html

Content-Description: 1242239392-i18n-date.diff

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br>
Cc: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2006-02-12 04:44:53
Message-ID: 200602120444.k1C4irO03976@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Patch applied. Thanks.

---------------------------------------------------------------------------

Euler Taveira de Oliveira wrote:
> --- Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br> escreveu:
>
> > I have a patch like this. But this was for 7.4.x. I have to take a
> > look
> > at it.
> >
> The patch is attached. It implements day and month i18n. I fixed a few
> misspelling comments. Docs is attached too.
>
> template1=# select to_char(now(), 'Day, DD Month YYYY');
> to_char
> ------------------------------
> Sunday , 25 December 2005
> (1 registro)
>
> template1=# select to_char(now(), 'TMDay, DD TMMonth YYYY');
> to_char
> ---------------------------
> Domingo, 25 Dezembro 2005
> (1 registro)
>
> template1=#
>
>
> Comments?
>
> Euler Taveira de Oliveira
> euler[at]yahoo_com_br
>
>
>
>
>
>
>
>
> _______________________________________________________
> Yahoo! doce lar. Fa?a do Yahoo! sua homepage.
> http://br.yahoo.com/homepageset.html

Content-Description: 1242239392-i18n-date.diff

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Cc: Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCHES] to_char and i18n
Date: 2006-03-03 02:18:40
Message-ID: 200603030218.k232Ie224811@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Added to TODO:

* Allow to_date() and to_timestamp() accept localized month names

Comment added to the C code to show where it has to happen.

---------------------------------------------------------------------------

Karel Zak wrote:
> On Sun, 2005-12-25 at 17:56 -0300, Euler Taveira de Oliveira wrote:
> > --- Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br> escreveu:
> >
> > > I have a patch like this. But this was for 7.4.x. I have to take a
> > > look
> > > at it.
> > >
> > The patch is attached. It implements day and month i18n. I fixed a few
> > misspelling comments. Docs is attached too.
> >
> > template1=# select to_char(now(), 'Day, DD Month YYYY');
> > to_char
> > ------------------------------
> > Sunday , 25 December 2005
> > (1 registro)
> >
> > template1=# select to_char(now(), 'TMDay, DD TMMonth YYYY');
> > to_char
> > ---------------------------
> > Domingo, 25 Dezembro 2005
> > (1 registro)
> >
> > template1=#
> >
> >
> > Comments?
>
> I think it looks like a good patch. There's small problem that the
> current to_char() output is possible use as argument for to_timestamp()
> or to_date() function. It means you should implement vice-versa
> conversion from string with TMMonth/TMDay to timestamp.
>
> to_timestamp('Domingo, 25 Dezembro 2005', 'TMDay, DD TMMonth YYYY')
>
> Or.. at least describe in the docs that this way is unsupported
> for 'TM' prefix.
>
> Karel
>
> --
> Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

--
Bruce Momjian http://candle.pha.pa.us
SRA OSS, Inc. http://www.sraoss.com

+ If your life is a hard drive, Christ can be your backup. +


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2006-03-03 02:39:59
Message-ID: 200603030239.k232dxb28306@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Added to TODO:

* Add missing parameter handling in to_char()

http://archives.postgresql.org/pgsql-hackers/2005-12/msg00948.php

I added a URL in TODO because it is a single message of detail I need to
reference.

---------------------------------------------------------------------------

Gavin Sherry wrote:
> On Wed, 21 Dec 2005, Tom Lane wrote:
>
> > Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx> writes:
> > > (Some time ago I proposed an--incomplete--patch and it was rejectd by
> > > Karel arguing that to_char functions should behave *exactly* the same
> > > way that they do in Oracle.)
> >
> > That is the accepted plan for to_char ... of course, if Oracle changes
> > to_char every so often, it'll get more interesting to decide what to do.
>
> There's some functionality in 10g which PostgreSQL does not have:
>
> TZD - returns the short timezone string with daylight saving information,
> eg: PDT
>
> TZM - timezone offset minutes part
>
> TZH - timezone offset hours part
>
> TZR - timezone region (US/Pacific, for example)
>
> RR/RRRR - accept 'rounded' years, eg 99-1-1 = 1999-1-1 (kind of pointless)
>
> FF - specify how many digits to the right of the decimal place to display,
> when looking at factions of seconds. Eg: HH:MM:SS.FF3 would produce
> 15:56:22.123
>
> X - the local radix character. Eg: HH:MM:SSXFF would produce 15:56:22.123
>
> E - Era name (like, Japanese Imperial) (kind of pointless)
> EE - Full era name
>
> DS - Locale formatted short date. For example, DD/MM/YYYY for the Brits,
> MM/DD/YYYY for the Yanks
>
> DL - Locale formatted long date. Eg: fmDay, dd. Month yyyy in Germany
>
> SCC - Like 'CC', but will carry a - (minus) for BC dates (I'm not sure if
> this implies that Oracle wants BC dates to be marked 'BC'. I don't have
> an Oracle system around at the moment to check though :-()
>
> TS - Locale formatted short time.
>
> YEAR - Year in words
>
> SYEAR - Year in words, prefixed by minus sign for BC dates
>
> SYYYY - YYYY, prefixed by minus sign for BC dates
>
> Gavin
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

--
Bruce Momjian http://candle.pha.pa.us
SRA OSS, Inc. http://www.sraoss.com

+ If your life is a hard drive, Christ can be your backup. +


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2006-03-03 06:32:38
Message-ID: Pine.LNX.4.58.0603031707040.29293@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

> Gavin Sherry wrote:
> > On Wed, 21 Dec 2005, Tom Lane wrote:
> >
> > > Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx> writes:
> > > > (Some time ago I proposed an--incomplete--patch and it was rejectd by
> > > > Karel arguing that to_char functions should behave *exactly* the same
> > > > way that they do in Oracle.)
> > >
> > > That is the accepted plan for to_char ... of course, if Oracle changes
> > > to_char every so often, it'll get more interesting to decide what to do.
> >
> > There's some functionality in 10g which PostgreSQL does not have:
> >
> > TZD - returns the short timezone string with daylight saving information,
> > eg: PDT

This is the same as TZ and it is easy to implement.

> >
> > TZM - timezone offset minutes part

Trivial

> >
> > TZH - timezone offset hours part

Trivial

> >
> > TZR - timezone region (US/Pacific, for example)

We don't currently have an offset -> region name lookup table but it
should be easy enough to implement...

> >
> > RR/RRRR - accept 'rounded' years, eg 99-1-1 = 1999-1-1 (kind of pointless)
> >
> > FF - specify how many digits to the right of the decimal place to display,
> > when looking at factions of seconds. Eg: HH:MM:SS.FF3 would produce
> > 15:56:22.123

Trivial

> >
> > X - the local radix character. Eg: HH:MM:SSXFF would produce 15:56:22.123
> >

I don't know how to get this character... is it included in the locale
data some where (and where, specifically)

> > E - Era name (like, Japanese Imperial) (kind of pointless)
> > EE - Full era name

No idea where to get this data.

> >
> > DS - Locale formatted short date. For example, DD/MM/YYYY for the Brits,
> > MM/DD/YYYY for the Yanks

Is this desirable? It may lead to confusion with datestyle.

> >
> > DL - Locale formatted long date. Eg: fmDay, dd. Month yyyy in Germany

Should be straight forward - if the underlying library will honour locale.

> >
> > SCC - Like 'CC', but will carry a - (minus) for BC dates (I'm not sure if
> > this implies that Oracle wants BC dates to be marked 'BC'. I don't have
> > an Oracle system around at the moment to check though :-()

Thoughts?

> >
> > TS - Locale formatted short time.

Should be straight forward - if the underlying library will honour locale.

> >
> > YEAR - Year in words

Hmmm. This would be hard to do if we want to support local language
settings.

> >
> > SYEAR - Year in words, prefixed by minus sign for BC dates

As above.

> >
> > SYYYY - YYYY, prefixed by minus sign for BC dates

Should be straight forward.

Any comments on the above?

Gavin


From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2006-03-03 06:44:21
Message-ID: 4407E5C5.8000302@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

>>> E - Era name (like, Japanese Imperial) (kind of pointless)
>>> EE - Full era name

Some stuff here:

http://java.sun.com/javase/6/docs/guide/intl/calendar.doc.html