What is user creation and role creation in Postgresql?

Please explain what is the point of creating a user and creating a role in PostgreSQL. I am new to PostgreSQL.

I am trying to learn to understand myself, what I understand is that Create User means that the user who has access to and manages the database cluster is on the same computer where the database cluster is created, or from another computer with a username and password ...

And I think that creating a role means that the new user that I created has a role of some kind. If I set the role role for a user, he cannot change the database, so he cannot. But if I set the create role, this user can modify the database that he can.

Can anyone explain more clearly?

Thank you in advance

+3


source to share


1 answer


The PostgreSQL 9.4 documentation says: "CREATE USER is now an alias for CREATE ROLE. The only difference is that when the CREATE USER command is written, the login is assumed by default, while NOLOGIN is assumed when the CREATE ROLE command is written."

So your question about CREATE ROLE and CREATE USER carries over to the question about the difference between the LOGIN and NOLOGIN attribute, since PostgreSQL only knows roles.

As described, the LOGIN / NOLOGIN attribute determines whether the role can be used to connect to the client. The client can be any of your pgAdmin III to tell the web application. To test this, you can create a role with the LOGIN attribute and use it instead of the postgres role to connect to your server via pdAdmin III.



A role with a NOLOGIN attribute cannot be executed. This type of role can be thought of as an object to which you can add privileges. LOGIN roles can then inherit these privileges by adding them as a member. You can think about everything related to groups and users belonging to groups.

So, I guess this is just another way to express what you have already said.

+9


source







All Articles