DROP SCHEMA

Function

DROP SCHEMA deletes a schema in a database.

Precautions

Only a schema owner or a system administrator can run the DROP SCHEMA command.

Syntax

1
DROP SCHEMA [ IF EXISTS ] schema_name [, ...] [ CASCADE | RESTRICT ];

Parameter Description

Do not delete the schemas with the beginning of pg_temp or pg_toast_temp. They are internal system schemas, and deleting them may cause unexpected errors.

A user cannot delete the schema in use. To delete the schema in use, switch to another schema.

Example

Delete the ds_new schema.

DROP SCHEMA ds_new;

Links

ALTER SCHEMA, CREATE SCHEMA