Re: Starting a PostgreSQL server on a dynamic port (parameter port=0) - Mailing list pgsql-bugs

From Laurenz Albe
Subject Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)
Date
Msg-id 0ae1aa4b0e3343e2bd2c1b7c41ebeccfe0f65188.camel@cybertec.at
Whole thread Raw
In response to Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)  (a.mitrokhin@postgrespro.ru)
Responses Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)
List pgsql-bugs
On Thu, 2025-07-10 at 15:29 +0700, a.mitrokhin@postgrespro.ru wrote:
> > > Postgres does not allow starting the server with port=0, which prevents
> > > it from obtaining an arbitrary free port from the kernel.
>
> This has nothing to do with Postgres regression tests. The issue is
> the practical benefit of using a dynamic port, which we're depriving
> ourselves of.
>
> If you're not interested in this behavior, you'll never use it. But
> there are cases where it can be very convenient. Why artificially
> restrict functionality that is simple, doesn't conflict with anything,
> and has no negative side effects?

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.

Yours,
Laurenz Albe



pgsql-bugs by date:

Previous
From: a.mitrokhin@postgrespro.ru
Date:
Subject: Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)
Next
From: Jim Jones
Date:
Subject: Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)