Protryon / klickhouse

Rust crate for accessing Clickhouse
Apache License 2.0
92 stars 21 forks source link

insert using scale too high corrupts native data #47

Open tomlinton opened 7 months ago

tomlinton commented 7 months ago

E.g. modifying https://github.com/Protryon/klickhouse/blob/d611b1772652a73fb2ff76142d45a1202a4cdaae/klickhouse/tests/test_decimal.rs#L21 to have a scale greater than 5 results in the following failure:

thread 'test_decimal::test_client' panicked at klickhouse/tests/test_decimal.rs:37:5:
assertion `left == right` failed
  left: TestType { d_d128: 0.012345 }
 right: TestType { d_d128: 0.00000 }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This should be validated instead of inserting bad data.