]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/drop_schema.sgml
Fix psql doc typo.
[postgresql] / doc / src / sgml / ref / drop_schema.sgml
1 <!--
2 doc/src/sgml/ref/drop_schema.sgml
3 PostgreSQL documentation
4 -->
5
6 <refentry id="SQL-DROPSCHEMA">
7  <refmeta>
8   <refentrytitle>DROP SCHEMA</refentrytitle>
9   <manvolnum>7</manvolnum>
10   <refmiscinfo>SQL - Language Statements</refmiscinfo>
11  </refmeta>
12
13  <refnamediv>
14   <refname>DROP SCHEMA</refname>
15   <refpurpose>remove a schema</refpurpose>
16  </refnamediv>
17
18  <indexterm zone="sql-dropschema">
19   <primary>DROP SCHEMA</primary>
20  </indexterm>
21
22  <refsynopsisdiv>
23 <synopsis>
24 DROP SCHEMA [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
25 </synopsis>
26  </refsynopsisdiv>
27
28  <refsect1>
29   <title>Description</title>
30
31   <para>
32    <command>DROP SCHEMA</command> removes schemas from the database.
33   </para>
34
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>
41
42  <refsect1>
43   <title>Parameters</title>
44
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>
55
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>
64
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>
74
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>
86
87  <refsect1>
88   <title>Examples</title>
89
90   <para>
91    To remove schema <literal>mystuff</literal> from the database,
92    along with everything it contains:
93
94 <programlisting>
95 DROP SCHEMA mystuff CASCADE;
96 </programlisting></para>
97  </refsect1>
98
99  <refsect1>
100   <title>Compatibility</title>
101
102   <para>
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</>
107    extension.
108   </para>
109  </refsect1>
110
111  <refsect1>
112   <title>See Also</title>
113
114   <simplelist type="inline">
115    <member><xref linkend="sql-alterschema"></member>
116    <member><xref linkend="sql-createschema"></member>
117   </simplelist>
118  </refsect1>
119
120 </refentry>