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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.
Дата
Msg-id CAKFQuwZy=KscPcsXbRsutx5AcAxJSYMjku_avuP=LmNoGAxpsA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.  (Francisco Olarte <folarte@peoplecall.com>)
Ответы Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.  (Francisco Olarte <folarte@peoplecall.com>)
Список pgsql-bugs
On Sun, Apr 3, 2022 at 8:36 AM Francisco Olarte <folarte@peoplecall.com> wrote:
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.

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.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Francisco Olarte
Дата:
Сообщение: Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: BUG #17454: Using psql without ipv4 address,the inet_server_port do not return PORT.