-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPostgres changes number of digits after decimal point #33
Comments
Please include a minimal reproducible example that actually verifies that the values are different (not just printed differently, e.g. by subtracting the two values) |
Sure. I only spotted this because I was migrating a package to use RPostgres, and it fails on writing this dataframe: https://github.com/robertzk/cachemeifyoucan/blob/master/tests/testthat/helper-batch_data.R |
Here! Browse[1]> conn
<PqConnection> travis@localhost:5432
Browse[1]> df_ref
id x y
1 1 0.5608329 -1.4917053
2 2 0.7946495 -0.3914652
3 3 0.5892545 0.9543467
4 4 0.8914159 -1.0087213
5 5 0.5881625 1.0540364
Browse[1]> DBI::dbWriteTable(conn, 'will_drop_digits', df_ref)
[1] TRUE
Browse[1]> df_check <- dbReadTable(conn, 'will_drop_digits')
Browse[1]> df_check
id x y
1 1 0.560833 -1.491710
2 2 0.794649 -0.391465
3 3 0.589254 0.954347
4 4 0.891416 -1.008720
5 5 0.588162 1.054040
Browse[1]> df_check$x == df_ref$x
[1] FALSE FALSE FALSE FALSE FALSE
Browse[1]> df_check$x - df_ref$x
[1] 1.454068e-07 -4.519711e-07 -4.533126e-07 1.262247e-07 -4.661852e-07 Output from psql travis=> select * from will_drop_digits ;
id | x | y
----+----------+-----------
1 | 0.560833 | -1.49171
2 | 0.794649 | -0.391465
3 | 0.589254 | 0.954347
4 | 0.891416 | -1.00872
5 | 0.588162 | 1.05404
(5 rows) |
Can you please make an example that I can copy and paste into R easily? |
Don't know what happened, but my tests magically passed today. Closing the issue. The only thing I've changed in my code was update R and change |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary. |
Writing this table to database
Yet when I read it from DB (double-checked using
psql
), I see thisDigits got truncated! Any ideas how to solve this?
The text was updated successfully, but these errors were encountered: