Defines a new database role (user or group).
CREATE ROLE <name> [[WITH] <option> [ ... ]]
where option can be:
SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB
| CREATEROLE | NOCREATEROLE
| CREATEEXTTABLE | NOCREATEEXTTABLE
[ ( <attribute>='<value>'[, ...] ) ]
where <attributes> and <value> are:
type='readable'|'writable'
protocol='gpfdist'|'http'
| INHERIT | NOINHERIT
| LOGIN | NOLOGIN
| REPLICATION | NOREPLICATION
| BYPASSRLS | NOBYPASSRLS
| CONNECTION LIMIT <connlimit>
| [ ENCRYPTED ] PASSWORD '<password>' | PASSWORD NULL
| VALID UNTIL '<timestamp>'
| IN ROLE <role_name> [, ...]
| IN GROUP <role_name> [, ...]
| ROLE <role_name> [, ...]
| ADMIN <role_name> [, ...]
| USER <role_name> [, ...]
| SYSID <uid> [, ...]
| RESOURCE QUEUE <queue_name>
| RESOURCE GROUP <group_name>
| [ DENY <deny_point> ]
| [ DENY BETWEEN <deny_point> AND <deny_point>]
CREATE ROLE
adds a new role to a Greenplum Database system. 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 it is used. You must have CREATEROLE
privilege or be a database superuser to use this command.
Note that roles are defined at the system-level and are valid for all databases in your Greenplum Database system.
SUPERUSER
is specified, the role being defined will be a superuser, who can override all access restrictions within the database. Superuser status is dangerous and should be used only when really needed. You must yourself be a superuser to create a new superuser.
NOSUPERUSER
is the default.
CREATEDB
is specified, the role being defined will be allowed to create new databases. Specifying
NOCREATEDB
(the default) will deny a role the ability to create databases.
CREATE ROLE
). If
CREATEROLE
is specified, the role being defined will be allowed to create new roles, alter other roles, and drop other roles.
NOCREATEROLE
(the default) will deny a role the ability to create roles or modify roles other than their own.
If CREATEEXTTABLE
is specified, the role being defined is allowed to create external tables. The default type
is readable
and the default protocol
is gpfdist
, if not specified. Valid types are gpfdist
, gpfdists
, http
, and https
. NOCREATEEXTTABLE
(the default type) denies the role the ability to create external tables. Note that external tables that use the file
or execute
protocols can only be created by superusers.
GRANT...ON PROTOCOL
command to allow users to create and use external tables with a custom protocol type, including the
s3
and
pxf
protocols included with Greenplum Database.
INHERIT
(the default) allows the role to use whatever database privileges have been granted to all roles it is directly or indirectly a member of. With
NOINHERIT
, membership in another role only grants the ability to
SET ROLE
to that other role; the privileges of the other role are only available after having done so.
LOGIN
allows a role to log in to a database. A role having the
LOGIN
attribute can be thought of as a user. Roles with
NOLOGIN
are useful for managing database privileges, but are not users in the usual sense of the word. If not specified,
NOLOGIN
is the default, except when
CREATE ROLE
is invoked through its alternative spelling
CREATE USER.
REPLICATION
attribute is a very highly privileged role, and should only be used on roles actually used for replication. If not specified,
NOREPLICATION
is the default. You must be a superuser to create a new role having the
REPLICATION
attribute.
These clauses determine whether a role bypasses every row-level security (RLS) policy. NOBYPASSRLS
is the default. You must be a superuser to create a new role having the BYPASSRLS
attribute.
pg_dump
will set row_security to
OFF
by default, to ensure all contents of a table are dumped out. If the user running
pg_dump
does not have appropriate permissions, an error will be returned. However, superusers and the owner of the table being dumped always bypass RLS.
-1
means there is no limit. Note that only normal connections are counted towards this limit. Neither prepared transactions nor background worker connections are counted towards this limit.
Sets the role's password. (A password is only of use for roles having the LOGIN
attribute, but you can nonetheless define one for roles without it.) If you do not plan to use password authentication you can omit this option. If no password is specified, the password will be set to null and password authentication will always fail for that user. A null password can optionally be written explicitly as PASSWORD NULL
.