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

ROLLBACK when commit on failed transaction? #1968

Closed
1 of 2 tasks
IvyDev0 opened this issue Nov 19, 2020 · 1 comment
Closed
1 of 2 tasks

ROLLBACK when commit on failed transaction? #1968

IvyDev0 opened this issue Nov 19, 2020 · 1 comment

Comments

@IvyDev0
Copy link
Contributor

IvyDev0 commented Nov 19, 2020

I'm submitting a ...

  • bug report
  • feature request

Describe the issue
commit() doesn't throw any exceptions/rollback when the transaction has failed

Driver Version?
REL42.2.9

Java Version?
11

PostgreSQL Version?
10.7

To Reproduce

connection.setAutoCommit(false); // start transaction
execute("SELECT pg_sleep(20)")); // our timeout here is set to 10, so we got "canceling statement due to user request", expected
execute("SELECT 0")); // since the last statement failed, here we got "current transaction is aborted", expected

connection.commit(); // it finished without any exceptions. 
  1. Shouldn't the driver ROLLBACK if there's an error? (I couldn't find anything about it in the code)
  2. Why can I still commit?

Or it's designed to let the users to rollback ourselves?

Thanks.

@davecramer
Copy link
Member

See CHANGELOG for 42.2.11 https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md and #1729

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

No branches or pull requests

2 participants