Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Check if a password already was prompted #354

Merged
merged 1 commit into from
Jun 14, 2023
Merged

Conversation

za-arthur
Copy link
Collaborator

@za-arthur za-arthur commented May 31, 2023

This fixes infinite loop in case of an empty password.
The issue #299.

There is another PR #303 which fixes the issue. But it adds another infinite loop and it isn't consistent with the behavior when a user inputs wrong password.

In case of a wrong password pg_repack throws an error like:

ERROR: could not connect to database: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL:  password authentication failed for user "repack_user"

and it doesn't go to another loop and doesn't ask for another password.

In case of an empty password with this PR pg_repack will throw an error like:

ERROR: could not connect to database: connection to server on socket "/tmp/.s.PGSQL.5432" failed: fe_sendauth: no password supplied

Raising an error on empty password is consistent with other tools like psql.

This fixes infinite loop in case of an empty password.
Issue #299.
@andreasscherbaum
Copy link
Collaborator

Does this need a test to make sure it works in the future?

@za-arthur
Copy link
Collaborator Author

It would be a bit tricky to create a test because I'm not sure how to provide a password to pg_repack in tests. It expects a user input.
AFAIK using pipe like the following doesn't work:

echo "test" | pg_repack ...

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

Successfully merging this pull request may close these issues.

2 participants