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.96) (envelope-from ) id 1wMjhg-000Ixa-0G for pgsql-hackers@arkaria.postgresql.org; Tue, 12 May 2026 09:47:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wMjhe-004BcA-0o for pgsql-hackers@arkaria.postgresql.org; Tue, 12 May 2026 09:47:02 +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.96) (envelope-from ) id 1wMjhd-004Bc1-29 for pgsql-hackers@lists.postgresql.org; Tue, 12 May 2026 09:47:01 +0000 Received: from forwardcorp1b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:df01]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wMjhZ-00000000BLH-3AEX for pgsql-hackers@postgresql.org; Tue, 12 May 2026 09:47:00 +0000 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id DFEE980752; Tue, 12 May 2026 12:46:53 +0300 (MSK) Received: from smtpclient.apple (unknown [2a02:6bf:8080:c5f::1:4]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp) with ESMTPSA id mkGZGs1MCmI0-bQWiJzk7; Tue, 12 May 2026 12:46:53 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1778579213; bh=wrGYdqbVHdbc46oMYzHdrlwFDCuEpOY5lvHAZoX3lkI=; h=Message-Id:To:Date:References:Cc:In-Reply-To:From:Subject; b=OXGHYrhPVVSw/Swp6Bvc3/nU5JOb/8WVtti0DdjOyD1bFFJC7PgGveqkvruGQ71kf nttpdQy/Qd7KbMX8feEr6ijG8Jd262Vp9hX1T7XaoEpYy4pN0ABe8WW6nubsRNgSUo FDVKRxJfOx2z6bcgFXGQvnXXttGG8x1s68h7WCwQ= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.500.181\)) Subject: Re: Feature: Use DNS SRV records for connecting From: Andrey Borodin In-Reply-To: <8398C22D-429A-4980-9028-4F941F2B7483@yandex-team.ru> Date: Tue, 12 May 2026 14:46:38 +0500 Cc: Tom Lane , Feike Steenbergen , PostgreSQL mailing lists , Andres Freund Content-Transfer-Encoding: quoted-printable Message-Id: <0682441F-1AB2-434C-B785-741EEC614FF0@yandex-team.ru> References: <7386.1565707387@sss.pgh.pa.us> <20190814180143.62533ohqlaqcl7so@alap3.anarazel.de> <8398C22D-429A-4980-9028-4F941F2B7483@yandex-team.ru> To: Jacob Champion X-Mailer: Apple Mail (2.3864.500.181) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi hackers! > On 22 Apr 2026, at 14:48, Andrey Borodin wrote: >=20 > I'm proposing this across the PostgreSQL driver ecosystem While preparing equivalent patches for pgx, pgjdbc and npgsql, Jack Christensen (pgx maintainer) raised a concern [0] about the postgres+srv:// URI scheme I proposed here. The issue is specific to Go's net/url package [1]. In Go 1.26 the URL parser was tightened and broke parsing of HA connection strings of the form postgresql://user@h1:1,h2:2/db (colons inside the authority after a comma). The Go team addressed this by relaxing validation, but only for the "postgres" and "postgresql" schemes - any new scheme, including "postgres+srv", gets the strict modern parser. For a single SRV name in the authority this is probably fine in practice, but Jack reasonably points out that deviating from postgresql:// is a compatibility bet without much upside. [2] Per RFC 3986 =C2=A73.1 the "+" in a scheme name is syntactically legal. Per RFC 7595 / BCP 35, schemes can be registered with IANA, but neither "postgresql" nor "mongodb+srv" is in the IANA registry today, so there is no formal gate to pass - just our own consensus on what to ship. On a related note, "mongodb", "redis" and "rediss" (Redis over TLS) are both registered with IANA as provisional schemes, while "mongodb+srv" is not - so there is no consistent precedent either way. Given the above, I see three options: 1. Drop the +srv URI scheme entirely. Keep only the srvhost=3D keyword parameter. Smallest API surface, no compatibility concerns for any driver. No URI form to use DNS SRV at all. srvhost=3Dcluster.example.com dbname=3Dmydb = target_session_attrs=3Dread-write 2. Keep postgresql+srv:// / postgres+srv:// as proposed. Aligns with the mongodb+srv:// precedent and reads naturally; a single cluster name in the authority is unaffected by Go's stricter parser, but driver authors take on a small risk for any future tightening. = postgresql+srv://user@cluster.example.com/mydb?target_session_attrs=3Dread= -write postgres+srv://user@cluster.example.com/mydb 3. Some other shorthand (pgsrv://). Avoids "+" entirely but invents yet another name with no clear advantage. = pgsrv://user@cluster.example.com/mydb?target_session_attrs=3Dread-write My slight preference is (1). The srvhost=3D parameter alone expresses intent unambiguously and avoids opening a second scheme namespace that every driver in the ecosystem would need to replicate. If we go with option (2), registering "postgresql+srv" as a provisional scheme with IANA (First Come First Served per RFC 7595 =C2=A77.1) would take minimal effort and give the scheme a stable reference. Interestingly, even "postgresql" itself is not in the IANA registry despite being in use for over 20 years, so registration is not a prerequisite =E2=80=94 but it would be a nice step toward = treating SRV as a first-class URI scheme on par with mongodb+srv. On the other note "redis" and "rediss" are both provisioned with IANA. WDYT? Best regards, Andrey Borodin. [0] https://github.com/jackc/pgx/pull/2538 [1] https://github.com/golang/go/issues/75859 [2] https://github.com/jackc/pgx/issues/2404=