artemp/mapnik — Issue #8: PostGIS datasource won't connect using UNIX sockets
Author: artemp
Created: 2011-10-11 15:51:34+00:00
State: open
Labels: PostGIS_Input_Driver

Attempting to create a PostGIS connection using UNIX sockets e.g.:

{{{
datasource_byways = PostGIS(host=None,
dbname=conf.db_name,
user=conf.db_user,
password=conf.db_password,
table='byway_joined_current')
}}}

results in the error message

{{{
connection to host= dbname=cycling user=cycling password= connect_timeout=4 failed
could not translate host name "dbname=cycling" to address: Name or service not known
}}}

Setting host to the empty string or leaving it out altogether give the same result.

In comparison, psycopg (a Python DB API 2.0 adapter) uses UNIX sockets to connect to the database when host is specified in this way.

This is with r432.