public inbox for [email protected]  
help / color / mirror / Atom feed
From: Zsolt Parragi <[email protected]>
To: Andrey Borodin <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Feike Steenbergen <[email protected]>
Cc: PostgreSQL mailing lists <[email protected]>
Subject: Re: Feature: Use DNS SRV records for connecting
Date: Tue, 12 May 2026 22:05:45 +0100
Message-ID: <CAN4CZFOjC2GA55t075OzWZYbRmTt6+bWrLA0=sM_tuQUW9A2_A@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAK_s-G2_3S09_EA+nRxxefMW+0-UwKE=Uj6bCdBpPncPVRpM_g@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>

Hello!

Shouldn't srvhost be freed in freePGconn?

+ /*
+ * If srvhost is set, validate mutual exclusivity with host/hostaddr and
+ * then resolve _postgresql._tcp.<srvhost> SRV records, populating
+ * conn->pghost and conn->pgport from the sorted results.  This must
+ * happen before the host-array allocation below.
+ */
+ if (conn->srvhost != NULL && conn->srvhost[0] != '\0')

Shouldn't this also cover port? The current behavior with it seems inconsistent.

> The resolved host list is sorted per RFC 2782 and injected into the
> existing multi-host machinery before connhost[] is built, so
> target_session_attrs, load_balance_hosts, and failover work on the
> expanded list without any changes to PQconnectPoll.

Doesn't RFC 2782 specifies a weighted random selection? The current
code seems to be deterministically sorted by weight.
RFC also says that weight=0 should be specially handled, it provides a
detailed algorithm about the random selection method.






view thread (8+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Feature: Use DNS SRV records for connecting
  In-Reply-To: <CAN4CZFOjC2GA55t075OzWZYbRmTt6+bWrLA0=sM_tuQUW9A2_A@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox