Re: [NOVICE] Why psql connection assumes default database name as the username - Mailing list pgsql-novice

From Neha Khatri
Subject Re: [NOVICE] Why psql connection assumes default database name as the username
Date
Msg-id CAFO0U+-aL_qGyp97xnMO_D8eHDL2hOVNLJEdg32owj4x=BXr3A@mail.gmail.com
Whole thread Raw
In response to Re: [NOVICE] Why psql connection assumes default database name asthe username  (hubert depesz lubaczewski <depesz@depesz.com>)
Responses Re: [NOVICE] Why psql connection assumes default database name asthe username  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-novice

On Fri, 24 Mar 2017 at 5:25 pm, hubert depesz lubaczewski <depesz@depesz.com> wrote:
On Fri, Mar 24, 2017 at 08:49:11AM +1100, Neha Khatri wrote:
> I had the question specific to above two cases, when the database name is
> not provided. There is no surety of having a database name same as the user
> name. Then why assume the database name and try to connect to it. Is it due
> to legacy reason or due to some common database naming practice?

so what would you prefer to do, as psql, in such case? report error
unconditionally? after all - if user didn't provide db name, and you
don't want to assume db name that is the same as user name - then you
don't know what db to connect 

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.

Regards,
Neha

--
Cheers,
Neha

pgsql-novice by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: [NOVICE] Why psql connection assumes default database name asthe username
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: [NOVICE] Why psql connection assumes default database name asthe username