postgresql 10's numeric data type maps to xxx in c# golang rust drivers??

Поиск
Список
Период
Сортировка
От john snow
Тема postgresql 10's numeric data type maps to xxx in c# golang rust drivers??
Дата
Msg-id CAE67tvWVoF0Mo9cK4S4QcoxFTEr7ViBWTgS6OVo7kqqMC73gmg@mail.gmail.com
обсуждение исходный текст
Список pgsql-hackers
we're using postgresql 10 in a windows environment.

in a c# dotnet environment we're using Npgsql as the driver, and the numeric type
maps to a c# decimal (128bit) type, which is what we want because we are using numeric to represent currency (usd$ and other foreign currency types) / money data.

we're also planning to use google's go and mozilla's rust for some applications.

our questions:

(1) unlike Npgsql documentation, which explicitly calls out the mapping of numeric to decimal (see http://www.npgsql.org/doc/types/basic.html), the documentation for the go drivers (https://github.com/jackc/pgxhttps://godoc.org/github.com/lib/pq) and rust driver (https://github.com/sfackler/rust-postgres) we've looked at don't explicitly call out such a mapping. is it correct to assume that numeric maps to float64 in go and rust?

(2) is postgresql's numeric data type the correct one for representing money / currency values?

(3) if numeric maps to float64 in go and rust, how concerned should we be regarding (accumulative) rounding errors? should we just use bigint in postgresql and int64 in c# go and rust and accept some increase in application code complexity (e.g., converting cents to dollars and vice versa, etc)?

(4) any other suggestion?

thanks for helping!

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

Предыдущее
От: james
Дата:
Сообщение: Re: Postgres with pthread
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: [pgsql-www] escapes in submitted docs comments