-
Notifications
You must be signed in to change notification settings - Fork 22
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
config: Mention destructive_warning_restarts_connection
and destructive_statements_require_transaction
options
#59
Conversation
…ctive_statements_require_transaction` options
@@ -42,6 +42,16 @@ multi_line_mode = psql | |||
# or "shutdown". | |||
destructive_warning = True | |||
|
|||
# Destructive warning can restart the connection if this is enabled and the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't quite understand this line:
Destructive warning can restart the connection...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not write this doc nor the corresponding feature, I merely copy-pasted it from the pgclirc
file in the pgcli project: https://github.com/dbcli/pgcli/blob/04ca41a26259a83ebc027e8d16e4a63856ec6055/pgcli/pgclirc#L36-44.
This option is used here in pgcli. When a user enters a "destructive" statement (such as an UPDATE
) and the destructive_warning
option is set, the user is asked for confirmation. If the user does not confirm (or if destructive_statements_require_transaction
is set and there is no ongoing transaction), the statement is not sent and the connection is restarted, unless destructive_warning_restarts_connection
is false.
I am not sure how to rephrase it differently (without being as verbose as I am in this comment). Here is a try which clarifies the default behaviour (no reconnection):
When
destructive_warning
is on and the user declines to proceed with a destructive statement, the current transaction (if any) is left untouched, by default. When settingdestructive_warning_restarts_connection
to "True", the connection to the server is restarted. In that case, the transaction (if any) is rolled back.
What do you think: is it clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation! Yes, your comment is more clear for me. thanks
Thanks for the contribution! others are good ❤️ |
Merged and do you want to change the doc in pgcli as well? @dbaty thanks! |
@laixintao : Oops, you merged my initial proposal, not the "better" one. :) I made a follow-up pull request with that better description: #60 . |
Sorry, I thought I was seeing the diffs 😂 thanks again, merged. |
Copied from
pgclirc
file in pgcli project: https://github.com/dbcli/pgcli/blob/04ca41a26259a83ebc027e8d16e4a63856ec6055/pgcli/pgclirc#L36-44