[R-sig-DB] RPostgreSQL driver timestamp data type mapping

Sebastian P. Luque @p|uque @end|ng |rom gm@||@com
Wed Jan 13 05:42:55 CET 2010


Hi,

Using the RPostgreSQL driver to access a view on a PostgreSQL 8.4
database:

library(RPostgreSQL)
m <- dbDriver("PostgreSQL")
con <- dbConnect(m, user="me", password="pwd", dbname="dbname")
qry <- "SELECT * FROM mytable"
rs <- dbSendQuery(con, qry)

Fields corresponding to timestamp data type are mapped to POSIXct, as
shown by dbColumnInfo():

        name    Sclass      type len precision scale nullOK
...
...
8  date_time   POSIXct TIMESTAMP   8        -1    -1   TRUE

I'd like to have a bit more control over this conversion, as it
currently results in the POSIXct object having the time zone of my
locale, whereas I need to set it to GMT.  Reading the DBI manual, I
can't see how this could be done.  Any pointers would be appreciated.
Thanks.


Cheers,

-- 
Seb




More information about the R-sig-DB mailing list