Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9240589

Browse files
committed
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 8f3ec75. 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 8f3ec75 came in. Discussion: https://postgr.es/m/3894060.1646415641@sss.pgh.pa.us
1 parent 791b1b7 commit 9240589

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/interfaces/libpq/fe-connect.c

+5
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,11 @@ connectOptions2(PGconn *conn)
11151115
{
11161116
if (ch->host)
11171117
free(ch->host);
1118+
1119+
/*
1120+
* This bit selects the default host location. If you change
1121+
* this, see also pg_regress.
1122+
*/
11181123
#ifdef HAVE_UNIX_SOCKETS
11191124
if (DEFAULT_PGSOCKET_DIR[0])
11201125
{

src/test/regress/pg_regress.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,16 @@ initialize_environment(void)
746746
*/
747747
pghost = getenv("PGHOST");
748748
pgport = getenv("PGPORT");
749-
#ifndef HAVE_UNIX_SOCKETS
750749
if (!pghost)
751-
pghost = "localhost";
750+
{
751+
/* Keep this bit in sync with libpq's default host location: */
752+
#ifdef HAVE_UNIX_SOCKETS
753+
if (DEFAULT_PGSOCKET_DIR[0])
754+
/* do nothing, we'll print "Unix socket" below */ ;
755+
else
752756
#endif
757+
pghost = "localhost"; /* DefaultHost in fe-connect.c */
758+
}
753759

754760
if (pghost && pgport)
755761
printf(_("(using postmaster on %s, port %s)\n"), pghost, pgport);

0 commit comments

Comments
 (0)