3 PostgreSQL documentation
6 <refentry id=
"SQL-DROPSCHEMA">
8 <refentrytitle id=
"SQL-DROPSCHEMA-TITLE">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;
101 <title>Compatibility
</title>
104 <command>DROP SCHEMA
</command> is fully conforming with the SQL
105 standard, except that the standard only allows one schema to be
106 dropped per command, and apart from the
107 <literal>IF EXISTS<
/> option, which is a
<productname>PostgreSQL<
/>
113 <title>See Also
</title>
115 <simplelist type=
"inline">
116 <member><xref linkend=
"sql-alterschema" endterm=
"sql-alterschema-title"></member>
117 <member><xref linkend=
"sql-createschema" endterm=
"sql-createschema-title"></member>