title: "CREATE ROLE"
description: "CREATE ROLE
creates a new role."
menu:
main:
parent: commands
CREATE ROLE
creates a new role, which is a user account in Materialize.
When you connect to Materialize, you must specify the name of a valid role in the system.
{{< diagram "create-role.svg" >}}
Field | Use |
---|---|
_rolename | A name for the role. |
INHERIT | Grants the role the ability to inherit privileges of other roles. |
Materialize's support for CREATE ROLE
is similar to that of PostgreSQL, with
the following options exceptions:
Option | Description |
---|---|
INHERIT |
Materialize implicitly uses INHERIT for the CREATE ROLE command. That is, CREATE ROLE <name> and CREATE ROLE <name> WITH INHERIT are equivalent. |
NOINHERIT |
Materialize does not support the NOINHERIT option for CREATE ROLE . |
LOGIN |
Materialize does not support the LOGIN option for CREATE ROLE .
|
SUPERUSER |
Materialize does not support the SUPERUSER option for CREATE ROLE .
|
{{< note >}}
Materialize does not use role attributes to determine a role's ability to create top level objects such as databases and other roles. Instead, Materialize uses system level privileges. See GRANT PRIVILEGE for more details.
{{</ note >}}
You may not specify redundant or conflicting sets of options. For example,
Materialize will reject the statement CREATE ROLE ... INHERIT INHERIT
.
The privileges required to execute this statement are:
{{< include-md file="shared-content/sql-command-privileges/create-role.md" >}}
CREATE ROLE db_reader;
SELECT name FROM mz_roles;
db_reader
mz_system
mz_support