Open topic with navigation
DROP SCHEMA — remove a schema
name[ CASCADE | RESTRICT ] [ IF EXISTS ] DROP SCHEMA [ CASCADE | RESTRICT] [ IF EXISTS ]
DROP SCHEMA removes schemas from the database.
CREATE SCHEMA for information on how to create a schema.
Name of a schema
Automatically drops objects (tables, stored procedures, etc.) that are contained in the schema. This option can be used to forcibly drop all related schema, if required. See .
Note: It is possible for
DROP SCHEMA CASCADE to fail if the transaction isolation level is
CONSISTENT READ and objects are created concurrently in the schema by other transactions. In this case, the "can't find <object> name" error message is returned, where object is the type of the object created concurrently (for example, table).
Refuse to drop the schema if it contains any objects. This is the default.
If the schema does not exist and you specify
IF EXISTS, NuoDB does not generate an error. Otherwise, if the schema does not exist, an error is generated.
Create objects in a schema. Drop the schema.
USE SCHEMA schema1 CREATE DOMAIN schema1.test_domain INTEGER; CREATE TABLE schema1.test_table (column1 test_domain); DROP SCHEMA schema1;schema "SCHEMA1" has 1 domain, 0 sequences, 0 roles, and 0 procedures. CASCADE will drop all
DROP SCHEMA schema1 CASCADE;
DROP SCHEMA PROD;
When dropping a non-empty schema the following error message is displayed:
schema "PROD" is not empty and cannot be dropped, it has 0 domains, 2 sequences, 0 roles, 0 procedures and 0 functions. CASCADE option can be used to forcibly drop the schema and all related content.