Help Center > > Developer Guide> SQL Reference> SQL Syntax> DROP USER


Updated at:Aug 27, 2020 GMT+08:00


Deleting a user will also delete the schema having the same name as the user.


  • CASCADE is used to delete objects (excluding databases) that depend on the user. CASCADE cannot delete locked objects unless the locked objects are unlocked or the processes that lock the objects are killed.
  • When deleting a user in the database, if the object that the user depends on is in another database or the object of the dependent user is another database, you need to manually delete the dependent objects in other databases or delete the dependent database. Then, delete the user. Cross-database cascading deletion cannot be performed.
  • In a multi-tenant scenario, the service user will also be deleted when you delete a user group. If the specified CASCADE concatenation is deleted, CASCADE will be specified upon the deletion of the service user. If you fail to delete a user, an error is reported, and you cannot delete other users either.
  • If the user has an error table specified when the GDS foreign table is created, the user cannot be deleted by specifying the CASCADE keyword in the DROP USER command.


DROP USER [ IF EXISTS ] user_name [, ...] [ CASCADE | RESTRICT ];

Parameter Description


    Sends a notice instead of an error if the specified user does not exist.

  • user_name

    Specifies the name of a user to be deleted.

    Value range: An existing user name.

    • CASCADE: automatically deletes all objects that depend on the user to be deleted.
    • RESTRICT: refuses to delete the user if any objects depend on it. This is the default.

      In GaussDB(DWS), the postgresql.conf file contains the enable_kill_query parameter. This parameter affects the action of deleting user objects using CASCADE.

      • If enable_kill_query is on and CASCADE is used to delete user objects, the processes will be automatically killed and the user will be deleted at the same time.
      • If enable_kill_query is off and CASCADE is used to delete user objects, the user will be deleted after the processes are automatically killed.


See Examples in CREATE USER.

Helpful Links


Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?

Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel