DROP USER

Removes a name from the list of authorized database users.

DROP USER can not remove a user that was added to the Vertica database with the LDAPLink service.

Syntax

DROP USER [ IF EXISTS ] user‑name[,...] [ CASCADE ]

Parameters

IF EXISTS

Do not report an error if the users to drop do not exist. Use this clause in SQL scripts to avoid errors on dropping non-existent objects before attempting to create them.

user‑name

Name of a user to drop.

CASCADE

Drop all user-defined objects created by user‑name, including schemas, tables and all views that reference the table, and projections of that table.

Tables owned by the dropped user cannot be recovered after you issue DROP USER CASCADE.

Privileges

Superuser

Examples

DROP USER succeeds if no user-defined objects exist:

=> CREATE USER user2;
CREATE USER
=> DROP USER IF EXISTS user2;
DROP USER

DROP USER fails if objects that the user created still exist:

=> DROP USER IF EXISTS user1;
NOTICE:  Table T_tbd1 depends on User user1
ROLLBACK:  DROP failed due to dependencies
DETAIL:  Cannot drop User user1 because other objects depend on it
HINT:  Use DROP ... CASCADE to drop the dependent objects too

DROP USER CASCADE succeeds regardless of any existing user-defined objects. The statement forcibly drops all user-defined objects, such as schemas, tables and their associated projections:

=> DROP USER IF EXISTS user1 CASCADE;
DROP USER