I have noticed that a mapping of pg REAL to rusts f32 does not seem to work and fails with the following error message:
Conversion(WrongType { postgres: Float8, rust: "f32" })'
According to the documentation postgres Float8 is postgres REAL which will map to rust f32. I have the following struct:
#[derive(Deserialize, PostgresMapper, Serialize)]
#[pg_mapper(table = "data")]
pub struct YearlyAverageTemperature {
pub temperature: f32,
Query does contain one row only using client.query_one()
let result = client
.query_one(&stmt, &[])
.await?;
let temp = YearlyAverageTemperature::from_row_ref(&result).unwrap();
When changing the element in the struct to a f64 the conversion works without problems.