Re: Why psql connection assumes default database name as the username

From: Neha Khatri <nehakhatri5(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Hubert Lubaczewski <depesz(at)depesz(dot)com>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Why psql connection assumes default database name as the username
Date: 2017-03-24 01:10:36
Message-ID: CAFO0U+9q6ttYYyYbkebU-ehQW5t0Z-ErO+fvX04kSk=Vb4iv+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, Mar 24, 2017 at 9:16 AM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Thu, Mar 23, 2017 at 2:49 PM, Neha Khatri <nehakhatri5(at)gmail(dot)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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David G. Johnston 2017-03-24 01:58:47 Re: Why psql connection assumes default database name as the username
Previous Message David G. Johnston 2017-03-23 22:16:22 Re: Why psql connection assumes default database name as the username