how to tell what port postgres is listening on code example Example: how to check port number for postgresql SELECT * FROM pg_settings WHERE name = 'port';