aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r--src/interfaces/libpq/fe-connect.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 9c51166b40a..4a1a0272b6b 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -5353,7 +5353,10 @@ PQhost(const PGconn *conn)
else
{
#ifdef HAVE_UNIX_SOCKETS
- return conn->pgunixsocket;
+ if (conn->pgunixsocket != NULL && conn->pgunixsocket[0] != '\0')
+ return conn->pgunixsocket;
+ else
+ return DEFAULT_PGSOCKET_DIR;
#else
return DefaultHost;
#endif