Closed xiangjinwu closed 5 months ago
Get binary encoding from PostgreSQL:
test=# select numeric_send(1e28); numeric_send ------------------------ \x00010007000000000001 (1 row) test=# select numeric_send(1e29); numeric_send ------------------------ \x0001000700000000000a (1 row)
Call FromSql on Decimal:
FromSql
Decimal
println!( "{:?}", Decimal::from_sql( &Type::NUMERIC, &[0x00, 0x01, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01] ) ); println!( "{:?}", Decimal::from_sql( &Type::NUMERIC, &[0x00, 0x01, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a] ) );
Expected:
Ok(100000000000000000000) Err(overflow error)
Actual:
Ok(100000000000000000000) thread 'main' panicked at rust_decimal-1.34.3/src/arithmetic_impls.rs:232:18: Multiplication overflowed
Thank you for raising this! It is fortunately an easy issue to fix - I'll see if I can get something out shortly.
Get binary encoding from PostgreSQL:
Call
FromSql
onDecimal
:Expected:
Actual: