Re: [PATCH] libpq: try all addresses for a host before moving to next on target_session_attrs mismatch

Greg Sabino Mullane <htamfids@gmail.com>

From: Greg Sabino Mullane <htamfids@gmail.com>
To: Evgeny Kuzin <evgeny.kuzin@outlook.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>, Tom Lane <tgl@sss.pgh.pa.us>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-11T18:26:14Z
Lists: pgsql-hackers
On Wed, Mar 11, 2026 at 10:29 AM Evgeny Kuzin <evgeny.kuzin@outlook.com>
wrote:

> A refinement: what if we only change behavior when target_session_attrs is
> explicitly set to something other than any?
>

-1. That seems to complicate things further, and still doesn't make our
code match our docs

resolving to both "127.0.0.1" and "::1",


Bit of a contrived case, but I'm not really seeing the problem here. It's
certainly possible for postgres to be listening on one and not the other,
and if you want to connect to a specific one, then call it out by name.
Otherwise, they all get tried, which is the whole reason the Internet has
those one to many mappings. To give up after the first one fails seems
inherently wrong.

Cheers,
Greg

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. libpq: Add target_session_attrs parameter.