Cloud

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 keyword CURRENT_USER or CURRENT_ROLE to 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 ALTER USER to attributes such as SUPERUSER may be reverted by the operator if they don’t match the IAM-managed state. Manage user superuser status through Redpanda Cloud’s data-plane RBAC roles instead. See Manage access to Redpanda SQL.

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;