Re: to_char and i18n

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
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2006-03-03 06:44:21 Re: to_char and i18n
Previous Message Oleg Bartunov 2006-03-03 06:07:06 Re: PostgreSQL Anniversary Summit, Call for Contributions

Browse pgsql-patches by date

  From Date Subject
Next Message Christopher Kings-Lynne 2006-03-03 06:44:21 Re: to_char and i18n
Previous Message Bruce Momjian 2006-03-03 04:08:45 Re: [PATCHES] Inherited Constraints