Re: [NOVICE] Why psql connection assumes default database name asthe username
От | hubert depesz lubaczewski |
---|---|
Тема | Re: [NOVICE] Why psql connection assumes default database name asthe username |
Дата | |
Msg-id | 20170324085758.GA6674@depesz.com обсуждение исходный текст |
Ответ на | Re: [NOVICE] Why psql connection assumes default database name as the username (Neha Khatri <nehakhatri5@gmail.com>) |
Ответы |
Re: Why psql connection assumes default database name as the username
|
Список | pgsql-novice |
On Fri, Mar 24, 2017 at 08:39:30AM +0000, Neha Khatri wrote: > Yes, so psql should say "Not sure which database to connect to. Please > specify a valid database name using -d option". > For backwards compatibility, psql can still attempt to connect to db with > name same as the username, but the error message could be more like > providing the information, what can be done next. Sorry, but I don't agree. I use databases named like users all the time, and love the fact that I don't have to provide dbname when it's obvious. Error message is, in my opinion, clear enough - you're trying to connect to database that doesn't exist. Why you are trying to - impossible to tell. Maybe you made a typo. Maybe you forgot to add option. Maybe you forgot to export env variable. What is being chosen as user/database name is documented in psql docs. Additionally - if you want to require that user provides database name, why don't require also host and port? After all, you need all four parameters to connect: host, port, username and database name. If all you ever want is to connect to db named "x", then why not using psql -d x, or even setting PGDATABASE to x? depesz
В списке pgsql-novice по дате отправления: