Skip to content

Postgres to R date conversion and Writing NULL to postgres database using RpgSQL issue

3 messages · Gabor Grothendieck

#
On Thu, Apr 21, 2011 at 6:32 AM, subodh agrawal <subodh.iitr at gmail.com> wrote:
Thanks.  This reproduces the error.

library(RpgSQL)
DF <- data.frame(a = c(1, NA, 2), b = c(Sys.Date() + 1:2, NA), c =
c("a", NA, "b"))
con <- dbConnect(pgSQL(), user = "whatever", password = "whatever",
dbname = "whatever")
dbWriteTable(con, "DF", DF)
Continuing from above the following works in the development version
of RpgSQL (although the writeTable above is still a problem in the
development version). The NA fields are stored as NULLs and then
converted back to NAs.  (In the released version the code below only
works for character columns.)

DF2 <- DF[-2]
dbWriteTable(con, "DF2", DF2)
dbGetQuery(con, "select * from DF")

I can send you the development version if you need it now.
#
On Wed, May 11, 2011 at 12:36 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
This is now fixed in the development version of RpgSQL.
#
On Wed, May 11, 2011 at 9:44 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
And its now on CRAN as version 0.1-5:

   http://cran.r-project.org/web/packages/RpgSQL/index.html

and should propagate to the other mirrors shortly.