DROP SCHEMA
DROP SCHEMA can be used to remove a schema.
The schema has to be empty before removal.
SQream DB does not support dropping a schema with objects.
See also: CREATE SCHEMA, ALTER DEFAULT SCHEMA, and RENAME SCHEMA.
Permissions
The role must have the DDL permission on the schema. DDL granted at the database level does not satisfy this.
Syntax
drop_schema_statement ::=
DROP SCHEMA [ IF EXISTS ] schema_name
;
schema_name ::= identifier
Parameters
Parameter |
Description |
|---|---|
|
Drop the schema if it exists. Does not error if the schema does not exist. |
|
The name of the schema to drop |
Examples
Dropping a schema
DROP SCHEMA test;
Dropping a schema if it’s not empty
If a schema contains several tables, SQream DB will alert you that these tables need to be dropped first.
This prevents accidental dropping of full schemas.
t=> DROP SCHEMA test;
Schema 'test' contains the following objects:
Tables - 'test.foo' , 'test.bar'
Please drop its content and then try again.
To drop the schema, drop the schema’s tables first, and then drop the schema:
t=> DROP TABLE test.foo;
executed
t=> DROP TABLE test.bar;
executed
t=> DROP SCHEMA test;
executed