What is the effect of locale on numbers?

Started by A Bover 15 years ago2 messagesgeneral
Jump to latest
#1A B
gentosaker@gmail.com

Hello.

I use swedish locale

show lc_numeric;
lc_numeric
-------------
sv_SE.UTF-8

and I get a . (dot) in all floating-point numbers.

This makes me wonder, when can I see the effects of the locale? That is, I get

select 355/113.0 as pie;
pie
--------------------
3,1415929203539823 <--- notice , instead of .

instead of

3.1415929203539823

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: A B (#1)
Re: What is the effect of locale on numbers?

A B <gentosaker@gmail.com> writes:

I use swedish locale

show lc_numeric;
lc_numeric
-------------
sv_SE.UTF-8

and I get a . (dot) in all floating-point numbers.

The regular output of numbers is intentionally not locale-aware.
You can use to_char() to obtain locale-specific formats.

regards, tom lane