ALTER USER
The ALTER USER statement changes the password or superuser status of an existing user. ALTER ROLE is a synonym for ALTER USER, provided for PostgreSQL compatibility.
A superuser can alter any user. A non-superuser can alter their own user (for example, to change their own password) but cannot change their own superuser status.
Syntax
ALTER { USER | ROLE } user_name [WITH]
[ PASSWORD 'password' ]
[ SUPERUSER | NOSUPERUSER ];
-
user_name: Name of the existing user to alter. Use the reserved keywordCURRENT_USERorCURRENT_ROLEto alter the user running the statement. -
PASSWORD 'password': Optional. The new password. Must be a non-empty string literal if specified. -
SUPERUSER: Optional. Promotes the user to superuser. Requires superuser privileges on the current session. -
NOSUPERUSER: Optional. Removes superuser status from the user. The protected system superuser cannot be demoted. -
WITH: Optional. Has no effect; provided for PostgreSQL compatibility.
|
On Redpanda Cloud BYOC, the Cloud operator synchronizes users from Redpanda Cloud’s organization IAM. Changes from |
Examples
Change the password for an existing user:
ALTER USER "alice@example.com" WITH PASSWORD 'new_secret';
Change your own password (as the current user):
ALTER USER CURRENT_USER WITH PASSWORD 'new_secret';
Promote a regular user to superuser:
ALTER USER "alice@example.com" SUPERUSER;