TODO item:Allow to_date() and to_timestamp() accept localized month names

From: "Gevik Babakhani" <pgdev(at)xs4all(dot)nl>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: TODO item:Allow to_date() and to_timestamp() accept localized month names
Date: 2008-02-04 23:48:25
Message-ID: 010401c86788$6f1ddb60$0a01a8c0@gevmus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I would like to start a discussion for a solution regarding this item.

At this moment these functions only accept English month/day names due
formatting.c:172:months_full[] and datetime.c:53-58 months[], days[].
The values are predetermined. (hardcoded sounds bahhh...)

What do we think about a solution that would be like:

1. Add an extra (optional) parameter to to_date and to_timestamp which would
indicate the locale we are trying to parse.
For example to_date('10 okt 2008','DD Mon YYYY','nl-NL')

2. If the third parameter exists, read the month/day names for a list of
some kind.

3. Pass the list to formatting.c:1615:seq_search to parse the string with
these localized names list.

My questions:

Is step 1 acceptable/correct to start with? If yes, what would you recommend
for step 2?

Regards,
Gevik Babakhani
------------------------------------------------
PostgreSQL NL http://www.postgresql.nl
TrueSoftware BV http://www.truesoftware.nl
------------------------------------------------

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-02-05 00:21:38 Re: TODO item:Allow to_date() and to_timestamp() accept localized month names
Previous Message Jeff Davis 2008-02-04 22:25:23 Re: FW: bitemporal functionality for PostgreSQL