Обсуждение: What is the effect of locale on numbers?

Поиск
Список
Период
Сортировка

What is the effect of locale on numbers?

От
A B
Дата:
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

Re: What is the effect of locale on numbers?

От
Tom Lane
Дата:
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