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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)
Дата
Msg-id 1523824.1752158490@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Starting a PostgreSQL server on a dynamic port (parameter port=0)  (a.mitrokhin@postgrespro.ru)
Ответы Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)
Список pgsql-bugs
a.mitrokhin@postgrespro.ru writes:
> Postgres does not allow starting the server with port=0, which prevents
> it from obtaining an arbitrary free port from the kernel.

Others have already pointed out problems with this proposal, but
the one I see is: what do you do next?  How will clients know
what port to connect to?

The only way I could see to do that is to read the port out of
postmaster.pid, which works only for clients running as the same
userid as the postmaster, which is surely an unfit-for-production
approach.

If you're only interested in this for testing purposes, we
already have perfectly good free-port-selection algorithms
embedded in our test harnesses.  For that matter, in a test
environment it's usually best (most secure) to use a Unix
socket in a private directory, in which case there is little
need to worry about port number conflicts in the first place.

            regards, tom lane



В списке pgsql-bugs по дате отправления: