Hi,
I can connect to Postgresql using a Unix socket with sbcl by passing :unix as a host. The problem is that under FreeBSD, the default directory for the socket is ``/tmp'' and not ``/var/run/postgresql''. Here's a quick fix that solves the problem:
--- public.lisp.orig 2010-04-14 21:41:39.000000000 +0300 +++ public.lisp 2010-05-15 11:21:56.000000000 +0300 @@ -47,7 +47,9 @@ #+(and sbcl unix) (defun sb-unix-socket-connect (port) (let ((sock (make-instance 'sb-bsd-sockets:local-socket :type :stream)) - (addr (format nil "/var/run/postgresql/.s.PGSQL.~a" port))) + (addr (format nil "~a/.s.PGSQL.~a" + #-freebsd "/var/run/postgresql" #+freebsd "/tmp" + port))) (sb-bsd-sockets:socket-connect sock addr) (sb-bsd-sockets:socket-make-stream sock :input t :output t :element-type '(unsigned-byte 8))))
Maybe a better fix would be to define a variable for the socket directory and let the user set it himself.
Hey,
Maybe a better fix would be to define a variable for the socket directory and let the user set it himself.
I've created an alternative patch implementing this suggestion -- the variable defaults to /tmp/ or /var/run/postgresql/ depending on #+freebsd, but user code could change it if they need another path. (see cl-postgres::*unix-socket-dir*).
Best, Marijn
postmodern-devel@common-lisp.net