Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Make rust_decimal and bigdecimal decoding more lenient
fixes readysettech/readyset#143 When using readyset as a caching proxy - readyset returns a decimal with the following type info `MySqlTypeInfo { type: Decimal, flags: ColumnFlags(0x0), char_set: 33, max_size: Some(1024) }` Currently rust_decimal and bigdecimal expect an exact match for the type info `MySqlTypeInfo { type: NewDecimal, flags: ColumnFlags(BINARY), char_set: 63, max_size: None }` Therefore the following error occurs when readyset sends a valid decimal type ``` error occurred while decoding column "price": mismatched types; Rust type `core::option::Option<rust_decimal::decimal::Decimal>` (as SQL type `DECIMAL`) is not compatible with SQL type `DECIMAL` ``` This patch makes the `Type<MySql> for Decimal` more lenient by matching `MySqlTypeInfo` that has ColumType::Decimal | ColumnType::NewDecimal to be parsed by both rust_decimal and bigdecimal types
- Loading branch information