to_number

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

to_number

От:
Kaare Rasmussen <kar@kakidata.dk>
Дата:
# SELECT * FROM pg_settings WHERE name LIKE 'lc_%';   name     | setting
-------------+---------lc_messages | unsetlc_monetary | Clc_numeric  | Clc_time     | C
(4 rows

SELECT price, to_number(price,'9999D9)') FROM orderline WHERE sku = 
'01-0082-4';price | to_number
-------+-----------429,5 |      4295429,5 |      4295429,5 |      4295429,5 |      4295429,5 |      4295429,5 |      4295429,5 |      4295429,5 |      4295429,5 |      4295429,5 |      4295
(10 rows)

How can to_number work with Danish locale?

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Email: kar@kakidata.dk
2000 Frederiksberg        Lørdag 12.00-16.00       Web:      www.suse.dk


Re: to_number

От:
"Tomasz Myrta" <jasiek@klaster.net>
Дата:
> # SELECT * FROM pg_settings WHERE name LIKE 'lc_%';
>     name     | setting
> -------------+---------
>  lc_messages | unset
>  lc_monetary | C
>  lc_numeric  | C
>  lc_time     | C
> (4 rows
> 
> SELECT price, to_number(price,'9999D9)') FROM orderline WHERE sku = 
> '01-0082-4';
>  price | to_number
> -------+-----------
>  429,5 |      4295
>  429,5 |      4295
>  429,5 |      4295
>  429,5 |      4295
>  429,5 |      4295
>  429,5 |      4295
>  429,5 |      4295
>  429,5 |      4295
>  429,5 |      4295
>  429,5 |      4295
> (10 rows)
> 
> How can to_number work with Danish locale?

It looks like you have "C" locale instead of Danish one. What happens when 
you change your system locale to Danish?.

Regards,
Tomasz Myrta


Re: to_number

От:
Kaare Rasmussen <kar@kakidata.dk>
Дата:
> > How can to_number work with Danish locale?
> It looks like you have "C" locale instead of Danish one. What happens when
> you change your system locale to Danish?.

Seems to use the settings in postgresql.conf, NOT pg_settings. I don't know 
what they are used for.

So it seems that PostgreSQL can handle one and only one locale setting per 
installation. Hmmm.

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Email: kar@kakidata.dk
2000 Frederiksberg        Lørdag 12.00-16.00       Web:      www.suse.dk


Re: to_number

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Kaare Rasmussen  writes:
> So it seems that PostgreSQL can handle one and only one locale setting per 
> installation. Hmmm.

Not so, at least not for the secondary locale settings.  Did you trySET lc_monetary TO 'dk';
(or whatever the correct name of the locale is on your platform).
		regards, tom lane


Re: to_number

От:
Kaare Rasmussen <kar@kakidata.dk>
Дата:
> Not so, at least not for the secondary locale settings.  Did you try
> 	SET lc_monetary TO 'dk';
> (or whatever the correct name of the locale is on your platform).

Yes, I tried to set it to da_DK. But it only worked when I changed it in 
postgresql.conf.

Not a problem for me right now. But it is a limitation that seems unncessary.

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Email: kar@kakidata.dk
2000 Frederiksberg        Lørdag 12.00-16.00       Web:      www.suse.dk


FAQ