Why psql connection assumes default database name as the username

From: Neha Khatri <nehakhatri5(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Why psql connection assumes default database name as the username
Date: 2017-03-23 04:57:58
Message-ID: CAFO0U+8P1PBd7jR3_eiYMsztRFcm59uGBJZL92P_Guag=JPf9g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

For psql connection, the default database name is assumed to be operating
system user name. Is it a common practice to have a database name same as
an OS username. Or would the applications create a database with the OS
username as some default procedure?

Is this assumption made so that the owners of the database can be easily
classified based on the database name. Or it is for some other reason.

Without the presence of database with same name as the username, following
failure is seen.
psql: FATAL: database "pgadmin" does not exist

In my specific case the problem is just that the database 'pgadmin' is not
there, then why should it be a FATAL error. I understand that any process
aborting errors are treated FATAL. But it looks like a simple error here.

It will be good to understand the reason behind default database name
assumption.

Regards,
Neha

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message hubert depesz lubaczewski 2017-03-23 13:12:32 Re: Why psql connection assumes default database name as the username
Previous Message Moreno Andreo 2017-03-22 12:19:13 Re: [SPAM] backup task target