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

Поиск
Список
Период
Сортировка
От Neha Khatri
Тема Re: Why psql connection assumes default database name as the username
Дата
Msg-id CAFO0U+9y_c+ByM8DbRgX5Jw2PXxGCsMfWFHNsiHaFxDcpmSJvg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Why psql connection assumes default database name as the username  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-novice
On Tue, Mar 28, 2017 at 12:17 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Mon, Mar 27, 2017 at 5:58 PM, Neha Khatri 
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 database 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.

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.

Right, the database does not appear in pg_roles. So having a database name same as a user in pg_roles, does not have anything to do with guiding the access privilege for the database.

It seems that for convenience, the OS username and the DB name correspondence could be in place. 
Many other PostgreSQL utilities like createdb, clusterdb, vacuumdb, reindexdb, pg_dump assume the dbname same as username, in case it is neither explicitly specified as an option nor it is set in the environment variable PGDATABASE.


Regards,
Neha



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Why psql connection assumes default database name as the username
Следующее
От: anand086
Дата:
Сообщение: How does backend server know which data file and page to read?