CREATE USER

A DDL command for creating a database role

CREATE USER is a DDL command for creating a database role.

CREATE USER was added in PostgreSQL 6.3. Since PostgreSQL 8.1 it has been an alias for CREATE ROLE.

CREATE USER and CREATE ROLE

While CREATE USER is basically (since PostgreSQL 8.1)  an alias for CREATE ROLE, there is one significant behavioural difference, in that CREATE USER results in a role being created with permission to log in (option LOGIN). However roles created with CREATE ROLE do not have permission to log in by default (option NOLOGIN).

This retains the pre-PostgreSQL 8.1 behaviour of CREATE USER, while making it possible to safely define non-login roles with CREATE ROLE.

Note that the createuser core utility behaves in the same way as CREATE USER, i.e. roles created using it have login permission by default.

Change history

Categories

DDL, SQL command, User management

See also

ALTER USER, DROP USER, CREATE ROLE, createuser