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

Connect to default database to find all databases #211

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

codemonium
Copy link
Contributor

The psql call for finding all databases (which happens when DB_NAME is ALL or SPLIT_DB is FALSE) fails if DB_USER is not an existing database. This change stops using DB_USER for the -d option.

If you run psql without specifying -d/--dbname, it uses postgres by default, going so far as to raise an error if it is missing:

/ # psql -U postgres
psql: error: FATAL:  database "postgres" does not exist

I think it makes sense to use the same assumption for the psql call mentioned above.


For users who don't have the default postgres database in their cluster, we could add a new configuration option DB_SOMETHING_OR_OTHER that would be postgres by default. What do you think?


This may close #196.

The psql call for finding all databases (which happens when DB_NAME is
ALL or SPLIT_DB is FALSE) fails if DB_USER is not an existing database.
This change stops using DB_USER for the -d option.

If you run psql without specifying -d/--dbname, it uses "postgres" by
default, going so far as to raise an error if it is missing:

    / # psql -U postgres
    psql: error: FATAL:  database "postgres" does not exist

I think it makes sense to use the same assumption for the psql call
mentioned above.
@codemonium
Copy link
Contributor Author

@tiredofit is there anything else I need to do to get this merged?

@tiredofit
Copy link
Owner

Hi @codemonium - My apologies on the silence. I haven't had much time to look into much things for db-backup lately as I wanted to rewrite the tool. That release is imminent and I am now reviewing the PRs. This sounds similar to our DB_AUTH command which allows you to select an Authentication database first. Can you check to see if #262 solves this as well? There has been a PR that matches some of the work done for MongoDB moved over to PSQL recently that enables this function..

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.

Logic Uses Username as a DB name
2 participants