]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/drop_database.sgml
Markup enhancements, some factual corrections.
[postgresql] / doc / src / sgml / ref / drop_database.sgml
1 <!--
2 $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_database.sgml,v 1.11 2000/11/11 23:01:43 petere Exp $
3 Postgres documentation
4 -->
5
6 <refentry id="SQL-DROPDATABASE">
7  <refmeta>
8   <refentrytitle id="SQL-DROPDATABASE-TITLE">
9    DROP DATABASE
10   </refentrytitle>
11   <refmiscinfo>SQL - Language Statements</refmiscinfo>
12  </refmeta>
13  <refnamediv>
14   <refname>
15    DROP DATABASE
16   </refname>
17   <refpurpose>
18    Removes an existing database
19   </refpurpose>
20  </refnamediv>
21  <refsynopsisdiv>
22   <refsynopsisdivinfo>
23    <date>1999-12-11</date>
24   </refsynopsisdivinfo>
25   <synopsis>
26 DROP DATABASE <replaceable class="PARAMETER">name</replaceable>
27   </synopsis>
28
29   <refsect2 id="R2-SQL-DROPDATABASE-1">
30    <refsect2info>
31     <date>1999-12-11</date>
32    </refsect2info>
33    <title>
34     Inputs
35    </title>
36    <para>
37     <variablelist>
38      <varlistentry>
39       <term><replaceable class="PARAMETER">name</replaceable></term>
40       <listitem>
41        <para>
42         The name of an existing database to remove.
43        </para>
44       </listitem>
45      </varlistentry>
46     </variablelist>
47    </para>
48   </refsect2>
49
50   <refsect2 id="R2-SQL-DROPDATABASE-2">
51    <refsect2info>
52     <date>1999-12-11</date>
53    </refsect2info>
54    <title>
55     Outputs
56    </title>
57    <para>
58
59     <variablelist>
60
61      <varlistentry>
62       <term><computeroutput>DROP DATABASE</computeroutput></term>
63       <listitem>
64        <para>
65         This message is returned if the command is successful.
66        </para>
67       </listitem>
68      </varlistentry>
69
70      <varlistentry>
71       <term><computeroutput>ERROR:  user '<replaceable class="parameter">username</replaceable>' is not allowed to create/drop databases</computeroutput></term>
72       <listitem>
73        <para>
74         You must have the special CREATEDB privilege to drop databases.
75         See <xref linkend="SQL-CREATEUSER" endterm="SQL-CREATEUSER-title">.
76        </para>
77       </listitem>
78      </varlistentry>
79
80      <varlistentry>
81       <term><computeroutput>ERROR:  dropdb: cannot be executed on the template database</computeroutput></term>
82       <listitem>
83        <para>
84         The <literal>template1</literal> database cannot be removed. It's not in
85         your interest.
86        </para>
87       </listitem>
88      </varlistentry>
89
90      <varlistentry>
91       <term><computeroutput>ERROR:  dropdb: cannot be executed on an open database</computeroutput></term>
92       <listitem>
93        <para>
94         You cannot be connected to the database your are about to remove.
95         Instead, you could connect to <literal>template1</literal> or any other
96         database and run this command again.
97        </para>
98       </listitem>
99      </varlistentry>
100
101      <varlistentry>
102       <term><computeroutput>ERROR:  dropdb: database '<replaceable class="parameter">name</replaceable>' does not exist</computeroutput></term>
103       <listitem>
104        <para>
105         This message occurs if the specified database does not exist.
106        </para>
107       </listitem>
108      </varlistentry>
109
110      <varlistentry>
111       <term><computeroutput>ERROR:  dropdb: database '<replaceable class="parameter">name</replaceable>' is not owned by you</computeroutput></term>
112       <listitem>
113        <para>
114         You must be the owner of the database. Being the owner usually means that
115         you created it as well.
116        </para>
117       </listitem>
118      </varlistentry>
119
120      <varlistentry>
121       <term><computeroutput>ERROR:  dropdb: May not be called in a transaction block.</computeroutput></term>
122       <listitem>
123        <para>
124         You must finish the transaction in progress before you can call this command.
125        </para>
126       </listitem>
127      </varlistentry>
128
129      <varlistentry>
130       <term><computeroutput>NOTICE:  The database directory 'xxx' could not be removed.</computeroutput></term>
131       <listitem>
132        <para>
133         The database was dropped (unless other error messages came up), but the
134         directory where the data is stored could not be removed. You must delete
135         it manually.
136        </para>
137       </listitem>
138      </varlistentry>
139
140     </variablelist>
141    </para>
142   </refsect2>
143  </refsynopsisdiv>
144  
145  <refsect1 id="R1-SQL-DROPDATABASE-1">
146   <refsect1info>
147    <date>1999-12-11</date>
148   </refsect1info>
149   <title>
150    Description
151   </title>
152   <para>
153    <command>DROP DATABASE</command> removes the catalog entries for an existing
154    database and deletes the directory containing the data.
155    It can only be executed by the database owner (usually the user that created
156    it).
157   </para>
158
159   <refsect2 id="R2-SQL-DROPDATABASE-3">
160    <refsect2info>
161     <date>1999-12-11</date>
162    </refsect2info>
163    <title>
164     Notes
165    </title>
166
167    <para>
168     This command cannot be executed while connected to the target
169     database. Thus, it might be more convenient to use the shell
170     script <xref linkend="app-dropdb" endterm="app-dropdb-title">,
171     which is a wrapper around this command, instead.
172    </para>
173
174    <para>
175     Refer to
176     <xref linkend="sql-createdatabase" endterm="sql-createdatabase-title">
177     for information on how to create a database.
178    </para>
179   </refsect2>
180  </refsect1>
181
182  <refsect1 id="R1-SQL-DROPDATABASE-3">
183   <title>
184    Compatibility
185   </title>
186
187   <refsect2 id="R2-SQL-DROPDATABASE-4">
188    <refsect2info>
189     <date>1998-04-15</date>
190    </refsect2info>
191    <title>
192     SQL92
193    </title>
194
195    <para>
196     <command>DROP DATABASE</command> statement is a
197     <productname>Postgres</productname> language extension;
198     there is no such command in <acronym>SQL92</acronym>.
199    </para>
200   </refsect2>
201  </refsect1>
202 </refentry>
203
204 <!-- Keep this comment at the end of the file
205 Local variables:
206 mode: sgml
207 sgml-omittag:nil
208 sgml-shorttag:t
209 sgml-minimize-attributes:nil
210 sgml-always-quote-attributes:t
211 sgml-indent-step:1
212 sgml-indent-data:t
213 sgml-parent-document:nil
214 sgml-default-dtd-file:"../reference.ced"
215 sgml-exposed-tags:nil
216 sgml-local-catalogs:"/usr/lib/sgml/catalog"
217 sgml-local-ecat-files:nil
218 End:
219 -->