Find PostgreSQL server hostname on which it runs

2019-06-05 04:41发布

问题:

Is it possible to find the host on which the PostgreSQL Server runs ?

回答1:

Use SELECT inet_server_addr(), but it'll return NULL if connection is established via Unix-domain socket. And there's inet_server_port() which returns the port server is listening.