Open
Description
This effectively leaves superfluous zeroes in the fractional part when decoding from PgNumeric
:
// should be 3389.5
let pg_numeric = PgNumeric::Number {
sign: PgNumericSign::Positive,
digits: [3389, 5000],
weight: 0,
scale: 1,
};
assert_eq!(BigDecimal::try_from(pg_numeric).unwrap().to_string(), "3389.5");
This will currently fail because the BigDecimal
got decoded as 3389.5000
and it will print that way. This behavior is semantically correct, assuming Postgres sends only extra zeroes (thus the two values are considered equal), however it is potentially confusing.