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+9q6ttYYyYbkebU-ehQW5t0Z-ErO+fvX04kSk=Vb4iv+g@mail.gmail.com
Whole thread Raw
In response to Re: [NOVICE] Why psql connection assumes default database name as the username  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: [NOVICE] Why psql connection assumes default database name as the username
List pgsql-novice
On Fri, Mar 24, 2017 at 9:16 AM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Thu, Mar 23, 2017 at 2:49 PM, Neha Khatri <nehakhatri5@gmail.com> 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?

I have never named a database after a person/user ...​ myself or otherwise.

I suspect in the early days the user running psql was typically "postgres".  Since the database "postgres" is created by default if the postgres O/S user runs psql without any arguments it will connect to existing "postgres" database.

I get that. So, in current database systems, how much does this assumption weigh? Or it would be more useful update the message from

psql: FATAL: database "neha" does not exist    //Ofcourse, it won't in most cases.

to

psql: FATAL: database "neha" does not exist. Try connecting to an existing database or template database.
 

In this case the database does not exist, then connecting to a non existent database does not seem a FATAL issue.

If psql had some concept of "working but disconnected" I might agree with this sentiment but since its either connected or not running​ not finding the database its looking for means it has "stop running" which means it is dead (i.e., FATAL)


Hmm, alright.

Neha

pgsql-novice by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: [NOVICE] Why psql connection assumes default database name as the username
Next
From: "David G. Johnston"
Date:
Subject: Re: [NOVICE] Why psql connection assumes default database name as the username