r2dbc / r2dbc-pool

Connection Pooling for Reactive Relational Database Connectivity
https://r2dbc.io
Apache License 2.0
331 stars 55 forks source link

Cannot unwrap a PooledConnection as the class is package protected #201

Open gpaglia opened 9 months ago

gpaglia commented 9 months ago

Bug Report

PooledConnection should be public or some other ways of unwrapping a PooledConnection to get the underlying technology-specific connection should be provided.

For example, if PooledConnection wraps a PostgresqlConnection, one needs to unwrap the PooledConnection to get the PostgresqlConnection to execute postgres-specific operations like LISTEN and NOTIFY.

In the documentation I dind't find any hints on how to resolve.

Versions

Current Behavior

To work around this, I created a public utility class in the io.r2dbc.pool package with a public method tht calls the PooledConnection#unwrap method.

mp911de commented 9 months ago

That shouldn't be necessary when calling Wrapped.unwrap(PostgresqlConnection.class). The unwrapping mechanism will unwrap the inner wrapped elements until it can return PostgresqlConnection.

gpaglia commented 9 months ago

Thanks, will try it.