-
Notifications
You must be signed in to change notification settings - Fork 262
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
allow to rollback a transaction gracefully #500
Comments
That's a great idea! |
@Newbie012 To achieve this effect with current functionality, you can just execute tx`ROLLBACK;` inside the transaction. You'll see this warning when the transaction attempts to commit: {
severity_local: 'WARNING',
severity: 'WARNING',
code: '25P01',
message: 'there is no transaction in progress',
file: 'xact.c',
line: '3898',
routine: 'EndTransactionBlock'
} but it's harmless. To avoid this message, if you are using Postgres 12 , you can simply run: tx`ROLLBACK AND CHAIN;` Which will immediately start a new transaction after the other is rolled back. |
Thanks @apjoseph I'm not in a hurry, so I guess I'll wait for official implementation. Thanks again for the workaround! 🙂 |
Currently, there's no way to roll back a transaction without throwing an exception inside of it.
I was hoping for something like
sql.rollback()
The text was updated successfully, but these errors were encountered: