DROP SCHEMA
Description
Drops a schema from the current database.
Precautions
Only the schema owner or a user granted with the DROP permission can run the DROP SCHEMA command. System administrators have this permission by default.
Syntax
DROP SCHEMA [ IF EXISTS ] schema_name [, ...] [ CASCADE | RESTRICT ];
Parameters
- IF EXISTS
Reports a notice instead of an error if the specified schema does not exist.
- schema_name
Specifies the schema name.
Value range: an existing schema name.
- CASCADE | RESTRICT
- CASCADE: automatically drops all the objects contained in the schema.
- RESTRICT: refuses to drop the schema if the schema contains objects. This is the default action.

- Schemas beginning with pg_temp or pg_toast_temp are for internal use. Do not drop them. Otherwise, unexpected consequences may be incurred.
- The schema currently being used cannot be dropped. To drop it, switch to another schema first.
Examples
See Examples in "CREATE SCHEMA."
Helpful Links
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.
For any further questions, feel free to contact us through the chatbot.
Chatbot