From stesch at no-spoon.de Sun Feb 6 18:42:03 2005 From: stesch at no-spoon.de (Stefan Scholl) Date: Sun, 6 Feb 2005 19:42:03 +0100 Subject: [pg-devel] Re: Socket path In-Reply-To: <20050206182200.GD7904@parsec.no-spoon.de> References: <20050206182200.GD7904@parsec.no-spoon.de> Message-ID: <20050206184203.GE7904@parsec.no-spoon.de> On 2005-02-06 19:22:00, Stefan Scholl wrote: > But I'd prefer a special *pg-unix-socket-directory*. Diff attached. -------------- next part -------------- Index: defpackage.lisp =================================================================== RCS file: /project/pg/cvsroot/pg/defpackage.lisp,v retrieving revision 1.4 diff -u -r1.4 defpackage.lisp --- defpackage.lisp 22 Apr 2004 16:57:39 -0000 1.4 +++ defpackage.lisp 6 Feb 2005 18:39:16 -0000 @@ -9,6 +9,7 @@ #:pgcon-sql-stream #:*pg-disable-type-coercion* #:*pg-client-encoding* + #:*pg-unix-socket-directory* #:pg-databases #:pg-tables #:pg-columns #:pg-backend-version #:pg-date-style Index: sysdep.lisp =================================================================== RCS file: /project/pg/cvsroot/pg/sysdep.lisp,v retrieving revision 1.6 diff -u -r1.6 sysdep.lisp --- sysdep.lisp 11 Aug 2004 13:27:48 -0000 1.6 +++ sysdep.lisp 6 Feb 2005 18:39:17 -0000 @@ -14,7 +14,8 @@ #+sbcl (progn (require :asdf) (require :sb-bsd-sockets) (require :sb-md5)) #+(and mcl (not openmcl)) (require "OPENTRANSPORT")) - +(defvar *pg-unix-socket-directory* "/tmp" + "Directory of the Unix-domain socket") (defmacro %sysdep (desc &rest forms) (when (null forms) @@ -94,7 +95,9 @@ (let ((fd (if host (ext:connect-to-inet-socket host port) (ext:connect-to-unix-socket - (format nil "/var/run/postgresql/.s.PGSQL.~D" port))))) + (format nil "~A/.s.PGSQL.~D" + *pg-unix-socket-directory* + port))))) (sys:make-fd-stream fd :input t :output t :element-type '(unsigned-byte 8))) (error (e) @@ -161,7 +164,7 @@ s) (let ((s (make-instance 'sb-bsd-sockets:local-socket :type :stream))) (sb-bsd-sockets:socket-connect - s (format nil "/var/run/postgresql/.s.PGSQL.~D" port)) + s (format nil "~A/.s.PGSQL.~D" *pg-unix-socket-directory* port)) s)) :element-type '(unsigned-byte 8) :input t @@ -229,7 +232,9 @@ :type :stream :connect :active :format :binary - :remote-filename (format nil "/var/run/postgresql/.s.PGSQL.~D" port))) + :remote-filename (format nil "~A/.s.PGSQL.~D" + *pg-unix-socket-directory* + port))) (error (e) (error 'connection-failure :host host From stesch at no-spoon.de Sun Feb 6 18:22:00 2005 From: stesch at no-spoon.de (Stefan Scholl) Date: Sun, 6 Feb 2005 19:22:00 +0100 Subject: [pg-devel] Socket path Message-ID: <20050206182200.GD7904@parsec.no-spoon.de> Hi! I was just wondering about the path of the unix domain socket. In sysdep.lisp /var/run/postgresql is used. But the default path for PostgreSQL's socket directory is /tmp. I'd suggest to add a way to specify the directory (which is called unix_socket_directory in postgresql.conf). The function PQconnectdb() of libpg uses a path with leading "/" in the host parameter. But I'd prefer a special *pg-unix-socket-directory*. Regards, Stefan