Debian Codegraph @

doc/src/sgml/ref/drop_tablespace.sgml

raw
1 <!--
2 doc/src/sgml/ref/drop_tablespace.sgml
3 PostgreSQL documentation
4 -->
5
6 <refentry id="sql-droptablespace">
7 <indexterm zone="sql-droptablespace">
8 <primary>DROP TABLESPACE</primary>
9 </indexterm>
10
11 <refmeta>
12 <refentrytitle>DROP TABLESPACE</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements</refmiscinfo>
15 </refmeta>
16
17 <refnamediv>
18 <refname>DROP TABLESPACE</refname>
19 <refpurpose>remove a tablespace</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23 <synopsis>
24 DROP TABLESPACE [ IF EXISTS ] <replaceable class="parameter">name</replaceable>
25 </synopsis>
26 </refsynopsisdiv>
27
28 <refsect1>
29 <title>Description</title>
30
31 <para>
32 <command>DROP TABLESPACE</command> removes a tablespace from the system.
33 </para>
34
35 <para>
36 A tablespace can only be dropped by its owner or a superuser.
37 The tablespace must be empty of all database objects before it can be
38 dropped. It is possible that objects in other databases might still reside
39 in the tablespace even if no objects in the current database are using
40 the tablespace. Also, if the tablespace is listed in the <xref
41 linkend="guc-temp-tablespaces"/> setting of any active session, the
42 <command>DROP</command> might fail due to temporary files residing in the
43 tablespace.
44 </para>
45 </refsect1>
46
47 <refsect1>
48 <title>Parameters</title>
49
50 <variablelist>
51
52 <varlistentry>
53 <term><literal>IF EXISTS</literal></term>
54 <listitem>
55 <para>
56 Do not throw an error if the tablespace does not exist. A notice is issued
57 in this case.
58 </para>
59 </listitem>
60 </varlistentry>
61
62 <varlistentry>
63 <term><replaceable class="parameter">name</replaceable></term>
64 <listitem>
65 <para>
66 The name of a tablespace.
67 </para>
68 </listitem>
69 </varlistentry>
70 </variablelist>
71 </refsect1>
72
73 <refsect1>
74 <title>Notes</title>
75
76 <para>
77 <command>DROP TABLESPACE</command> cannot be executed inside a transaction block.
78 </para>
79 </refsect1>
80
81
82 <refsect1>
83 <title>Examples</title>
84
85 <para>
86 To remove tablespace <literal>mystuff</literal> from the system:
87 <programlisting>
88 DROP TABLESPACE mystuff;
89 </programlisting></para>
90 </refsect1>
91
92 <refsect1>
93 <title>Compatibility</title>
94
95 <para>
96 <command>DROP TABLESPACE</command> is a <productname>PostgreSQL</productname>
97 extension.
98 </para>
99 </refsect1>
100
101 <refsect1>
102 <title>See Also</title>
103
104 <simplelist type="inline">
105 <member><xref linkend="sql-createtablespace"/></member>
106 <member><xref linkend="sql-altertablespace"/></member>
107 </simplelist>
108 </refsect1>
109
110 </refentry>