Find the host name and port using PSQL commands

jamesatha picture jamesatha · Apr 8, 2011 · Viewed 312.6k times · Source

I have PSQL running, and am trying to get a perl application connecting to the database. Is there a command to find the current port and host that the database is running on?

Answer

a_horse_with_no_name picture a_horse_with_no_name · Apr 8, 2011
SELECT *
FROM pg_settings
WHERE name = 'port';