Postgresql 中文操作指南
Description
DROP SCHEMA 从数据库中删除架构。
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 thereby 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 (tables, functions, etc.) that are contained in the schema, and in turn all objects that depend on those objects (see Section 5.14).
-
-
RESTRICT
-
Refuse to drop the schema if it contains any objects. This is the default.
-
Notes
使用 CASCADE 选项可能会导致该命令删除除一个或多个指定模式之外的其他模式中的对象。
Using the CASCADE option might make the command remove objects in other schemas besides the one(s) named.
Examples
若要连同其包含的所有内容一起从数据库中删除 mystuff 模式:
To remove schema mystuff from the database, along with everything it contains:
DROP SCHEMA mystuff CASCADE;
Compatibility
DROP SCHEMA 完全符合 SQL 标准,但标准只允许每个命令删除一个模式, IF EXISTS 选项除外,这是 PostgreSQL 扩展。
DROP SCHEMA is fully conforming with the SQL standard, except that the standard only allows one schema to be dropped per command, and apart from the IF EXISTS option, which is a PostgreSQL extension.