diff --git a/changelog.rst b/changelog.rst index da6c611f1..531844374 100644 --- a/changelog.rst +++ b/changelog.rst @@ -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) ================== diff --git a/pgcli/main.py b/pgcli/main.py index 9ce15135d..713246185 100644 --- a/pgcli/main.py +++ b/pgcli/main.py @@ -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: @@ -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