Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Money handler doesn't respect the server currency format #2586
When I ran the test suite in lc_monetary = 'Japanise_Japan.932', following errors occured.
I examine this issue.
MoneyHandler in Npgsql has
So when using lc_monetary whose number of digits after the decimal point is not equal to two, MoneyHandler returns incorrect number.
Thanks @GIriver! This is the first time that I see that a locale setting influences binary wire encoding in PostgreSQL...
Do you know if there's any way of knowing the scale from the locale value in lc_monetary? Or is the only option here to set up a table on our side?
Sorry, I still don't come up with idea to solve this issue.
PostgreSQL gets the number of digits after the decimal point by using setlocale(), localeconv() and lconv->frac_digits(include locale.h). (ref https://doxygen.postgresql.org/cash_8c.html#a99c28c4652e488c10c3541962246d12f)
However, I don't know the way Npgsql gets PostgreSQL's money scale.
As you said, sending a money to PostgreSQL and recieving the money from PostgreSQL is the way to know money scale...