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.
Permissions
The role must have the DDL
permission at the database level.
Syntax
drop_schema_statement ::=
DROP SCHEMA schema_name
;
schema_name ::= identifier
Parameters
Parameter |
Description |
---|---|
|
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