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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Francisco Olarte <folarte(at)peoplecall(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, 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 16:42:34
Message-ID: 1646105.1649004154@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Francisco Olarte <folarte(at)peoplecall(dot)com> writes:
>> 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.

> 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Lorenz, Christopher 2022-04-04 07:00:02 AW: BUG #17393: Delete database after recovery with point-in-time is still missing datafiles
Previous 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.