diff -rpcd a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
*** a/src/interfaces/libpq/fe-connect.c	2013-12-02 09:17:05.000000000 +0900
--- b/src/interfaces/libpq/fe-connect.c	2013-12-04 12:47:04.000000000 +0900
*************** connectOptions2(PGconn *conn)
*** 782,787 ****
--- 782,805 ----
  	}
  
  	/*
+ 	 * Assume localhost if TCP/IP host was not specified
+ 	 */
+ #ifndef HAVE_UNIX_SOCKETS
+ 	if ((conn->pghost == NULL || conn->pghost[0] == '\0')
+ 		&& (conn->pghostaddr == NULL || conn->pghostaddr[0] == '\0'))
+ 	{
+ 		if (conn->pghost)
+ 			free(conn->pghost);
+ 		if (conn->pghostaddr)
+ 			free(conn->pghostaddr);
+ 		if (conn->pgunixsocket)
+ 			free(conn->pgunixsocket);
+ 		conn->pghostaddr = conn->pgunixsocket = NULL;
+ 		conn->pghost = strdup(DefaultHost);
+ 	}
+ #endif
+ 
+ 	/*
  	 * validate sslmode option
  	 */
  	if (conn->sslmode)
