Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uZlVC-007iMZ-Fu for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Jul 2025 07:15:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uZlV8-009JWq-D7 for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Jul 2025 07:15:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uZlV8-009JWh-4H for pgsql-bugs@lists.postgresql.org; Thu, 10 Jul 2025 07:15:26 +0000 Received: from mail.postgrespro.ru ([93.174.132.70]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uZlV5-006XFS-2H for pgsql-bugs@lists.postgresql.org; Thu, 10 Jul 2025 07:15:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1752131720; bh=uEh9CulW3gopvz9c/hGoC+KEiKp3P/Nlv2j0Blr8zXc=; h=Date:From:To:Subject:Message-ID:From; b=bFyburUd0fZm1N4BWPCzLA7zxjWcPhA7QIVq2dgUg037y5bf5Fdu8yx48Nadw1t2F EFJMbO5XRo2TVk5dYgZwP6xTvDc+7BQTIgp+C87L5CFP9IOO8AM+m1nDWjBcDUPTs3 DmVdJYY8EzLFa9CWsZkQ6HiwD2vLBsNrzQ+zSFlvj9f9fmE9uufuwkw/C4bLjjXt4b kWoeRL3NxvJQy+xuSXnm+U/s8DxIiRhFGKgLJtWvmTA8Xi9IPCUQYfmWODm2hWxwwC s4DuYzIIdYhpQ1TyFu6fqt82lnWbcvsBUf/JOxDmjC6t2gmnSjKegDSGdVB+4pkNtl ROF0fIptNiHtg== Received: from mail.postgrespro.ru (webmail-master-mstn.l.postgrespro.ru [192.168.2.26]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: a.mitrokhin@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 06E9560851 for ; Thu, 10 Jul 2025 10:15:20 +0300 (MSK) MIME-Version: 1.0 Date: Thu, 10 Jul 2025 14:15:19 +0700 From: a.mitrokhin@postgrespro.ru To: pgsql-bugs@lists.postgresql.org Subject: Starting a PostgreSQL server on a dynamic port (parameter port=0) Message-ID: <824bbf6be5fa0edf6a7d4c8371ce67ce@postgrespro.ru> X-Sender: a.mitrokhin@postgrespro.ru Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2025/07/10 06:12:00 #27632634 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello. Postgres does not allow starting the server with port=0, which prevents it from obtaining an arbitrary free port from the kernel. ~$ LANG=C pg_ctl -D data -o "-c port=0" start 2025-07-10 05:27:02.785 GMT [702503] FATAL: 0 is outside the valid range for parameter "port" (1 .. 65535) This makes it unreliable to start the server in my tests without the risk of port conflicts with already running programs, unless resorting to an unreliable and race-condition-prone procedure of reserving ports in advance. Could you please fix this?