Re: date formatting and tab-complete patch

From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
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:15:37
Message-ID: m33d2pmymu.fsf@dep4.fciencias.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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.

[...]
> 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.

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

Regards,
Manuel.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Karel Zak 2001-12-05 16:48:04 Re: date formatting and tab-complete patch
Previous Message tinar 2001-12-05 13:12:07 how to chane the type

Browse pgsql-patches by date

  From Date Subject
Next Message Jason Tishler 2001-12-05 16:38:23 FAQ_MSWIN Patch
Previous Message Karel Zak 2001-12-05 09:20:12 Re: date formatting and tab-complete patch