Re: date formatting and tab-complete patch

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Hackers Mailing List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: date formatting and tab-complete patch
Date: 2001-12-05 16:48:04
Message-ID: 20011205174803.D14012@zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Wed, Dec 05, 2001 at 10:15:37AM -0600, Manuel Sugawara wrote:
> Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> writes:
>
> > We don't directly call locale stuff in PostgreSQL code. It's
> > encapsulated in PGLC_ (pg_locale.c) API and all is cached, for
> > this we use localeconv(3) that returns all in one struct.
> >
> > (What portability of nl_langinfo()? The localeconv() is ANSI C and
> > POSIX functions.)
>
> localenconv is posix and ANSI C but it doesn't provide such
> functionality (localized month and day names). nl_langinfo conforms to
> "The Single UNIXŽ Specification, Version 2", according to it's manual
> page. The portability isn't an issue as long as you provide means to
> test and avoid it's use in systems that doesn't provide it. I know
> that, at least, Linux and Solaris does, but FreeBSD does not.

But we want FreeBSD and others systems too....

> [...]
> > Sorry didn't see your original patch (I overlook and delete it in my
> > IMBOX:-(). But I have a question -- do you solve vice versa
> > conversion from string to timestamp? The basic feature of to_char()
> > is that all outputs must be possible parse by to_timestamp() with
> > same format definition:
>
> No, however the work seems pretty easy.
>
> > test=# select to_char('2001-12-05 00:00:00+01'::timestamp,
> > 'fmday dd/month/yyyy');
> > to_char
> > -----------------------------
> > wednesday 05/december /2001
> > (1 row)
>
> This example shows another issue. With localized month and day names
> the hardcoded paddings doesn't make sense any more since you may have
> a month name longer than 9 chars -septiembre- as instance.

Magic "9 chars" is nice and popular Oracle feature :-)

> If people is interested I may spend some time working with this.

I already thought about it. You are right it's possible implement,
but I mean not is good if some feature anticipate other matter of
project ... but current to_char(float, '9G999D99') output string
that depend on locale. Why don't allow it for
to_chat(timenstamp, ...) too?

But don't forget it must be fast, portable and locale stuff must
cached and encapsulated in pg_locale.c.

The "9 chars" can be used for English locales only.

Comments?

Karel

--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/

C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message D'Arcy J.M. Cain 2001-12-05 16:52:15 database system was interrupted at...
Previous Message Manuel Sugawara 2001-12-05 16:15:37 Re: date formatting and tab-complete patch

Browse pgsql-patches by date

  From Date Subject
Next Message Manuel Sugawara 2001-12-05 17:33:26 Re: date formatting and tab-complete patch
Previous Message Jason Tishler 2001-12-05 16:38:23 FAQ_MSWIN Patch