Re: location of Unix socket - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: location of Unix socket
Date
Msg-id Pine.LNX.4.21.0011272150590.832-100000@peter.localdomain
Whole thread Raw
In response to Re: location of Unix socket  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: location of Unix socket
Re: location of Unix socket
List pgsql-hackers
Bruce Momjian writes:

> Am I handling this properly?  I hate to be dragging around the unix
> socket directory name in pghost for too long and hate to be propogating
> the slash test throughout the code.

ISTM that you could just do this in connectDBStart() where it actually
decides on AF_UNIX.  It's just a different place to do it and you don't
have to maintain it in two different places (PQconnectdb-style and
PQsetdbLogin-style).

For symmetry PQhost() should return what was put in as host.  Since you
cannot put in a unix socket as a separate connection parameter there
cannot be a function PQunixsocket to get one out.  In fact, ISTM there
should not be anything that's explicitly called 'unixsocket'.

I don't like the code in fe-connect.c one bit, it's way messed up.  
Evidently there's even some code in there that allows you to do this:

$ psql tcp:postgresql://localhost:5432/peter

which is certainly a cool idea, only that it ends up with

psql: connectDBStart() --  unknown hostname: J"J"@st

Eventually I think the URL-style is the way to go, especially with SSL
becoming mainline, so I'd hate to publish too many new functions of
questionable value for a feature which is not very well thought out yet.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



pgsql-hackers by date:

Previous
From: Dave
Date:
Subject: JDBC charSet patch
Next
From: Bruce Momjian
Date:
Subject: Re: location of Unix socket