Well, here is the code fragment from the postgres driver.
If it's a bug it's an intentional one.
if (!strcmp(host, "localhost")) {
Ns_Log(Notice, "Opening %s on %s", db, host);
pgConn = PQsetdbLogin(NULL, port, NULL, NULL, db, handle->user,
handle->password);
} else {
Ns_Log(Notice, "Opening %s on %s, port %s", db, host, port);
pgConn = PQsetdbLogin(host, port, NULL, NULL, db, handle->user,
handle->password);
}
Maybe if we are connection because we have "localhost" we should try 127.0.0.1 if the unix domain socket fails.
I will ping Lamar Owen and see what he thinks...