The code to unlink dropped relations in FinishPreparedTransaction() was
[PostgreSQL.git] / doc / src / sgml / ref / drop_database.sgml
blob9cedd493c32e05b8c8c170a503f2752a8b42715e
1 <!--
2 $PostgreSQL$
3 PostgreSQL documentation
4 -->
6 <refentry id="SQL-DROPDATABASE">
7 <refmeta>
8 <refentrytitle id="SQL-DROPDATABASE-TITLE">DROP DATABASE</refentrytitle>
9 <manvolnum>7</manvolnum>
10 <refmiscinfo>SQL - Language Statements</refmiscinfo>
11 </refmeta>
13 <refnamediv>
14 <refname>DROP DATABASE</refname>
15 <refpurpose>remove a database</refpurpose>
16 </refnamediv>
18 <indexterm zone="sql-dropdatabase">
19 <primary>DROP DATABASE</primary>
20 </indexterm>
22 <refsynopsisdiv>
23 <synopsis>
24 DROP DATABASE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable>
25 </synopsis>
26 </refsynopsisdiv>
28 <refsect1>
29 <title>Description</title>
31 <para>
32 <command>DROP DATABASE</command> drops a database. It removes the
33 catalog entries for the database and deletes the directory
34 containing the data. It can only be executed by the database owner.
35 Also, it cannot be executed while you or anyone else are connected
36 to the target database. (Connect to <literal>postgres</literal> or any
37 other database to issue this command.)
38 </para>
40 <para>
41 <command>DROP DATABASE</command> cannot be undone. Use it with care!
42 </para>
43 </refsect1>
45 <refsect1>
46 <title>Parameters</title>
48 <variablelist>
49 <varlistentry>
50 <term><literal>IF EXISTS</literal></term>
51 <listitem>
52 <para>
53 Do not throw an error if the database does not exist. A notice is issued
54 in this case.
55 </para>
56 </listitem>
57 </varlistentry>
59 <varlistentry>
60 <term><replaceable class="PARAMETER">name</replaceable></term>
61 <listitem>
62 <para>
63 The name of the database to remove.
64 </para>
65 </listitem>
66 </varlistentry>
67 </variablelist>
68 </refsect1>
70 <refsect1>
71 <title>Notes</title>
73 <para>
74 <command>DROP DATABASE</> cannot be executed inside a transaction
75 block.
76 </para>
78 <para>
79 This command cannot be executed while connected to the target
80 database. Thus, it might be more convenient to use the program
81 <xref linkend="app-dropdb" endterm="app-dropdb-title"> instead,
82 which is a wrapper around this command.
83 </para>
84 </refsect1>
86 <refsect1>
87 <title>Compatibility</title>
89 <para>
90 There is no <command>DROP DATABASE</command> statement in the SQL standard.
91 </para>
92 </refsect1>
94 <refsect1>
95 <title>See Also</title>
97 <simplelist type="inline">
98 <member><xref linkend="sql-createdatabase" endterm="sql-createdatabase-title"></member>
99 </simplelist>
100 </refsect1>
101 </refentry>