summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-03-04 13:23:58 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2022-03-04 13:23:58 -0500
commita008c03dd722f3a9ea44b13ca2cc6066fd90ddc1 (patch)
treee592fb28beaf2d399a2468f65ec9d7f3079b432e /src/test
parent5c9d17e94c5cc0d24c1f0dbfe030000238d65afb (diff)
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 8f3ec75de. 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 8f3ec75de came in. Discussion: https://postgr.es/m/3894060.1646415641@sss.pgh.pa.us
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/pg_regress.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 05296f7ee1d..27486cf5385 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -911,10 +911,16 @@ initialize_environment(void)
*/
pghost = getenv("PGHOST");
pgport = getenv("PGPORT");
-#ifndef HAVE_UNIX_SOCKETS
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
+ pghost = "localhost"; /* DefaultHost in fe-connect.c */
+ }
if (pghost && pgport)
printf(_("(using postmaster on %s, port %s)\n"), pghost, pgport);