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

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: a(dot)mitrokhin(at)postgrespro(dot)ru, Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)
Date: 2025-07-10 08:53:17
Message-ID: 0ae1aa4b0e3343e2bd2c1b7c41ebeccfe0f65188.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, 2025-07-10 at 15:29 +0700, a(dot)mitrokhin(at)postgrespro(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jim Jones 2025-07-10 09:13:31 Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)
Previous Message a.mitrokhin 2025-07-10 08:29:53 Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)