pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: vlsi (@vlsi) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection
Date: Fri, 07 Feb 2025 09:39:08 +0000
Message-ID: <[email protected]> (raw)

**Describe the issue**

See https://github.com/pgjdbc/pgjdbc/pull/3506.

For monitoring and debugging purposes it might be helpful to identify the URL for a given connection.
It might be tempting to expose `#getHost`, `#getPort` or `#getHostPort`, however, there might be cases like a connection over unix domain socket [which have no host and port parts](https://github.com/pgjdbc/r2dbc-postgresql/issues/181#issuecomment-1404648223).

We might expose something like `URI PGConnection#getServerUri()`, however, it looks like there's no canonical way to map domain sockets to URL/URI: https://github.com/whatwg/url/issues/577

So we might be better to expose interface like `interface ConnectionSpec { String toString(); }` with a default implementation that we ship for regular socket connections like `interface InetAddressConnectionSpec implements ConnectionSpec { ..getHost(); getPort(); }`.

view thread (8+ 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] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection
  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