DROP USER
The DROP USER statement removes an existing user from Redpanda SQL. DROP ROLE is a synonym for DROP USER, provided for PostgreSQL compatibility. Only a superuser can run this statement.
A user cannot be dropped while they own objects (for example, a catalog or table created by that user) or hold privilege grants. Reassign or drop the owned objects and revoke the grants first, then drop the user.
|
On Redpanda Cloud BYOC, the Cloud operator synchronizes users from Redpanda Cloud’s organization IAM. If you |
Syntax
DROP { USER | ROLE } [IF EXISTS] user_name;
-
user_name: Name of the user to drop. Cannot beCURRENT_USERorCURRENT_ROLE. The user running the statement cannot drop themselves, and the protected system superuser cannot be dropped. -
IF EXISTS: Optional. Prevents an error if the user does not exist.
Examples
Drop an existing user:
DROP USER "alice@example.com";
Drop a user only if it exists:
DROP USER IF EXISTS "legacy-account@example.com";
If the user has dependent grants or owned objects, the statement fails with an error listing the objects. Revoke the grants and reassign or drop owned objects first:
REVOKE SELECT ON EXTERNAL SOURCE default_redpanda_catalog FROM "alice@example.com";
DROP USER "alice@example.com";