Dealing with multiple currencies with the money type?

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

Dealing with multiple currencies with the money type?

От:
Simon Connah <simon.n.connah@protonmail.com>
Дата:
Вложения:
Hi,

I've read this page:

https://www.postgresql.org/docs/13/datatype-money.html

which seems to suggest that lc_monetary dictates what currency the database uses for the money type. But what if you want to have transactions in USD, GBP and EUR from a database with en_GB.UTF8 locale?

Is this possible?

Simon.

Re: Dealing with multiple currencies with the money type?

От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Sunday, April 18, 2021, Simon Connah <simon.n.connah@protonmail.com> wrote:
Hi,

I've read this page:

https://www.postgresql.org/docs/13/datatype-money.html

which seems to suggest that lc_monetary dictates what currency the database uses for the money type. But what if you want to have transactions in USD, GBP and EUR from a database with en_GB.UTF8 locale?

Is this possible?


The money type should largely be avoided.  I find it useful for parsing external data but in the end store money using numeric.  Add a currency type field if you need to be explixit about what units the currency is in.

David J.

Re: Dealing with multiple currencies with the money type?

От:
Simon Connah <simon.n.connah@protonmail.com>
Дата:
Вложения:
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday, April 18th, 2021 at 16:21, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Sunday, April 18, 2021, Simon Connah <simon.n.connah@protonmail.com> wrote:
Hi,

I've read this page:


which seems to suggest that lc_monetary dictates what currency the database uses for the money type. But what if you want to have transactions in USD, GBP and EUR from a database with en_GB.UTF8 locale?

Is this possible?

The money type should largely be avoided.  I find it useful for parsing external data but in the end store money using numeric.  Add a currency type field if you need to be explixit about what units the currency is in.

David J.

Thank you.

OK I'll use numeric in that case.

Simon.
FAQ