-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Closing prepared statement after error in nested transaction prevents transaction rollback in v0.1.6 #49
Comments
The problem seems to be that when we open a Tx, go will reuse an existing connection (https://github.com/golang/go/blob/release-branch.go1.20/src/database/sql/sql.go#L1302) and never release it, since there was no commit nor rollback in this scenario. Then, when we call I'm not sure how to solve this problem though. Another way to reproduce it:
After step 4, the transaction will still be alive. |
Same issue here with v0.1.6, we have to rollback to v0.1.5 |
Hi, not using go for over few years now, would be really helpful if someone could resolve the issue and raise a pull request with a test to prevent regression. |
@stefafafan Any luck on this issue? If you are too busy I can also take a look |
@Yiling-J I took a look at this just a little, but got a bit busy with other stuff. It will help if you would be able to take a look at it too, thanks! |
@ahobson I've merge PR to the main branch that I think might fix the bug. Could you please run your tests against it and let me know if you still see the issue? |
@Yiling-J Thank you! I tried it with our application and the tests that used to fail with |
@Yiling-J If you don't mind, let me know when you get a chance to make a release with this fix. Thanks again! |
@ahobson v0.1.7 released |
First of all, thank you for go-txdb! It's been a huge help for us testing our project.
v0.1.6 introduced some new behavior that I believe to be a bug. The following test passes on v0.1.5 but not v0.1.6. When using postgresql, it fails. It seems closing a prepared statement automatically rolls back the nested transaction?
I took a look at the changes in v0.1.6 and wasn't able to untangle the behavior, but I was hoping this test case might help someone else figure it out.
Please let me know if I can provide any more information.
The text was updated successfully, but these errors were encountered: