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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Why psql connection assumes default database name as the username
Дата
Msg-id CAKFQuwZL-sahuhrL2cGtZfUHMOKj8cdND8KBrMW9xE5LUJ56OQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: 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  (Neha Khatri <nehakhatri5@gmail.com>)
Список pgsql-novice
On Mon, Mar 27, 2017 at 5:58 PM, Neha Khatri <nehakhatri5@gmail.com> wrote:
Can a similar definition be applied in PostgreSQL for User and Database name mapping, i.e  if a database name is same as a user name then the access privileges for that datbase are guided by the properties defined for that user in view pg_roles?

​Nowhere in "pg_roles" does the name of a specific database appear - so no.

You defines roles.  You define databases.  You give roles CONNECT permissions on databases if you want them to be allowed to connect to said databases.  Of course, superusers can connect to anything.  That is, along as pg_hba.conf allows them to attempt a connection in the first place.

What I said above is wrong, though, if one leaves the default permissions of the implicit PUBLIC group in place.  By default all users are allowed to CONNECT to any database in the cluster - among other permissions.

So while creating a database of the same name of as a user "just works" it is working because of a default that can be changed.  The fact that the names match doesn't enter into it.


David J.


В списке pgsql-novice по дате отправления:

Предыдущее
От: Neha Khatri
Дата:
Сообщение: Re: Why psql connection assumes default database name as the username
Следующее
От: Neha Khatri
Дата:
Сообщение: Re: Why psql connection assumes default database name as the username