summaryrefslogtreecommitdiff
path: root/portal/files/documentation/books/aw_pgsql/node233.html
blob: a769951d93247c4f5bffa65df8d3c38ab6b4f726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.1p1 release (March 2nd, 1998)
originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>DROP DATABASE</TITLE>
<META NAME="description" CONTENT="DROP DATABASE">
<META NAME="keywords" CONTENT="15467">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="15467.css">
<LINK REL="next" HREF="node234.html">
<LINK REL="previous" HREF="node232.html">
<LINK REL="up" HREF="node200.html">
<LINK REL="next" HREF="node234.html">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#A00000" ALINK="#0000FF">
<!--Navigation Panel-->
<A NAME="tex2html5873"
 HREF="node234.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="next_motif.gif"></A> 
<A NAME="tex2html5869"
 HREF="node200.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="up_motif.gif"></A> 
<A NAME="tex2html5863"
 HREF="node232.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="previous_motif.gif"></A> 
<A NAME="tex2html5871"
 HREF="node3.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
 SRC="contents_motif.gif"></A> 
<A NAME="tex2html5872"
 HREF="node288.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
 SRC="index_motif.gif"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html5874"
 HREF="node234.html">DROP FUNCTION</A>
<B> Up:</B> <A NAME="tex2html5870"
 HREF="node200.html">Reference Manual</A>
<B> Previous:</B> <A NAME="tex2html5864"
 HREF="node232.html">DROP AGGREGATE</A>
<BR>
<BR>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><strong>Subsections</strong></A>
<UL>
<LI><A NAME="tex2html5875"
 HREF="node233.html#SECTION0032331000000000000000">Name</A>
<UL>
<LI><A NAME="tex2html5876"
 HREF="node233.html#SECTION0032331100000000000000">Inputs </A>
<LI><A NAME="tex2html5877"
 HREF="node233.html#SECTION0032331200000000000000">Outputs </A>
</UL>
<LI><A NAME="tex2html5878"
 HREF="node233.html#SECTION0032332000000000000000">Description </A>
<UL>
<LI><A NAME="tex2html5879"
 HREF="node233.html#SECTION0032332100000000000000">Notes </A>
</UL>
<LI><A NAME="tex2html5880"
 HREF="node233.html#SECTION0032333000000000000000">Compatibility </A>
<UL>
<LI><A NAME="tex2html5881"
 HREF="node233.html#SECTION0032333100000000000000">SQL92 </A>
</UL></UL>
<!--End of Table of Child-Links-->
<HR>

<H1><A NAME="SECTION0032330000000000000000">&#160;</A><A NAME="16425">&#160;</A><A NAME="16426">&#160;</A>
<BR>
DROP DATABASE
</H1>

<P>

<H2><A NAME="SECTION0032331000000000000000">
Name</A>
</H2>

<P>
DROP DATABASE -- Removes an existing database 

<P>
DROP DATABASE <EM>name</EM>

<P>

<H3><A NAME="SECTION0032331100000000000000">
Inputs </A>
</H3>

<P>
<DL>
<DT><STRONG><EM>name</EM>&nbsp;</STRONG>
<DD>The name of an existing database to remove.  
</DL>
<P>

<H3><A NAME="SECTION0032331200000000000000">
Outputs </A>
</H3>

<P>
<DL>
<DT><STRONG>DROP&nbsp;DATABASE</STRONG>
<DD>This message is returned if the command is successful.
<DT><STRONG>ERROR:&nbsp;user&nbsp;'<EM>username</EM>&nbsp;'&nbsp;is&nbsp;not&nbsp;allowed&nbsp;to&nbsp;create/drop&nbsp;databases</STRONG>
<DD>You
must have the special CREATEDB privilege to drop databases. See <EM>CREATE
USER</EM>.  
<DT><STRONG>ERROR:&nbsp;dropdb:&nbsp;cannot&nbsp;be&nbsp;executed&nbsp;on&nbsp;the&nbsp;template&nbsp;database</STRONG>
<DD>The
template1 database cannot be removed. It's not in your interest.  
<DT><STRONG>ERROR:&nbsp;dropdb:&nbsp;cannot&nbsp;be&nbsp;executed&nbsp;on&nbsp;an&nbsp;open&nbsp;database</STRONG>
<DD>You
cannot be connected to the database your are about to remove. Instead,
you could connect to template1 or any other database and run this
command again.  
<DT><STRONG>ERROR:&nbsp;dropdb:&nbsp;database&nbsp;'<EM>name</EM>&nbsp;'&nbsp;does&nbsp;not&nbsp;exist</STRONG>
<DD>This
message occurs if the specified database does not exist.  
<DT><STRONG>ERROR:&nbsp;dropdb:&nbsp;database&nbsp;'<EM>name</EM>&nbsp;'&nbsp;is&nbsp;not&nbsp;owned&nbsp;by&nbsp;you</STRONG>
<DD>You
must be the owner of the database. Being the owner usually means that
you created it as well.  
<DT><STRONG>ERROR:&nbsp;dropdb:&nbsp;May&nbsp;not&nbsp;be&nbsp;called&nbsp;in&nbsp;a&nbsp;transaction&nbsp;block.</STRONG>
<DD>You
must finish the transaction in progress before you can call this command.
 
<DT><STRONG>NOTICE:&nbsp;The&nbsp;database&nbsp;directory&nbsp;'xxx'&nbsp;could&nbsp;not&nbsp;be&nbsp;removed.</STRONG>
<DD>The
database was dropped (unless other error messages came up), but the
directory where the data is stored could not be removed. You must
delete it manually.  
</DL>
<P>

<H2><A NAME="SECTION0032332000000000000000">
Description </A>
</H2>

<P>
<B>DROP DATABASE</B> removes the catalog entries for an existing
database and deletes the directory containing the data. It can only
be executed by the database owner (usually the user that created it). 

<P>

<H3><A NAME="SECTION0032332100000000000000">
Notes </A>
</H3>

<P>
This command cannot be executed while connected to the target database.
Thus, it might be more convenient to use the shell script dropdb,
which is a wrapper around this command, instead.

<P>
Refer to <EM>CREATE DATABASE</EM> for information on how to create a
database. 

<P>

<H2><A NAME="SECTION0032333000000000000000">
Compatibility </A>
</H2>

<P>

<H3><A NAME="SECTION0032333100000000000000">
SQL92 </A>
</H3>

<P>
<B>DROP DATABASE</B> statement is a Postgres language extension;
there is no such command in SQL92. <A NAME="16447">&#160;</A><A NAME="16448">&#160;</A>

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html5873"
 HREF="node234.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="next_motif.gif"></A> 
<A NAME="tex2html5869"
 HREF="node200.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="up_motif.gif"></A> 
<A NAME="tex2html5863"
 HREF="node232.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="previous_motif.gif"></A> 
<A NAME="tex2html5871"
 HREF="node3.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
 SRC="contents_motif.gif"></A> 
<A NAME="tex2html5872"
 HREF="node288.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
 SRC="index_motif.gif"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html5874"
 HREF="node234.html">DROP FUNCTION</A>
<B> Up:</B> <A NAME="tex2html5870"
 HREF="node200.html">Reference Manual</A>
<B> Previous:</B> <A NAME="tex2html5864"
 HREF="node232.html">DROP AGGREGATE</A>
<!--End of Navigation Panel-->
<ADDRESS>
<I>Bruce Momjian</I>
<BR><I>2002-01-08</I>
</ADDRESS>
</BODY>
</HTML>