Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unwrap Savepoint objects when passing them in as parameters. #331

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

karenc-bq
Copy link
Contributor

@karenc-bq karenc-bq commented Feb 3, 2023

Summary

fix: unwrap Savepoint objects when passing them in as parameters.

Description

Fixes #328

SavepointWrappper objects are passed to ConnectionWrapper#*rollback(final Savepoint savepoint) as parameters, which are then passed to the target driver's rollback methods.

PGJDBC internally explicitly casts the Savepoint parameter to an internal object: https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java#L1836

PSQLSavepoint pgSavepoint = (PSQLSavepoint) savepoint;

Since the driver passed in a SavepointWrappper object, this line in pgjdbc will throw a ClassCastException.

The only solution is to unwrap the Savepoint object before passing it in.

Additional Reviewers

@joyc-bq
@aaronchung-bitquill

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@karenc-bq karenc-bq self-assigned this Feb 3, 2023
@davecramer
Copy link
Contributor

are there any others ?

@karenc-bq
Copy link
Contributor Author

are there any others ?

Haven't found any others yet.

@karenc-bq karenc-bq merged commit d11a866 into aws:main Feb 3, 2023
@karenc-bq karenc-bq deleted the savepoint_exception branch February 3, 2023 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rollback to or release of savepoint fails with ClassCastException
4 participants