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-09 01:41:01
Message-ID: m3bsh9p3v6.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:

[...]
> and this output must be independent on locales setting. It's
> important, because a lot of application depend of current output
> format. If someone wants use locale depend output must be possible
> set it by some format suffix, for example:
>
> to_char(now(), 'LCMonth')

I was thinking it and I do not like much the idea to add a new
prefix. I would like more a new set of functions:

* lto_char (date, format [,locale])
* lto_date (date,format [,locale])
* lto_timestamp (timestamp,format [,locale])

Also if we are filling with spaces in the present code we would have
to also do it with the locale aware code. Seems to me that this is a
better way to keep backwards compatibility, so

lto_char('1974/10/22'::date,'dd/month/yyyy','es_MX')

would lead to '22/octubre /1974', filled to 10, since 'septiembre'
which has 10 chars is the longest month name in the 'es' localization,
so people can still use 'FM' if they want '22/octubre/1974'. Another
issue is that capilalization is also locale depenent, as instance in
spanish we don't capitalize month names, but my crystal ball sees
people complaining because 'Month' doesn't capitalize, so in any case
we need something like a prefix to indicate that we do not want it in
capital letters, nor in small letters, but in the form that the
localization in course prefers, maybe something like 'lmonth'.

Comments?

Regards,
Manuel.

PS. By the way, reviewing the code I found a bug that causes the
following test:

to_date(to_char('1979/22/10'::date,'dd/fmrm/yyyy'),'dd/fmrm/yyyy') = '1979/22/10'::date;

give an error instead of a true value. Attached is the patch to fix it
against the 7.2b3 tree.

Attachment Content-Type Size
formatting.patch text/x-patch 1.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message pgsql-bugs 2001-12-09 10:54:26 Bug #533: BLOB (lo type) objects could not be restored
Previous Message Michael Meskes 2001-12-08 20:42:24 Bug in ecpg that has to be fixed prior 7.2

Browse pgsql-patches by date

  From Date Subject
Next Message Serguei Mokhov 2001-12-09 08:59:42 NLS (Russian) - postgres updates
Previous Message Serguei Mokhov 2001-12-08 19:09:16 NLS (Russian) - pg_dump update