Open JohnMount opened 6 years ago
AFAIR big int always should be passed as text to db drivers, unless they support big int.
https://stackoverflow.com/questions/19169164/r-rpostgresql-bigint-datatype https://groups.google.com/forum/#!topic/rpostgresql-dev/NDc7NfUP6M8 Looks like I recall good after almost 5 years.
I think I see your point. It feels like we should get that last decimal digit (until we have more digits than floating point can represent), but as floating point is in binary things are not that simple (as each stage may round or alter the format for its own notions of safety). That being said, it still seems we are losing one more digit than we should.
I'd like to second the suggestion that bigint columns be handled as text rather than numeric. I got bitten today when 9 bits of precision were silently dropped from an index column, creating a number of collisions in what should have been a unique ID.
And in the interim, for anyone who needs a workaround you can cast the bigint to text on the database side (e.g. SELECT big_id_column::text FROM table_with_bigint_id) and either keep the character value or convert to the 64-bit integer type supplied by the bit64 package.
From https://github.com/tidyverse/dplyr/issues/3516 . Notice how violently the value is rounded when round-tripped through the database. The amount of rounding depends on the driver (so may not be a pure
DBI
issue).