I am inserting a dataframe containing infinity to PostgreSQL, then when I make a query I obtain zero.
library(DBI)
conn <- dbConnect(drv = RPostgres::Postgres(),
dbname = "my_db",
host = "localhost",
user = "db_admin",
password = pw)
rm(pw)
mydf <- data.frame(column_1 = c("A", "B", "C"), column_2 = c(1, Inf, 3))
dbWriteTable(conn, "mytable", mydf, row.names = FALSE)
from_df <- dbReadTable(conn, "mytable")
from_df
The result obtained from db.
column_1 column_2
1 A 1
2 B 0
3 C 3
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RPostgreSQL_0.6-2 DBI_1.1.0
loaded via a namespace (and not attached):
[1] bit_4.0.4 compiler_4.0.3 hms_0.5.3 tools_4.0.3
[5] Rcpp_1.0.5 bit64_4.0.5 vctrs_0.3.4 blob_1.2.1
[9] pkgconfig_2.0.3 rlang_0.4.8 RPostgres_1.2.1 fortunes_1.5-4
I am inserting a dataframe containing infinity to PostgreSQL, then when I make a query I obtain zero.
The result obtained from db.