Updated on 2024-08-20 GMT+08:00
DROP OWNED
Function
Deletes the database objects owned by a database role.
Precautions
- This interface will revoke the role's permissions on all objects in the current database and shared objects (databases and tablespaces).
- DROP OWNED is often used to prepare for removing one or more roles. Because DROP OWNED affects only the objects in the current database, you need to run this statement in each database that contains the objects owned by the role to be removed.
- Using the CASCADE option may cause this statement to recursively remove objects owned by other users.
- The databases and tablespaces owned by the role will not be removed.
- Private database links owned by a role can be deleted only after the CASCADE option is added.
Syntax
1
|
DROP OWNED BY name [, ...] [ CASCADE | RESTRICT ]; |
Parameter Description
- name
Specifies the role name.
- CASCADE | RESTRICT
- CASCADE: automatically deletes the objects that depend on the objects to be deleted.
- RESTRICT (default): refuses to delete the object if any objects depend on it.
Examples
1 2 3 4 5 6 7 8 |
-- Create user jim. gaussdb=# CREATE USER jim PASSWORD '********'; -- Revoke user jim's permissions on all objects in the current database and on shared objects (databases and tablespaces). gaussdb=# DROP OWNED BY jim; -- Delete user jim. gaussdb=# DROP USER jim; |
Helpful Links
Parent topic: D
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot