pgcli
pgcli copied to clipboard
Autocommit
trafficstars
Description
- Toggle autocommit mode using F6 or a config setting.
- When in a transaction, rollback erring queries without aborting the transaction. ('On error rollback'.)
Closes #410. This work is loosely based on PR #917 by Matthieu Guilbert, but attempts to keep things simpler. I'm no PostgreSQL expert, so reviewers are encouraged to look for edge cases that make this simpler approach fall apart.
Checklist
- [x] I've added this contribution to the
changelog.rst. - [x] I've added my name to the
AUTHORSfile (or it's already there). - [x] I installed pre-commit hooks (
pip install pre-commit && pre-commit install), and ranblackon my code. --> I'm getting(no files to check) Skipped. - [x] Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)
Hi @vanviegen , you need this change in test_pgexecute to fix the failing test:
diff --git a/tests/test_pgexecute.py b/tests/test_pgexecute.py
index 7fef4658..882c4845 100644
--- a/tests/test_pgexecute.py
+++ b/tests/test_pgexecute.py
@@ -527,6 +527,12 @@ class VirtualCursor:
self.protocol_error = True
self.protocol_message = "Command not supported"
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_value, exc_tb):
+ return self
+
Please give it a try. I have no permissions to push to your fork.