lc_time not working?

Started by J. Hondiusover 13 years ago5 messagesgeneral
Jump to latest
#1J. Hondius
jhondius@rem.nl

Hi All,
please advise

I'm not getting my PostgreSQL 9.2 to return the correct lc_time
See psql output below.
lc_monetary and the lc's do work correctly

postgresql.conf is set to lc_time = 'nl_NL'
the output of locale -a includes nl_NL

[root@d01 ~]# psql db user
psql (9.2.1)
Type "help" for help.

openwave001=# select set_config('lc_time', 'nl_NL', true);
set_config
------------
nl_NL
(1 row)

openwave001=# select to_char(now(),'dd month day yyyy');
to_char
-----------------------------
07 january monday 2013
(1 row)

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: J. Hondius (#1)
Re: lc_time not working?

On 01/07/2013 06:45 AM, J. Hondius wrote:

Hi All,
please advise

I'm not getting my PostgreSQL 9.2 to return the correct lc_time
See psql output below.
lc_monetary and the lc's do work correctly

postgresql.conf is set to lc_time = 'nl_NL'
the output of locale -a includes nl_NL

[root@d01 ~]# psql db user
psql (9.2.1)
Type "help" for help.

openwave001=# select set_config('lc_time', 'nl_NL', true);
set_config
------------
nl_NL
(1 row)

When you use true it only applies for that transaction.

Example:

test=# select set_config('lc_time', 'nl_NL', True);
set_config
------------
nl_NL
(1 row)

test=# SELECT current_setting('lc_time');
current_setting
-----------------
en_US.UTF-8
(1 row)

When you false it sticks for the session:

test=# select set_config('lc_time', 'nl_NL', False);
set_config
------------
nl_NL
(1 row)

test=# SELECT current_setting('lc_time');
current_setting
-----------------
nl_NL

openwave001=# select to_char(now(),'dd month day yyyy');
to_char
-----------------------------
07 january monday 2013
(1 row)

--
Adrian Klaver
adrian.klaver@gmail.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Adrian Klaver (#2)
Re: lc_time not working?

Adrian Klaver <adrian.klaver@gmail.com> writes:

On 01/07/2013 06:45 AM, J. Hondius wrote:

I'm not getting my PostgreSQL 9.2 to return the correct lc_time

openwave001=# select set_config('lc_time', 'nl_NL', true);

When you use true it only applies for that transaction.

But he has the same setting in postgresql.conf anyway. I think the real
mistake is here:

openwave001=# select to_char(now(),'dd month day yyyy');

To get localized month/day names you need to add the TM prefix to the
field, ie this should be

select to_char(now(),'dd tmmonth tmday yyyy');

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Tom Lane (#3)
Re: lc_time not working?

On 01/07/2013 07:56 AM, Tom Lane wrote:

Adrian Klaver <adrian.klaver@gmail.com> writes:

On 01/07/2013 06:45 AM, J. Hondius wrote:

I'm not getting my PostgreSQL 9.2 to return the correct lc_time

openwave001=# select set_config('lc_time', 'nl_NL', true);

When you use true it only applies for that transaction.

But he has the same setting in postgresql.conf anyway. I think the real
mistake is here:

openwave001=# select to_char(now(),'dd month day yyyy');

To get localized month/day names you need to add the TM prefix to the
field, ie this should be

select to_char(now(),'dd tmmonth tmday yyyy');

Aargh, missed that.

regards, tom lane

--
Adrian Klaver
adrian.klaver@gmail.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5J. Hondius
jhondius@rem.nl
In reply to: Adrian Klaver (#4)
Re: lc_time not working? Solved.

Thanks very much Tom and Adrian.
Solved. I will RTFM better next time.

Thanks again, Joek

Adrian Klaver schreef:

On 01/07/2013 07:56 AM, Tom Lane wrote:

Adrian Klaver <adrian.klaver@gmail.com> writes:

On 01/07/2013 06:45 AM, J. Hondius wrote:

I'm not getting my PostgreSQL 9.2 to return the correct lc_time

openwave001=# select set_config('lc_time', 'nl_NL', true);

When you use true it only applies for that transaction.

But he has the same setting in postgresql.conf anyway. I think the real
mistake is here:

openwave001=# select to_char(now(),'dd month day yyyy');

To get localized month/day names you need to add the TM prefix to the
field, ie this should be

select to_char(now(),'dd tmmonth tmday yyyy');

Aargh, missed that.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general