[support] Unable to connect to Postgres via UNIX domain socket

Bill Moran wmoran at potentialtech.com
Fri May 11 14:38:01 UTC 2007


I don't know if MySQL had the equivalent to this, but with PostgreSQL,
you can connect to a unix domain socket instead of TCP/localhost.  This
has the advantage of being faster because it doesn't have the overhead
of TCP.

It doesn't seem as if Drupal's connection scheme is capable of supporting
this.  Using raw pg_connect() in php, the connection would be established
thusly:

pg_connect('user=drupal dbname=drupal host=/tmp');

Optionally, the host= could be omitted entirely, and the PG drivers will
default to connecting to the local socket in /tmp.

if I tweak the following:
$db_url = 'pgsql://drupal@/tmp/drupal';

It doesn't work.  I assume the url decoding is barfing on that.  Leaving
out the host name causes a similar error.

Is this possible?  I suppose it's not the end of the world if it's
not, but I thought I'd ask.

-- 
Bill Moran
http://www.potentialtech.com


More information about the support mailing list