TODO item:Allow to_date() and to_timestamp() accept localized month names - Mailing list pgsql-hackers

From Gevik Babakhani
Subject TODO item:Allow to_date() and to_timestamp() accept localized month names
Date
Msg-id 010401c86788$6f1ddb60$0a01a8c0@gevmus
Whole thread Raw
Responses Re: TODO item:Allow to_date() and to_timestamp() accept localized month names
List 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
------------------------------------------------



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: FW: bitemporal functionality for PostgreSQL
Next
From: Tom Lane
Date:
Subject: Re: TODO item:Allow to_date() and to_timestamp() accept localized month names