pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection
8+ messages / 2 participants
[nested] [flat]

* [pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection
@ 2025-02-07 09:39  "vlsi (@vlsi)" <[email protected]>
  0 siblings, 0 replies; 8+ messages in thread

From: vlsi (@vlsi) @ 2025-02-07 09:39 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

**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(); }`.

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection
@ 2025-02-10 07:43  "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: robert-mirzakhanian (@robert-mirzakhanian) @ 2025-02-10 07:43 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

What do you think about such a structure?
ConnectionSpec
```
public interface ConnectionSpec {
  String getConnectedAddress();
}
```
InetAddressConnectionSpec
```
public interface InetAddressConnectionSpec extends ConnectionSpec {

  String getHost();

  int getPort();

  @Override
  default String getConnectedAddress() {
    return getHost().concat(":").concat(String.valueOf(getPort()));
  }
}
```
and implement InetAddressConnectionSpec from HostSpec
`public class HostSpec implements InetAddressConnectionSpec`

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection
@ 2025-02-12 04:22  "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: robert-mirzakhanian (@robert-mirzakhanian) @ 2025-02-12 04:22 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

@vlsi what do you think about this?

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection
@ 2025-02-20 20:42  "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: robert-mirzakhanian (@robert-mirzakhanian) @ 2025-02-20 20:42 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

@vlsi Привет. Я сделал изменения связанные с добавлением ConnectionSpec. Как будет время, глянь пожалуйста
https://github.com/robert-mirzakhanian/pgjdbc/tree/add-connection-spec

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection
@ 2025-02-23 19:45  "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: robert-mirzakhanian (@robert-mirzakhanian) @ 2025-02-23 19:45 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Нашел в api у PgConnection [метод](https://github.com/pgjdbc/pgjdbc/blob/ddb71441b26af63df7ced9af35da0542d0500c40/pgjdbc/src/main/java/...) который возращает до QueryExecutor, а у QueryExecutor есть метод чтобы получить HostSpec. 
Думаю issue больше не актуаьно

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection
@ 2025-02-24 05:57  "vlsi (@vlsi)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: vlsi (@vlsi) @ 2025-02-24 05:57 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

@robert-mirzakhanian , `PgConnection` и `QueryExecutor` это **не** public api.
public api это `org.postgresql.PGConnection`

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection
@ 2025-02-24 06:00  "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: robert-mirzakhanian (@robert-mirzakhanian) @ 2025-02-24 06:00 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

> @robert-mirzakhanian , `PgConnection` и `QueryExecutor` это **не** public api.
> public api это `org.postgresql.PGConnection`

🥲 грустно. 
@vlsi, Подскажи пожалуйста, что надо сделать чтобы ты смог посмотреть изменения связанные с ConnectionSpec? Мне лучше принести PR?

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection
@ 2025-03-05 13:36  "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: robert-mirzakhanian (@robert-mirzakhanian) @ 2025-03-05 13:36 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

@davecramer может быть ты сможешь мне помочь?

^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2025-03-05 13:36 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-07 09:39 [pgjdbc/pgjdbc] issue #3514: Add PGConnection#getHost, PGConnection#getPort so clients could identify the current host for each connection "vlsi (@vlsi)" <[email protected]>
2025-02-10 07:43 ` "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>
2025-02-12 04:22 ` "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>
2025-02-20 20:42 ` "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>
2025-02-23 19:45 ` "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>
2025-02-24 05:57 ` "vlsi (@vlsi)" <[email protected]>
2025-02-24 06:00 ` "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>
2025-03-05 13:36 ` "robert-mirzakhanian (@robert-mirzakhanian)" <[email protected]>

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