Skip to content

best way to access PgSQL from R?

4 messages · Tim Keitt, Joe Conway, Jim McLoughlin

#
Hi,

I'm having a problem with R.app on OSX, where it crashes when I invoke  
dbDisconnect(<myPgSQLconnection>).  This may not be a DBI specific  
problem, but I wanted to make sure I was using the right database  
packages to try and isolate why R is crashing.

 From what I've read, DBI does not yet support a PostgresSQL driver, so  
the latest driver is in the Rdbi and Rdbi.PgSQL modules, correct?

This is how I have been accessing PgSQL:

library("chron") #needed for date columns
library("Rdbi")
library("Rdbi.PgSQL")

pcon <-  
dbConnect(PgSQL(),host="localhost",dbname="test",user="postgres",passwor 
d="<mypassword>")

dbListTables(pcon)  #works fine, as do other SQL operations

dbDisconnect(pcon) #causes R to pause, then crash

Can someone confirm whether this is the most up-to-date way to access  
PostgresSQL databases (I'm running PostgresSQL 7.4.2)?

thanks,

Jim M
#
There was a bug in Rdbi.PgSQL that caused a segfault on releasing the
connection. The C-code returns NULL instead of SEXP. That's not allowed,
but is undocumented (at least at the time).

T.
On Fri, 2004-07-23 at 12:08, Jim McLoughlin wrote:
#
Jim McLoughlin wrote:
I believe there is a slightly updated version available as part of the 
Bioconductor project; see:
http://www.bioconductor.org/repository/release1.4/package/html/RdbiPgSQL.html

Not sure if it solves your particular issue though.

HTH,

Joe
#
Thanks, this fixed everything.

I was previously using the Rdbi and Rdbi.PgSQL packages from  
sourceforge (version 0.1.2)

cheers,

Jim
On Jul 23, 2004, at 10:57 AM, Joe Conway wrote: