Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.
Date
Msg-id 1646105.1649004154@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.  (Francisco Olarte <folarte@peoplecall.com>)
List pgsql-bugs
Francisco Olarte <folarte@peoplecall.com> writes:
>> On Sun, 3 Apr 2022 at 16:50, Wong Simon <thbytwo@live.cn> wrote:
>>> If I run multiple instances on one server with local socket, how can I distinguish them?I think the port is need.

> Port is single valued, what I meant is I'm not sure if using
> socket_dir=/socka, listen_addr=127.0.0.1, data_dir=/dataA and
> port=5432 plus socket_dir=/sockb, listen_addr=127.0.0.2,
> data_dir=/datab and port=5432 would let you start two correctly
> functioning instances in the same machine.

I think relying on port for this purpose is misguided anyway.
We've had requests in the past to let one postmaster listen on
multiple different port numbers; I think the only reason it's
not happened yet is nobody got excited enough to write a patch.

Likewise, inet_server_addr() seems a bit shaky as a server
identity value, since it's already possible to have a postmaster
listening on multiple IP addresses.

If you're trying to identify an installation uniquely, the
machine name and data_directory are probably the best key.
Getting a suitably unique machine name might be tricky.
For localhost connections, though, you could ignore that.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.
Next
From: "Lorenz, Christopher"
Date:
Subject: AW: BUG #17393: Delete database after recovery with point-in-time is still missing datafiles