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

How to rollback a transaction #82

Open
lpil opened this issue Jun 30, 2024 · 1 comment
Open

How to rollback a transaction #82

lpil opened this issue Jun 30, 2024 · 1 comment

Comments

@lpil
Copy link
Contributor

lpil commented Jun 30, 2024

Hello!

How should one rollback a transaction? It looks like it'll roll back if the callback function crashes, but I wasn't sure what the recommendation was otherwise.

Is running pgo:query("rollback") appropriate?

Thanks,
Louis

@tsloughter
Copy link
Collaborator

Hey, sorry. Running pgo:query("rollback") is appropriate if you are in a pgo:transaction since then it'll use the same connection. If you ran begin with pgo:query you'd end up getting a different connection and it would not work.

I finally exported pgo:query/4 so you can pass a conn to query #95

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