Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)

Jim Jones <jim.jones@uni-muenster.de>

From: Jim Jones <jim.jones@uni-muenster.de>
To: Laurenz Albe <laurenz.albe@cybertec.at>, a.mitrokhin@postgrespro.ru, Kirill Reshke <reshkekirill@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2025-07-10T09:13:31Z
Lists: pgsql-bugs

On 10.07.25 10:53, Laurenz Albe wrote:
> I have never wished for such a feature, and I can see negative side
> effects.  If the server listens on a different port than you expect,
> it is easier to connect to the wrong server by mistake.

Moreover, there's a risk that postgres could potentially hijack the port
of an application that's not currently running, but has a fixed port
configuration assigned to it. This could, in turn, prevent the
application from starting up successfully.

I can understand why it might be attractive for some scenarios, but the
risks and consequences could outweigh the benefits.

Best, Jim