1DROP SCHEMA(7) PostgreSQL 12.2 Documentation DROP SCHEMA(7)
2
3
4
6 DROP_SCHEMA - remove a schema
7
9 DROP SCHEMA [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
10
12 DROP SCHEMA removes schemas from the database.
13
14 A schema can only be dropped by its owner or a superuser. Note that the
15 owner can drop the schema (and thereby all contained objects) even if
16 they do not own some of the objects within the schema.
17
19 IF EXISTS
20 Do not throw an error if the schema does not exist. A notice is
21 issued in this case.
22
23 name
24 The name of a schema.
25
26 CASCADE
27 Automatically drop objects (tables, functions, etc.) that are
28 contained in the schema, and in turn all objects that depend on
29 those objects (see Section 5.14).
30
31 RESTRICT
32 Refuse to drop the schema if it contains any objects. This is the
33 default.
34
36 Using the CASCADE option might make the command remove objects in other
37 schemas besides the one(s) named.
38
40 To remove schema mystuff from the database, along with everything it
41 contains:
42
43 DROP SCHEMA mystuff CASCADE;
44
46 DROP SCHEMA is fully conforming with the SQL standard, except that the
47 standard only allows one schema to be dropped per command, and apart
48 from the IF EXISTS option, which is a PostgreSQL extension.
49
51 ALTER SCHEMA (ALTER_SCHEMA(7)), CREATE SCHEMA (CREATE_SCHEMA(7))
52
53
54
55PostgreSQL 12.2 2020 DROP SCHEMA(7)