how to find out host and port of postgres code example Example: how to check port number for postgresql SELECT * FROM pg_settings WHERE name = 'port';