role
and user
are interchangeable and refer to the same concept.
In SQL queries, the keywords ROLE
and USER
have identical semantics.oxla
, which always exists and retains superuser rights permanently.
Other users may be created as either superusers or non-superusers.
This status is set during user creation but can be changed later if needed.
Both the default superuser and other superusers have the same permissions.
The key difference is that the default superuser cannot be deleted or downgraded to a non-superuser,
while other superusers do not have this protection.
username
: name of the role you want to createyour_secure_password
: the role’s password (required and cannot be empty)SUPERUSER
/ NOSUPERUSER
: sets superuser status; defaults to NOSUPERUSER
WITH
: optional clause, no effect on behaviorLOGIN
: optional clause, included for compatibility; all roles can log in by defaultPASSWORD
, SUPERUSER
/ NOSUPERUSER
and LOGIN
is flexible. For example:
username
: name of the role to dropuser_kind
holds one of three possible values:
1
: default superuser2
: regular superuser3
: non-superuserALTER ROLE
to change passwords or superuser status.
username
: name of the role for which you want to change the passwordnew_password
: new password for that roleWITH
: optional clause, no effect on behaviorusername
: role name