Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Francisco Olarte <folarte(at)peoplecall(dot)com>
Cc: Wong Simon <thbytwo(at)live(dot)cn>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.
Date: 2022-04-03 15:50:40
Message-ID: CAKFQuwZy=KscPcsXbRsutx5AcAxJSYMjku_avuP=LmNoGAxpsA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, Apr 3, 2022 at 8:36 AM Francisco Olarte <folarte(at)peoplecall(dot)com>
wrote:

> On Sun, 3 Apr 2022 at 16:50, Wong Simon <thbytwo(at)live(dot)cn> wrote:
> > If I run multiple instances on one server with local socket, how can I
> distinguish them?I think the port is need.
>
> You distinguish them by the socket NAME whose "extension" is the port
> as a decimal string. The socket name is derived from the port option,
> but it is not a port. It's clearly specified:
>

Resorting to string parsing is never desirable, nor is it necessary here.

>
> But if you just need to distinguish instance on diferent ports, query
> the "port" configuration parameter, IIRC this is unique ( although may
> be you can somehow reuse it with careful usage of listen_addresses and
> unix_socket_directories ).
>
>
Per the docs It is indeed single-valued. I don't know what "reuse" would
mean in this context but both sockets and IP have a specific usage of this
setting's value that the DBA cannot alter.

One could also inspect data_directory, it has the same "unique per cluster
on the same machine" property.

The function inet_server_addr() can help to distinguish which machine if
there are multiple. Though what "local" means may be a problem. I suppose
what is useful depends on "why" one needs to distinguish them.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Francisco Olarte 2022-04-03 16:28:46 Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.
Previous Message Francisco Olarte 2022-04-03 15:35:56 Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.