On Tue, Oct 14, 2014 at 5:22 PM, Paul Gilbert <pgilbert...@gmail.com> wrote: > I reported earlier in this thread that this works: > > Type 'q()' to quit R. >> require("RPostgreSQL") > Loading required package: RPostgreSQL > Loading required package: DBI >> require("DBI") >> z <-dbConnect(RPostgreSQL::PostgreSQL(), dbname="test") #works > > but there are some circumstance I have not isolated where if fails with the > same problem as this (which fails reliably): > > Type 'q()' to quit R. >> requireNamespace("RPostgreSQL") > Loading required namespace: RPostgreSQL >> require("DBI") > Loading required package: DBI >> z <- dbConnect(RPostgreSQL::PostgreSQL(), "test") > Error in postgresqlNewConnection(drv, ...) : > RS-DBI driver: (could not connect test@local on dbname "test" > ) > > For some reason, done this way it does not find my setting of environment > variable PGHOST, which is not localhost, and picks up test as my user name, > which is not correct.
I suspect this is because RPostgreSQL needs some tweaks to work when it's not attached - it's possible it's using .onAttach instead of .onLoad for initialisation. Hadley -- http://had.co.nz/ _______________________________________________ R-sig-DB mailing list -- R Special Interest Group R-sig-DB@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-db