How does the locale setting LC_NUMERIC work in PostgreSQL?

前端 未结 1 1914
孤城傲影
孤城傲影 2020-12-11 07:27

Could anybody give an insight on the locale and numeric types behaviour in PostgreSQL? We work with Italian locale. That is comma separation for decimal part. Setting in

相关标签:
1条回答
  • 2020-12-11 08:12

    I quote the manual:

    lc_numeric (string)

    Sets the locale to use for formatting numbers, for example with the to_char family of functions.

    Concerns these type formatting functions. You should be able to reproduce the following demo:

    SHOW lc_numeric;
    

    de_AT.UTF-8

    SELECT to_number('13,4','999D99')
    

    13.4

    SELECT to_char(13.4,'FM999D99')
    

    13,4

    SET lc_numeric = 'C';
    SELECT to_number('13,4','999D99')
    

    134

    SELECT to_char(13.4,'FM999D99')
    

    13.4

    RESET lc_numeric;
    

    Template patterns in the manual.

    The format of numbers in SQL expressions does not change with locale settings. That would be madness.


    On a different note: you are aware that you have to (at least) reload the server after changing postgresql.conf.

    pg_ctl reload
    
    0 讨论(0)
提交回复
热议问题