[PATCH] Allow Postgres to pick an unused port to listen - Mailing list pgsql-hackers

From Yurii Rashkovskii
Subject [PATCH] Allow Postgres to pick an unused port to listen
Date
Msg-id CA+RLCQwJBGAnBo7OZ6QxqJjEn6w=Mju9GrHQmwFxX_io+4Cwhw@mail.gmail.com
Whole thread Raw
Responses Re: [PATCH] Allow Postgres to pick an unused port to listen  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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.
Attachment

pgsql-hackers by date:

Previous
From: Yugo NAGATA
Date:
Subject: Using Ephemeral Named Relation like a temporary table
Next
From: Pavel Stehule
Date:
Subject: Re: Using Ephemeral Named Relation like a temporary table