-
Notifications
You must be signed in to change notification settings - Fork 558
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
Refuse to quit cli if a transaction is ongoing. #1400
Refuse to quit cli if a transaction is ongoing. #1400
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1400 +/- ##
==========================================
- Coverage 84.15% 79.42% -4.74%
==========================================
Files 21 25 +4
Lines 2720 3008 +288
==========================================
+ Hits 2289 2389 +100
- Misses 431 619 +188
☔ View full report in Codecov by Sentry. |
@dbaty Thank you for the PR! Very nice work, you went above and beyond, what with the I think I would do things a little differently. If the user tries to quit and a transaction is in progress, I would output a message as follows:
If the user presses It's slightly more complicated to implement, but nicer user experience, because if the user is ok with losing their changes, they can just press What do you think? |
That makes sense. I'll try to implement that next week. |
If user tries to quit the cli while a transaction is ongoing (i.e. begun, but not committed or rolled back yet), pgcli now asks for a confirmation. The user can choose to commit, rollback or cancel the exit. If the user chooses to commit or rollback, we exit only if the commit/rollback succeeds. Fixes dbcli#1071.
fedd7b7
to
5f38269
Compare
Yeah, right. By "next week", I actually meant "within 6 months"... Anyway, it's done. Notes:
I recorded a new demo: |
Hi @dbaty, this looks great, and works as expected. Thanks a lot, great feature! Merging. 🍫 |
Hi everyone 👋. Thank you for this great tool, not sure how I'd get work done without it tbh. I have an issue where pgcli thinks I've started a transaction periodically, when I haven't. Then when I try to exit, it doesn't let me, so I have to do a pkill in another window. It usually happens after I've cancelled a query (with ctrl-c). Is this a known issue? I've searched Github issues and haven't found any mentions of this behavior. If not, I may open one (with more details). I'll see if I can come up with a fix also. I'm using pgcli v4.1.0 |
Hi. Could you please open an issue that details how to reproduce it? Thanks! |
Thanks @dbaty! I've been really busy this past week. I'll open a separate issue with details to reproduce. I'm on pgcli version 4.1.0, so that at least looks up to date. |
Description
If a transaction is ongoing, quitting the cli (with "ctrl-d" or "quit") is not possible anymore. An error message is displayed. The user is forced to commit or rollback the transaction before quitting.
Fixes #1071.
Notes
Checklist
changelog.rst
.[ ] I've added my name to the(I am already in this file.)AUTHORS
file (or it's already there).pip install pre-commit && pre-commit install
), and ranblack
on my code.