how to check if the postgres port is open in windows code example Example: how to check port number for postgresql SELECT * FROM pg_settings WHERE name = 'port';