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 09:20:12
Message-ID: 20011205102012.A11642@zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Tue, Dec 04, 2001 at 05:57:11PM -0600, Manuel Sugawara wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>
> > Manuel Sugawara writes:
> >
> > > Guys, attached is a patch against the 7.2b3 source tree which improves
> > > the i18n of the date formatting functions, using the nl_langinfo(3)
> > > function,

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.)

> > What's the effect of that?
>
> Currently none since I miss another part of the patch :-( -attached-,
> but if you add:
>
> setlocale(LC_TIME, "");

I mean is here more reason why not use LC_TIME and LC_NUMERIC in
current sources. A correct solution will "per-columns" locales.

_May be_ all in PostgreSQL is ready (intependent) to LC_TIME, but I
not sure with it. Thomas?

> in src/backend/main/main.c you will see month and day names printed
> according to the current locale.
>
> regress=# select to_char(now(),'fmday dd/month/yyyy');
> to_char
> --------------------------
> martes 04/diciembre/2001
> (1 row)

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:

test=# select to_char('2001-12-05 00:00:00+01'::timestamp,
'fmday dd/month/yyyy');
to_char
-----------------------------
wednesday 05/december /2001
(1 row)

test=# select to_timestamp('wednesday 05/december /2001',
'fmday dd/month/yyyy');
to_timestamp
------------------------
2001-12-05 00:00:00+01
(1 row)

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 Tom Lane 2001-12-05 11:32:45 Re: pg_regress.sh overrides PGPORT
Previous Message Laszlo Hornyak 2001-12-05 09:06:10 Re: java stored procedures

Browse pgsql-patches by date

  From Date Subject
Next Message Manuel Sugawara 2001-12-05 16:15:37 Re: date formatting and tab-complete patch
Previous Message Tatsuo Ishii 2001-12-05 00:57:30 Re: Undocumented feature costs a lot of performance in