pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: Squiry (@Squiry) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] PR #3012: Support multiple hosts defined with single hostname
Date: Tue, 28 Nov 2023 16:41:40 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>

(on pgjdbc/src/main/java/org/postgresql/hostchooser/HostChooserFactory.java:45)

So, [libpq](https://github.com/postgres/postgres/blob/master/src/interfaces/libpq/fe-connect.c#L3967) looks at provided hosts as a single backend per host: if it connects to any address of provided host and finds out it is not in a desired state it rejects the host and doesn't even bother try next addresses.

Golangs [pgx](https://github.com/jackc/pgx/blob/master/pgconn/pgconn.go#L147) treats every address as a separate instance and tries them all, only stops on auth errors. That behavior would be more preferred for me as I have case for single hostname backed with addresses for every db instance.

Error propagation becomes more interesting anyway, because connecting to something like localhost will throw some interesting exceptions like `Could not find a server with specified targetServerType: any` instead of auth errors, but it can be fixed.

view thread (15+ messages)  latest in thread

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: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] PR #3012: Support multiple hosts defined with single hostname
  In-Reply-To: <<[email protected]>>

* 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