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 1wMpec-000NYn-2G for pgsql-hackers@arkaria.postgresql.org; Tue, 12 May 2026 16:08:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wMpeZ-0058pz-2t for pgsql-hackers@arkaria.postgresql.org; Tue, 12 May 2026 16:08:16 +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 1wMpeZ-0058pr-1V for pgsql-hackers@lists.postgresql.org; Tue, 12 May 2026 16:08:15 +0000 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wMpeV-00000000E82-1rjF for pgsql-hackers@postgresql.org; Tue, 12 May 2026 16:08:13 +0000 Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-8b98482b253so77384876d6.1 for ; Tue, 12 May 2026 09:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1778602091; cv=none; d=google.com; s=arc-20240605; b=lCKNAbvxEO/Hibx5Djys6qGQHatBwDPJcbSYsUgloIlURNX3RgHEueIbf2VDtWCL/E 6D97Lj8AUJho3Ybi40KYqoCppB6GbCsgcX/lDTFv0pUXqWxig+4KN1upAnhIT4//NFzO XYHZyzwxi43qDct2Lg/HRaUXW/Y9y1MsAi12QqE0id4WTxznu1B9xddYN3h3e3oohjOv Kyh3IkonDJnfigksbr+JlpIPqgSWh8O0VzthEfinESIKRAF0sHR8Fe5yvxZOtK5vPGa7 W7/aSFxST9EYJr08NBVRyQjnjk4kkZLPUeHnQ7D5m4tGlXjyNCBzRLAXUK/Wh09m2xxr pANA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IJg5FZZxo5pLAFn8h66AEj/XSiHNLjfdL+4pveihXEk=; fh=DStlgWPGJj3ZQziI7JJ6NHmo1ixiiSjfi/YEYmu7T5E=; b=dXHxShDmUerkB50jTnNi6LzUoSUWSlyDGhBKb5OglxxxOaAreb4yH0TOccSLS8jX8x prc2s8jszhoTIjPQGHrLSWF73ntPnHku+uk9Q7JJvvvXE4M4ALDEcXU1ktR3TPyDNBx0 f5Rbg+uFMjXhIMUwqrZFEg4+8ml7s4NSJ8E1Pep5pY+ifLQBi/uKDjvidM3llz7VCMK6 lDiiUWcLHk4IT+rUTeT+9LhQiTTT6NTbF4WW9SoGOwrhDydODamajm6CXZ5PGKKciwaJ svfZyT3K0QjNQMOwWebk9CgxYNoGkjXC2foPEV92ECotnYJaSVEnMGSdGnRzd3OAcNe+ FfVA==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1778602091; x=1779206891; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IJg5FZZxo5pLAFn8h66AEj/XSiHNLjfdL+4pveihXEk=; b=YS8ksT+HQtLKmaYh9x8VFXApSP5cAKbZAnnsZxdtDodxvUjDcTrz98T3t26XhDQxBZ nYBoOt/J/sldqz91E8YIyDkFVdX8KMZvwniYLhTk0bt7Qs6iseL+5dUCbNc5UG3SPLJ8 Oj3t55u9lbi34Lu+e9AiocpYKhTZmaxEF3m+0CYqJtoldmttL5NcxZZX0go5cMP0JQQy NO0ctSC215sE2y39OgEzGRcXVTEwjz2Ug52jdL2xJufsawPYaX9jsyBOEyVsSige0oAJ /GUWtQqk+1o+hNFZ2/85OQLdBxx/IFtkQikuz9Vie1mAmSENIlIwyAzLZHNIlEOniy8n PzyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778602091; x=1779206891; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=IJg5FZZxo5pLAFn8h66AEj/XSiHNLjfdL+4pveihXEk=; b=fTubPfJNjoosq763viaAdyqFfZbixmfG5bPIXWly+qNE60D2EDfacMNxQi8/0IjYya LXAzvNUv6oDUO0STdELEYyqTVN/yZV0NXDwVVzZ/6VYwxf7p+SM+UaIFL6vsCapTeNtW XT70iAdKcuaiHhi6PCTyYvOqqHBC6ZOquOB6cCG0UwEVs0KknxyUJes2FqtZDRLcqN+z Ft64hjONr9f36YPXRZlWsFalTpSMr0cyaF+OrcFrK/x5yWyasPutGTvaMVOXEzu+Am0u 24alHCv/lTlaEySSpsCvEeZUWGWfkY6tCkDNpTXTsfD/9IhP5IaiMLNpvuUNOrTR2YCQ jAuA== X-Forwarded-Encrypted: i=1; AFNElJ83EdYEWrgfX7J1NXTdURQm/HN07DDVZPVBOLXACnn115T6hJzb6t9b87TPAmRHF/JtvPE1kC2PIV5zOb+d@postgresql.org X-Gm-Message-State: AOJu0YzHvMxw35L4PLT1hvP3uZRAMBy1ZNRl4IbPDGzmNUK4d7cZCCjK bTeCeyb1z8Lw2OmOerWxnq9hyQhK02mvXU5+m8A/6nYxd6+/wJRJLVFPV4En+dnmxkBX59CPdpK EGAAsEbRQHdOULrOc+DxmMjePym4qtlx/5w7IwfP5 X-Gm-Gg: Acq92OE00YpQgXaLq9HRv4fKKft/cYVK8HnIeudWmspJExO3z4TMSjjrRvXEpL/6Cjm HanYs2NZ35Y87slH1J6MvXqDUjaEfWDZk3Xahv6TNzp7DjJStqBNpEbSv1tcogp+lvoP0erQf5h 8+pEDJi/7uW7DJYCIP/P9rYKRTzpG21T69AOq6clx3fbzb1E+Wana4hE54zEQy3aOxY2j56IVGh 0v4Q7cSlagxs6QxK/Up/z9W+FXccraLQPwUyiJZ/M0ugFF2+F+LozY5SPt9gJNVccmLWYPdM3QN D333RPNmhA== X-Received: by 2002:a05:6214:5f12:b0:8ba:2c02:f9d6 with SMTP id 6a1803df08f44-8c663b89d2emr56522066d6.35.1778602090550; Tue, 12 May 2026 09:08:10 -0700 (PDT) MIME-Version: 1.0 References: <7386.1565707387@sss.pgh.pa.us> <20190814180143.62533ohqlaqcl7so@alap3.anarazel.de> <8398C22D-429A-4980-9028-4F941F2B7483@yandex-team.ru> <0682441F-1AB2-434C-B785-741EEC614FF0@yandex-team.ru> In-Reply-To: <0682441F-1AB2-434C-B785-741EEC614FF0@yandex-team.ru> From: Jacob Champion Date: Tue, 12 May 2026 09:07:59 -0700 X-Gm-Features: AVHnY4IJywzv-8NmHUIZrWyCZlZmN5zJjnh87UuybZL2J70qjSma2xGg4EYriz4 Message-ID: Subject: Re: Feature: Use DNS SRV records for connecting To: Andrey Borodin Cc: Tom Lane , Feike Steenbergen , PostgreSQL mailing lists , Andres Freund Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello! I'm speaking only on the design questions here; I have not looked at the patch implementation yet. On Tue, May 12, 2026 at 2:47=E2=80=AFAM Andrey Borodin wrote: > 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] So this doesn't answer your broader question, really, but I consider it a Very Good Thing that Go is enforcing stricter validation. If we choose to introduce a brand-new scheme, I think we should do it by the book and not carry over our oddities from 2012. > 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. As a continuation of the above, I think it'd be good to ask for IETF review on any new scheme. The [scheme]+[variant]: form has some uptake, but there are also expert reviewer notes saying that some attempts might make things difficult for implementers (or others in the ecosystem). > 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. Either way, we'll need to define the semantics of mixing this new mode with the existing parameters. I think that's likely to introduce its own subtle compatibility concerns if we don't design it up front. (Your proposal doesn't introduce this problem, but we never should have allowed query parameters to modify the prior components -- scheme, authority, path -- of the URI. I am strongly motivated to fix that, though I don't really want to derail SRV conversations too much with it.) > 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. Can you elaborate on the additional risk? IMO, if a URI identifies a single resource (the cluster), it doesn't seem like anyone needs to support our comma pseudo-syntax anymore. Drivers that want to connect to multiple clusters can take multiple fully formed URIs, and define how to configure that in a way that makes sense for them. > 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-wr= ite I guess I don't see what this accomplishes. The `+` is not the problem, rig= ht? -- I would additionally propose options 4 and 5 (which you don't need to feel obligated to give any thought to): 4. Use the new behavior opportunistically somehow, similar to how https: has continued to evolve the underlying protocol and DNS lookup without any scheme changes at all. Whether this is technically feasible without usability and security concerns... I don't know at this point. 5. Moonshot: break compatibility outright, and design a scheme that does exactly what we want in 2026. Strong URI semantics, enforcement of TLS, useful DNS semantics, etc., etc. Represents complete derailment of the thread. :) Thanks, --Jacob