The code to unlink dropped relations in FinishPreparedTransaction() was
[PostgreSQL.git] / doc / src / sgml / ref / drop_schema.sgml
blobd14ab02d9c9da30b9d8c1d074a8d232f25b87ac2
1 <!--
2 $PostgreSQL$
3 PostgreSQL documentation
4 -->
6 <refentry id="SQL-DROPSCHEMA">
7 <refmeta>
8 <refentrytitle id="SQL-DROPSCHEMA-TITLE">DROP SCHEMA</refentrytitle>
9 <manvolnum>7</manvolnum>
10 <refmiscinfo>SQL - Language Statements</refmiscinfo>
11 </refmeta>
13 <refnamediv>
14 <refname>DROP SCHEMA</refname>
15 <refpurpose>remove a schema</refpurpose>
16 </refnamediv>
18 <indexterm zone="sql-dropschema">
19 <primary>DROP SCHEMA</primary>
20 </indexterm>
22 <refsynopsisdiv>
23 <synopsis>
24 DROP SCHEMA [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
25 </synopsis>
26 </refsynopsisdiv>
28 <refsect1>
29 <title>Description</title>
31 <para>
32 <command>DROP SCHEMA</command> removes schemas from the database.
33 </para>
35 <para>
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.
39 </para>
40 </refsect1>
42 <refsect1>
43 <title>Parameters</title>
45 <variablelist>
46 <varlistentry>
47 <term><literal>IF EXISTS</literal></term>
48 <listitem>
49 <para>
50 Do not throw an error if the schema does not exist. A notice is issued
51 in this case.
52 </para>
53 </listitem>
54 </varlistentry>
56 <varlistentry>
57 <term><replaceable class="PARAMETER">name</replaceable></term>
58 <listitem>
59 <para>
60 The name of a schema.
61 </para>
62 </listitem>
63 </varlistentry>
65 <varlistentry>
66 <term><literal>CASCADE</literal></term>
67 <listitem>
68 <para>
69 Automatically drop objects (tables, functions, etc.) that are
70 contained in the schema.
71 </para>
72 </listitem>
73 </varlistentry>
75 <varlistentry>
76 <term><literal>RESTRICT</literal></term>
77 <listitem>
78 <para>
79 Refuse to drop the schema if it contains any objects. This is
80 the default.
81 </para>
82 </listitem>
83 </varlistentry>
84 </variablelist>
85 </refsect1>
87 <refsect1>
88 <title>Examples</title>
90 <para>
91 To remove schema <literal>mystuff</literal> from the database,
92 along with everything it contains:
94 <programlisting>
95 DROP SCHEMA mystuff CASCADE;
96 </programlisting>
97 </para>
98 </refsect1>
100 <refsect1>
101 <title>Compatibility</title>
103 <para>
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</>
108 extension.
109 </para>
110 </refsect1>
112 <refsect1>
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>
118 </simplelist>
119 </refsect1>
121 </refentry>