2 doc/src/sgml/ref/drop_schema.sgml
3 PostgreSQL documentation
6 <refentry id="SQL-DROPSCHEMA">
8 <refentrytitle>DROP SCHEMA</refentrytitle>
9 <manvolnum>7</manvolnum>
10 <refmiscinfo>SQL - Language Statements</refmiscinfo>
14 <refname>DROP SCHEMA</refname>
15 <refpurpose>remove a schema</refpurpose>
18 <indexterm zone="sql-dropschema">
19 <primary>DROP SCHEMA</primary>
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 he does 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.
76 <term><literal>RESTRICT</literal></term>
79 Refuse to drop the schema if it contains any objects. This is
88 <title>Examples</title>
91 To remove schema <literal>mystuff</literal> from the database,
92 along with everything it contains:
95 DROP SCHEMA mystuff CASCADE;
96 </programlisting></para>
100 <title>Compatibility</title>
103 <command>DROP SCHEMA</command> is fully conforming with the SQL
104 standard, except that the standard only allows one schema to be
105 dropped per command, and apart from the
106 <literal>IF EXISTS</> option, which is a <productname>PostgreSQL</>
112 <title>See Also</title>
114 <simplelist type="inline">
115 <member><xref linkend="sql-alterschema"></member>
116 <member><xref linkend="sql-createschema"></member>