-
Enhancement
-
Resolution: Obsolete
-
Major
-
None
-
False
-
-
False
What Debezium connector do you use and what version?
2.6.2-Final
Feature request or enhancement
The Postgres Debezium connector allows the use of a custom connection factory that must implement the io.debezium.jdbc.JdbcConnection.ConnectionFactory interface. This interface contains a single method with the signature: Connection connect(JdbcConfiguration config) throws SQLException. Therefore, the custom factory should return a java.sql.Connection object.
However, within its internal code, the Debezium Postgres connector casts this connection to either org.postgresql.jdbc.BaseConnection or, more problematically, to org.postgresql.jdbc.PgConnection. This casting behavior, particularly to PgConnection, prevents the use of a custom connection wrapper in the connection factory, as PgConnection has only one public constructor, which immediately establishes a connection to Postgres. You can review this behavior in the connector's GitHub repository (github link).
Which use case/requirement will be addressed by the proposed feature?
Using custom connection factory
Implementation ideas (optional)
io.debezium.connector.postgresql.connection.PostrgesConnection should rather call Connection.unwrap(<target class>).