DROP SCHEMA
DROP SCHEMA — Remove a schema
Synopsis
DROP SCHEMA [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
Description
DROP SCHEMA removes schemas from the database.
A schema can only be dropped by its owner or a superuser. Note that the owner can drop the schema (and all contained objects) even if they do not own some of the objects within the schema.
Parameters
IF EXISTS
Do not throw an error if the schema does not exist. A notice is issued in this case.
name
The name of a schema.
CASCADE
Automatically drop objects contained in the schema (tables, functions, etc.), and in turn all objects that depend on those objects.
RESTRICT
Refuse to drop the schema if it contains any objects. This is the default.
Notes
Using the CASCADE option may cause this command to remove objects in schemas other than the one specified.
Examples
# To remove the schema mystuff and all objects contained in it from the database:
DROP SCHEMA mystuff CASCADE;