Difference between revisions of "PostgreSQL: CREATE ROLE"

From wikieduonline
Jump to navigation Jump to search
Line 32: Line 32:
 
== Related ==
 
== Related ==
 
* <code>[[ALTER USER]]</code>
 
* <code>[[ALTER USER]]</code>
* <code>[[CREATE USER]]</code>
+
* <code>[[PostgreSQL: CREATE USER]]</code>
 
* [[PostgreSQL: Database roles]]
 
* [[PostgreSQL: Database roles]]
 
* <code>GRANT your_username_origin TO your_new_username_with_same_privileges;</code>
 
* <code>GRANT your_username_origin TO your_new_username_with_same_privileges;</code>

Revision as of 13:27, 23 June 2022


Overview

CREATE ROLE name [ [ WITH ] option [ ... ] ]

where option can be: 

      SUPERUSER | NOSUPERUSER
    | CREATEDB | NOCREATEDB
    | CREATEROLE | NOCREATEROLE
    | CREATEUSER | NOCREATEUSER
    | INHERIT | NOINHERIT
    | LOGIN | NOLOGIN
    | REPLICATION | NOREPLICATION
    | CONNECTION LIMIT connlimit
    | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password'
    | VALID UNTIL 'timestamp'
    | IN ROLE role_name [, ...]
    | IN GROUP role_name [, ...]
    | ROLE role_name [, ...]
    | ADMIN role_name [, ...]
    | USER role_name [, ...]
    | SYSID uid

Examples

  • CREATE ROLE my_username WITH LOGIN PASSWORD 'jw8s130F4' VALID UNTIL '2022-01-01';
  • CREATE ROLE my_username WITH CREATEDB CREATEROLE;
  • CREATE ROLE my_username NOLOGIN;

Related

See also

Advertising: