CREATE ROLE v16
CREATE ROLE — Define a new database role.
CREATE ROLE adds a role to the EDB Postgres Advanced Server database cluster. A role is an entity that can own database objects and have database privileges. A role can be considered a user, a group, or both depending on how you use it. The new role doesn't have the
LOGIN attribute, so you can't use it to start a session. (Use the
ALTER ROLE command to give the role
LOGIN rights.) You must have
CREATEROLE privilege or be a database superuser to use
If you specify the
IDENTIFIED BY clause, the
CREATE ROLE command also creates a schema owned by and with the same name as the newly created role.
The roles are defined at the database cluster level, making them valid in all databases in the cluster.
The name of the new role.
IDENTIFIED BY password
Sets the role’s password. A password is needed only for roles having the
LOGIN attribute, but you can stil define one for roles without it. If you don't plan to use password authentication, you can omit this option.
ALTER ROLE to change the attributes of a role. Use
DROP ROLE to remove a role. You can mmodify the attributes specified by
CREATE ROLE using
ALTER ROLE commands.
REVOKE to add and remove members of roles that are being used as groups.
The maximum length limit for role name and password is 63 characters.
Create a role and a schema named
admins with a password: