From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | PQconninfo() doesn't return anything for host=/socket/directory |
Date: | 2013-11-27 08:44:51 |
Message-ID: | 20131127084451.GA28863@alap2.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi,
Programs that use PQconninfo() to build a new connection string, like in
my case pg_basebackup --write-recovery-conf, fail to do anything for
non-default socket directories leading to the newly built connection
string being unusable for connecting.
The reason for that is the following tidbit from
fe-connect.c:connectOptions2()
/*
* Allow unix socket specification in the host name
*/
if (conn->pghost && is_absolute_path(conn->pghost))
{
if (conn->pgunixsocket)
free(conn->pgunixsocket);
conn->pgunixsocket = conn->pghost;
conn->pghost = NULL;
}
This strikes me as unfortunate. Note that PQhost() does the right
thing...
I've attached a hack that fixes this, but I pretty much dislike the
direction it's going. Maybe the better fix is to simply not unset pghost
above and make connectDBStart() more intelligent?
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachment | Content-Type | Size |
---|---|---|
pqconninfo-socket-directory.diff | text/x-diff | 905 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | jonathan.camile | 2013-11-27 09:26:19 | Re: BUG #8629: Strange resultset when using CTE or a subselect |
Previous Message | Michael Paquier | 2013-11-27 00:34:01 | Re: BUG #8631: invalid page header |