3 PostgreSQL documentation
6 <refentry id=
"SQL-DROPTABLESPACE">
8 <refentrytitle id=
"SQL-DROPTABLESPACE-TITLE">DROP TABLESPACE
</refentrytitle>
9 <manvolnum>7</manvolnum>
10 <refmiscinfo>SQL - Language Statements
</refmiscinfo>
14 <refname>DROP TABLESPACE
</refname>
15 <refpurpose>remove a tablespace
</refpurpose>
18 <indexterm zone=
"sql-droptablespace">
19 <primary>DROP TABLESPACE
</primary>
24 DROP TABLESPACE [ IF EXISTS ]
<replaceable class=
"PARAMETER">tablespacename
</replaceable>
29 <title>Description
</title>
32 <command>DROP TABLESPACE
</command> removes a tablespace from the system.
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<
/> might fail due to temporary files residing in the
48 <title>Parameters
</title>
53 <term><literal>IF EXISTS
</literal></term>
56 Do not throw an error if the tablespace does not exist. A notice is issued
63 <term><replaceable class=
"PARAMETER">tablespacename
</replaceable></term>
66 The name of a tablespace.
77 <command>DROP TABLESPACE<
/> cannot be executed inside a transaction block.
83 <title>Examples
</title>
86 To remove tablespace
<literal>mystuff
</literal> from the system:
88 DROP TABLESPACE mystuff;
94 <title>Compatibility
</title>
97 <command>DROP TABLESPACE
</command> is a
<productname>PostgreSQL<
/>
103 <title>See Also
</title>
105 <simplelist type=
"inline">
106 <member><xref linkend=
"sql-createtablespace" endterm=
"sql-createtablespace-title"></member>
107 <member><xref linkend=
"sql-altertablespace" endterm=
"sql-altertablespace-title"></member>