hasura / pg-client-hs

A low level Haskell library to connect to postgres
Apache License 2.0
25 stars 15 forks source link

Set extra_float_digits to 3 to avoid loss of precision #17

Closed abooij closed 4 years ago

abooij commented 4 years ago

The PostgreSQL manual recommends setting this whenever we want to avoid losing precision of floats, see:

https://www.postgresql.org/docs/12/runtime-config-client.html#GUC-EXTRA-FLOAT-DIGITS https://www.postgresql.org/docs/12/datatype-numeric.html#DATATYPE-FLOAT

This will end up fixing hasura/graphql-engine#5092

tirumaraiselvan commented 4 years ago

I may be misunderstanding but it feels to me that "Applications that wanted precise values have historically had to set extra_float_digits to 3 to obtain them. For maximum compatibility between versions, they should continue to do so." refers to applications that had set extra_float_digits=3 previously.

But for applications that had set some other extra_float_digits (default being 0), it feels like hardcoding this may cause issues.