Commit a008c03d authored by Tom Lane's avatar Tom Lane

Fix pg_regress to print the correct postmaster address on Windows.

pg_regress reported "Unix socket" as the default location whenever
HAVE_UNIX_SOCKETS is defined.  However, that's not been accurate
on Windows since 8f3ec75d.  Update this logic to match what libpq
actually does now.

This is just cosmetic, but still it's potentially misleading.
Back-patch to v13 where 8f3ec75d came in.

Discussion: https://postgr.es/m/3894060.1646415641@sss.pgh.pa.us
parent 5c9d17e9
...@@ -1119,6 +1119,11 @@ connectOptions2(PGconn *conn) ...@@ -1119,6 +1119,11 @@ connectOptions2(PGconn *conn)
{ {
if (ch->host) if (ch->host)
free(ch->host); free(ch->host);
/*
* This bit selects the default host location. If you change
* this, see also pg_regress.
*/
#ifdef HAVE_UNIX_SOCKETS #ifdef HAVE_UNIX_SOCKETS
if (DEFAULT_PGSOCKET_DIR[0]) if (DEFAULT_PGSOCKET_DIR[0])
{ {
......
...@@ -911,10 +911,16 @@ initialize_environment(void) ...@@ -911,10 +911,16 @@ initialize_environment(void)
*/ */
pghost = getenv("PGHOST"); pghost = getenv("PGHOST");
pgport = getenv("PGPORT"); pgport = getenv("PGPORT");
#ifndef HAVE_UNIX_SOCKETS
if (!pghost) if (!pghost)
pghost = "localhost"; {
/* Keep this bit in sync with libpq's default host location: */
#ifdef HAVE_UNIX_SOCKETS
if (DEFAULT_PGSOCKET_DIR[0])
/* do nothing, we'll print "Unix socket" below */ ;
else
#endif #endif
pghost = "localhost"; /* DefaultHost in fe-connect.c */
}
if (pghost && pgport) if (pghost && pgport)
printf(_("(using postmaster on %s, port %s)\n"), pghost, pgport); printf(_("(using postmaster on %s, port %s)\n"), pghost, pgport);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment