Re: How to determine server's own IP address? inet_server_addr not working

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Guyren Howe <guyren(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How to determine server's own IP address? inet_server_addr not working
Date: 2021-02-22 06:03:38
Message-ID: CAB8KJ=htG4pwL4yVdg3aEEZGxyRSLit+Y9xb=Y5=iVuVd1ECVg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2021年2月22日(月) 8:42 David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>:

> On Sun, Feb 21, 2021 at 4:38 PM Guyren Howe <guyren(at)gmail(dot)com> wrote:
>
>> The documentation says that inet_server_addr() does this, but on our
>> servers it is returning nothing.
>>
>
> "Returns the IP address on which the server accepted the current
> connection, or NULL if the current connection is via a Unix-domain socket."
>
> You will need to demonstrate that the connection you are checking from
> isn't being made via a Unix-domain socket.
>

Note also there's a bug in current versions where this function will
erroneously
return NULL if executed by a parallel worker, see [1]. This is fixed in
HEAD but
hasn't been backpatched [2].

[1]
https://www.postgresql.org/message-id/CAD21AoAT4aHP0Uxq91qpD7NL009tnUYQe-b14R3MnSVOjtE71g@mail.gmail.com
[2]
https://git.postgresql.org/pg/commitdiff/5a6f9bce8dabd371bdb4e3db5dda436f7f0a680f

Regards

Ian Barwick

--
EnterpriseDB: https://www.enterprisedb.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Atul Kumar 2021-02-22 06:17:48 Streaming replication between different OS
Previous Message Ron 2021-02-22 02:38:20 Re: Script checking to see what database it's connected to