Re: [GENERAL] Dealing with number formats when server and client are different locales

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] Dealing with number formats when server and client are different locales
Дата
Msg-id 9388.1504701335@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [GENERAL] Dealing with number formats when server and client are differentlocales  (Rob Northcott <Rob.Northcott@compilator.com>)
Ответы Re: [GENERAL] Dealing with number formats when server and client aredifferent locales  (Rob Northcott <Rob.Northcott@compilator.com>)
Список pgsql-general
Rob Northcott <Rob.Northcott@compilator.com> writes:
> Our application was written assuming that the SQL server local settings for number formats would be the same as the
clientmachine running the application. 
> Now there is a need for some clients to run using UK format (full stop for decimal separator) and some to be European
format(comma for decimal separator). 
> This is causing problems with queries sent to the server because each client app is sending query strings in its own
localformat and the server throws an error if it doesn't match the server settings. 

Hm, Postgres doesn't support comma-for-decimal-point in very many
contexts, so I'm wondering exactly what your queries are like.
If that usage only appears in strings that are processed with
to_number() and a D format character, then maybe you can make this
work, but that seems pretty restrictive.

> Possible solutions I can think of are:

>   1.  Change the client application so it checks and server locale settings and formats numbers appropriately.
>   2.  Change the server settings to match the client (if this can be set PER SESSION?)

Sure.  See lc_numeric.

https://www.postgresql.org/docs/current/static/config-setting.html#CONFIG-SETTING-SQL-COMMAND-INTERACTION

https://www.postgresql.org/docs/current/static/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-FORMAT

            regards, tom lane


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

Предыдущее
От: Yan Pas
Дата:
Сообщение: Re: [GENERAL] Postgresql init and cleanup module functions
Следующее
От: Marcin Giedz
Дата:
Сообщение: [GENERAL] Schema/table replication