DROP SCHEMA

Delete mode.

Summary

DROP SCHEMA [IF EXISTS] name [, ...] [CASCADE | RESTRICT]

describe

DROP SCHEMA deletes schema from database. The mode can only be removed by its owner or superuser. Note that even if the owner does not own some objects within the schema, the owner can delete the schema (and thus all contained objects).

Parameters

IF EXISTS

  • If this mode does not exist, please do not report an error. In this case, a notification will be issued.

name

  • The name of the pattern to be deleted.

CASCADE

  • Automatically delete all objects (tables, functions, etc.) contained in the schema.

RESTRICT

  • If the pattern contains any object, the pattern is denied. This is the default value.

Example

Remove schema mystuff from the database and everything it contains:

DROP SCHEMA mystuff CASCADE;

compatibility

DROP SCHEMA is fully compliant with the SQL standard, but this standard allows only one pattern per command to be deleted. Additionally, the IF EXISTS option is a YMatrix database extension.

See also

CREATE SCHEMA, ALTER SCHEMA