2 $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_database.sgml,v 1.11 2000/11/11 23:01:43 petere Exp $
6 <refentry id="SQL-DROPDATABASE">
8 <refentrytitle id="SQL-DROPDATABASE-TITLE">
11 <refmiscinfo>SQL - Language Statements</refmiscinfo>
18 Removes an existing database
23 <date>1999-12-11</date>
26 DROP DATABASE <replaceable class="PARAMETER">name</replaceable>
29 <refsect2 id="R2-SQL-DROPDATABASE-1">
31 <date>1999-12-11</date>
39 <term><replaceable class="PARAMETER">name</replaceable></term>
42 The name of an existing database to remove.
50 <refsect2 id="R2-SQL-DROPDATABASE-2">
52 <date>1999-12-11</date>
62 <term><computeroutput>DROP DATABASE</computeroutput></term>
65 This message is returned if the command is successful.
71 <term><computeroutput>ERROR: user '<replaceable class="parameter">username</replaceable>' is not allowed to create/drop databases</computeroutput></term>
74 You must have the special CREATEDB privilege to drop databases.
75 See <xref linkend="SQL-CREATEUSER" endterm="SQL-CREATEUSER-title">.
81 <term><computeroutput>ERROR: dropdb: cannot be executed on the template database</computeroutput></term>
84 The <literal>template1</literal> database cannot be removed. It's not in
91 <term><computeroutput>ERROR: dropdb: cannot be executed on an open database</computeroutput></term>
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.
102 <term><computeroutput>ERROR: dropdb: database '<replaceable class="parameter">name</replaceable>' does not exist</computeroutput></term>
105 This message occurs if the specified database does not exist.
111 <term><computeroutput>ERROR: dropdb: database '<replaceable class="parameter">name</replaceable>' is not owned by you</computeroutput></term>
114 You must be the owner of the database. Being the owner usually means that
115 you created it as well.
121 <term><computeroutput>ERROR: dropdb: May not be called in a transaction block.</computeroutput></term>
124 You must finish the transaction in progress before you can call this command.
130 <term><computeroutput>NOTICE: The database directory 'xxx' could not be removed.</computeroutput></term>
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
145 <refsect1 id="R1-SQL-DROPDATABASE-1">
147 <date>1999-12-11</date>
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
159 <refsect2 id="R2-SQL-DROPDATABASE-3">
161 <date>1999-12-11</date>
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.
176 <xref linkend="sql-createdatabase" endterm="sql-createdatabase-title">
177 for information on how to create a database.
182 <refsect1 id="R1-SQL-DROPDATABASE-3">
187 <refsect2 id="R2-SQL-DROPDATABASE-4">
189 <date>1998-04-15</date>
196 <command>DROP DATABASE</command> statement is a
197 <productname>Postgres</productname> language extension;
198 there is no such command in <acronym>SQL92</acronym>.
204 <!-- Keep this comment at the end of the file
209 sgml-minimize-attributes:nil
210 sgml-always-quote-attributes: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