问题
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.
来源:https://stackoverflow.com/questions/14039101/find-postgresql-server-hostname-on-which-it-runs