Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::') - Mailing list pgsql-hackers

From Noah Misch
Subject Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::')
Date
Msg-id 20151027072024.GA683077@tornado.leadboat.com
Whole thread Raw
In response to Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::')  (Tatsuo Ishii <ishii@postgresql.org>)
Responses Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::')  (Tatsuo Ishii <ishii@sraoss.co.jp>)
Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::')  (Tatsuo Ishii <ishii@postgresql.org>)
List pgsql-hackers
On Mon, Oct 26, 2015 at 09:54:03AM +0900, Tatsuo Ishii wrote:
> > Kondo's design is correct.
> 
> So more proper fix looks like this?

> +                        /* If postmaster is listening on "*", "0.0.0.0" or "::", use 127.0.0.1 */
> +                        if (strcmp(host_str, "*") == 0 ||
> +                            strcmp(host_str, "0.0.0.0") == 0 ||
> +                            strcmp(host_str, "::") == 0)
> +                            strcpy(host_str, "127.0.0.1");

No, PQping("host='127.0.0.1'") fails to reach a listen_addresses='::' server
on many systems.  Here's what I thought Kondo was proposing:

--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -649,5 +649,9 @@ test_postmaster_connection(pgpid_t pm_pid, bool do_checkpoint)
-                        /* If postmaster is listening on "*", use localhost */
+                        /* explanation here */                        if (strcmp(host_str, "*") == 0)
         strcpy(host_str, "localhost");
 
+                        else if (strcmp(host_str, "0.0.0.0") == 0)
+                            strcpy(host_str, "127.0.0.1");
+                        else if (strcmp(host_str, "::") == 0)
+                            strcpy(host_str, "::1");



pgsql-hackers by date:

Previous
From: Kouhei Kaigai
Date:
Subject: Re: [DESIGN] ParallelAppend
Next
From: Ashutosh Bapat
Date:
Subject: Re: Getting sorted data from foreign server