Database roles are conceptually completely separate from operating system users. In practice it might be convenient to maintain a correspondence, but this is not required. Database roles are global across a database cluster installation (and not per individual database). To create a role use the CREATE ROLE SQL command:
CREATE ROLE name;
name follows the rules for SQL identifiers: either unadorned without special characters, or double-quoted. (In practice, you will usually want to add additional options, such as LOGIN, to the command. More details appear below.) To remove an existing role, use the analogous DROP ROLE command:
DROP ROLE name;
For convenience, the programs createuser and dropuser are provided as wrappers around these SQL commands that can be called from the shell command line:
createuser name dropuser name
To determine the set of existing roles, examine the pg_roles system catalog, for example:
SELECT rolname FROM pg_roles;
or to see just those capable of logging in:
SELECT rolname FROM pg_roles WHERE rolcanlogin;
The psql program’s du meta-command is also useful for listing the existing roles.