[R-sig-Geo] install rgdal to query postgis database
Duncan McPherson
duncan at mcpherson.org.uk
Mon Jul 29 00:49:19 CEST 2013
Thanks for your suggestion.
The user postgres has a password already (see below for detail). I tried as you suggested:
> dsn="PG:dbname=england_health user=postgres password=[password]"
> ogrListLayers(dsn)
Error in ogrListLayers(dsn) : Cannot open data source
and all the variations as before. I also created a new postgres user 'duncan', with the same password as my system login password and used this in case there was some conflict between the logged in user and the database role. That didn't help either, although I can make all the other connections as either postgres or duncan (including DBI+RPostgreSQL).
Your suggestion got me to digging around in my postgresql configuration. It turns out that my pg_hba.conf file has
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres trust
#host replication postgres 127.0.0.1/32 trust
#host replication postgres ::1/128 trust
which means, to my reading, that any user should be trusted to connect from localhost (I may have to look into this more, since there are suggestions this isn't secure, but that is another story). So, even if a user has a password set, it shouldn't be checked.
I am curious also as to why DBI/RPostgreSQL can connect and get data from the database freely, but Rgdal cannot? They must be doing something different that I can't figure out?
More information about the R-sig-Geo
mailing list