Mixed locales and date formatting

Поиск
Список
Период
Сортировка
От Vincent Veyron
Тема Mixed locales and date formatting
Дата
Msg-id 1384445945.3260.66.camel@asus-1001PX.home
обсуждение исходный текст
Ответы Re: Mixed locales and date formatting  (Adrian Klaver <adrian.klaver@gmail.com>)
Список pgsql-general
Hi List,

Using databases with different locales on the same cluster, I am trying
to have Postgresql display the date in the locale format of each
database.

I found the TM prefix :
http://www.postgresql.org/docs/8.4/static/functions-formatting.html#FUNCTIONS-FORMATTING-DATETIMEMOD-TABLE

However, using this will format dates according to the server's lc_time
parameter (fr_FR@euro in my case) and ignore the database's locale.

Is there a way to have the same code display 'Novembre' when connected
to the fr_FR database and 'November' when connected to the en_US one?


Here is a test case :

createdb default_locale
createdb english_locale --locale en_US.iso885915 --template=template0

output of psql -l :

default_locale | vincent      | LATIN9   | fr_FR@euro      | fr_FR@euro      |
english_locale | vincent      | LATIN9   | en_US.iso885915 | en_US.iso885915 |


psql -c "select to_char(CURRENT_DATE, 'Month')" default_locale
  to_char
-----------
 November
(1 ligne)

psql -c "select to_char(CURRENT_DATE, 'Month')" english_locale
  to_char
-----------
 November
(1 ligne)

psql -c "select to_char(CURRENT_DATE, 'TMMonth')" default_locale
 to_char
----------
 Novembre
(1 ligne)

psql -c "select to_char(CURRENT_DATE, 'TMMonth')" english_locale
 to_char
----------
 Novembre
(1 ligne)


I use a Debian server with the following locales :

locale -a :
C
en_US.iso885915
fr_FR@euro
fr_FR.iso885915@euro
POSIX




--
                                        Salutations, Vincent Veyron

http://marica.fr
Gestion des contentieux juridiques, des contrats et des sinistres d'assurance



В списке pgsql-general по дате отправления:

Предыдущее
От: Elliot
Дата:
Сообщение: Re: Equivalent syntax of PL/SQL using array in PL/pgSQL
Следующее
От: Zev Benjamin
Дата:
Сообщение: Re: Tuning 9.3 for 32 GB RAM