Closed uuhan closed 6 months ago
That sounds like an issue in PostgreSQL, not this library.
That sounds like an issue in PostgreSQL, not this library.
@sfackler
Can this conversion serde_json::Value <-> f64 <-> Postgres float8 be handled correctly?
I find https://github.com/sfackler/rust-postgres/blob/bbc04145de7a83dfa66cb3cf4a68878da2c1cc32/postgres-types/src/lib.rs#L738 and https://github.com/sfackler/rust-postgres/blob/bbc04145de7a83dfa66cb3cf4a68878da2c1cc32/postgres-types/src/lib.rs#L1167
cannot convert between the Rust type
serde_json::value::Value
and the Postgres typefloat8
Is this above error excepted?
Oh, this issue may actually be that Value is trying to deserialize the number as an integer rather than a float since Postgres isn't encoding it with a decimal point.
Using a strongly typed struct rather than Value
would probably (?) fix that.
I have a structure contains the value f64::MAX, like
It can be written into postgres as a jsonb:
But I can not read it back!
I tried to just read the f64::MAX field:
Seems the field is read as a (integer) number ?
If I read this field as float8, this conversion can not be done right
But the following conversion can be done right:
version info: