问题
I'm on a project that involves a database that uses Danish numeric settings (the decimal separator is a comma). I'm trying to figure out how I can store values in the database as decimal/number/anything but text, but have them keep the comma separator. I've updated the lc_numeric setting in the AWS Parameter group to da_DK, which I found online to be the Danish locale setting, but values are still showing with the period instead of the decimal. What changes need to be made/is this possible?
For instance:
CREATE TABLE test (
num NUMERIC
); // I've also tried Decimal instead of numeric
INSERT INTO test ('1,3') // error
INSERT INTO test ('1.3') // returns 1.3 when selected.
SHOW lc_numeric // returns da_DK as expected.
SELECT * FROM test; // 1.3
What am I doing wrong?
Note: this is a postgres instance via AWS RDS, any changes need to be made via the Parameter Group menu and not via the command line.
回答1:
lc_numeric
does not influence the string input and output format of numeric types, so it also does not influence the result of type casts.
It only influences the conversion functions to_char
and to_number
. With regard to the decimal separator, lc_numeric
determines the meaning of the D
format specifier.
来源:https://stackoverflow.com/questions/41753640/postgres-lc-numeric-not-working-as-expected