Hi,
I would like to suggest a patch against master (although it may be worth backporting it) that makes it possible to listen on any unused port.
The main motivation is running colocated instances of Postgres (such as test benches) without having to coordinate port allocation in an unnecessarily complicated way.
Instead, with this patch, one can specify `port` as `0` (the "wildcard" port) and retrieve the assigned port from postmaster.pid
I believe there is no significant performance or another impact as it is a tiny bit of conditional functionality executed during startup.
The patch builds and `make check` succeeds. The patch does not add a test; however, I am trying to figure out if this behaviour can be tested automatically.