Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Features:
* Add cursor shape support for vi mode. When ``vi = True``, the terminal cursor now
reflects the current editing mode: beam in INSERT, block in NORMAL, underline in REPLACE.
Uses prompt_toolkit's ``ModalCursorShapeConfig``.
* Add the option to force-quit pgcli when a transaction is in progress.

4.4.0 (2025-12-24)
==================
Expand Down
4 changes: 3 additions & 1 deletion pgcli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ def _check_ongoing_transaction_and_allow_quitting(self):
while 1:
try:
choice = click.prompt(
"A transaction is ongoing. Choose `c` to COMMIT, `r` to ROLLBACK, `a` to abort exit.",
"A transaction is ongoing. Choose `c` to COMMIT, `r` to ROLLBACK, `a` to abort exit, `force` to exit anyway.",
default="a",
)
except click.Abort:
Expand All @@ -938,6 +938,8 @@ def _check_ongoing_transaction_and_allow_quitting(self):
choice = choice.lower()
if choice == "a":
return False # do not quit
if choice == "force":
return True # quit anyway
if choice == "c":
query = self.execute_command("commit")
return query.successful # quit only if query is successful
Expand Down
Loading