2 doc/src/sgml/ref/drop_schema.sgml
3 PostgreSQL documentation
6 <refentry id="SQL-DROPSCHEMA">
7 <indexterm zone="sql-dropschema">
8 <primary>DROP SCHEMA</primary>
12 <refentrytitle>DROP SCHEMA</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements</refmiscinfo>
18 <refname>DROP SCHEMA</refname>
19 <refpurpose>remove a schema</refpurpose>
24 DROP SCHEMA [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
29 <title>Description</title>
32 <command>DROP SCHEMA</command> removes schemas from the database.
36 A schema can only be dropped by its owner or a superuser. Note that
37 the owner can drop the schema (and thereby all contained objects)
38 even if they do not own some of the objects within the schema.
43 <title>Parameters</title>
47 <term><literal>IF EXISTS</literal></term>
50 Do not throw an error if the schema does not exist. A notice is issued
57 <term><replaceable class="PARAMETER">name</replaceable></term>
66 <term><literal>CASCADE</literal></term>
69 Automatically drop objects (tables, functions, etc.) that are
70 contained in the schema,
71 and in turn all objects that depend on those objects
72 (see <xref linkend="ddl-depend">).
78 <term><literal>RESTRICT</literal></term>
81 Refuse to drop the schema if it contains any objects. This is
93 Using the <literal>CASCADE</literal> option might make the command
94 remove objects in other schemas besides the one(s) named.
99 <title>Examples</title>
102 To remove schema <literal>mystuff</literal> from the database,
103 along with everything it contains:
106 DROP SCHEMA mystuff CASCADE;
107 </programlisting></para>
111 <title>Compatibility</title>
114 <command>DROP SCHEMA</command> is fully conforming with the SQL
115 standard, except that the standard only allows one schema to be
116 dropped per command, and apart from the
117 <literal>IF EXISTS</> option, which is a <productname>PostgreSQL</>
123 <title>See Also</title>
125 <simplelist type="inline">
126 <member><xref linkend="sql-alterschema"></member>
127 <member><xref linkend="sql-createschema"></member>