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

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(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 16:28:46
Message-ID: CA+bJJbxZ7H6e2YC5JkWGC7pW=SxgLj5BBrdF_=wgF4w0fo3fyQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, 3 Apr 2022 at 17:50, David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> 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.

Socket name seems not to be accessible, as let per a cursory look at
the docs, anyway, but I just looked for unix and for socket in the
index.
And as extension must be port, you are right, no info there.

>> 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.

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. In my usage postgres
normally behaves as expected, does not bother doing extra checks, just
listens where it is told to and hums along ( I know of some stupid
programs which, in a situation like this, have code to check if there
is another process listening in the same port, where there is no
transport address collision at all ).

Francisco Olarte.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-04-03 16:42:34 Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.
Previous Message David G. Johnston 2022-04-03 15:50:40 Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.