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

Database name should be given to psql #236

Closed
gleu opened this Issue Nov 13, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@gleu

gleu commented Nov 13, 2016

When one use the -U command line option, the import_all.sh script uses it when it calls psql to check if the schema's owner exists. Unfortunately, it doesn't specify the database name. So, psql will use the username as the database name and if a database of that name doesn't exist, it will exit with an error.

This is on line 209 of the import_all.sh script.

@gleu

This comment has been minimized.

Show comment
Hide comment
@gleu

gleu Nov 13, 2016

BTW, this report comes from a thread on the french web forum: http://forums.postgresql.fr/viewtopic.php?pid=24261#p24261

gleu commented Nov 13, 2016

BTW, this report comes from a thread on the french web forum: http://forums.postgresql.fr/viewtopic.php?pid=24261#p24261

@darold

This comment has been minimized.

Show comment
Hide comment
@darold

darold Nov 13, 2016

Owner

In this case I think the -U option need to be removed. The owner of the database must be set using the -o option and if the script is run as postgres user the problem will not appears. The other solution is to create the default database for the connection user. But here I think there is a confusion between the connection user and the owner of the database. There is no parameter to set a different connection database.

I will answer to the french forum.

Thanks.

Owner

darold commented Nov 13, 2016

In this case I think the -U option need to be removed. The owner of the database must be set using the -o option and if the script is run as postgres user the problem will not appears. The other solution is to create the default database for the connection user. But here I think there is a confusion between the connection user and the owner of the database. There is no parameter to set a different connection database.

I will answer to the french forum.

Thanks.

@gleu

This comment has been minimized.

Show comment
Hide comment
@gleu

gleu Nov 13, 2016

Well, if you offer those options, they should work whatever happens or at least have a more adequate error message. What he tries to do looks sane to me.

gleu commented Nov 13, 2016

Well, if you offer those options, they should work whatever happens or at least have a more adequate error message. What he tries to do looks sane to me.

@SebAlbert

This comment has been minimized.

Show comment
Hide comment
@SebAlbert

SebAlbert Nov 18, 2016

Contributor

Maybe the environment variables PGDATABASE and PGUSER can help here. See https://www.postgresql.org/docs/9.6/static/libpq-envars.html

Contributor

SebAlbert commented Nov 18, 2016

Maybe the environment variables PGDATABASE and PGUSER can help here. See https://www.postgresql.org/docs/9.6/static/libpq-envars.html

@darold darold closed this Dec 24, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment