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

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: Evgeny Kuzin <evgeny(dot)kuzin(at)outlook(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] libpq: try all addresses for a host before moving to next on target_session_attrs mismatch
Date: 2026-03-11 18:26:14
Message-ID: CAKAnmmLXvBS1YTOeR=df3e7e+VMzG-y-_MZ7e+_E_T5pDc8QSA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 11, 2026 at 10:29 AM Evgeny Kuzin <evgeny(dot)kuzin(at)outlook(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2026-03-11 18:29:47 Re: Defend against -ffast-math in meson builds
Previous Message Jeff Davis 2026-03-11 18:20:05 Re: Change initdb default to the builtin collation provider