Skip to content
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

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

dbaty
Copy link
Member

@dbaty dbaty commented Nov 2, 2023

…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
Copy link
Member

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...

Copy link
Member Author

@dbaty dbaty Nov 3, 2023

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 setting destructive_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?

Copy link
Member

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

@laixintao
Copy link
Member

Thanks for the contribution! others are good ❤️

@laixintao laixintao merged commit c516028 into main Nov 3, 2023
4 checks passed
@laixintao
Copy link
Member

Merged and do you want to change the doc in pgcli as well? @dbaty thanks!

@dbaty
Copy link
Member Author

dbaty commented Nov 3, 2023

@laixintao : Oops, you merged my initial proposal, not the "better" one. :) I made a follow-up pull request with that better description: #60 .

@laixintao
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants