~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to doc/src/sgml/man7/DROP_TABLE.7

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'\" t
 
2
.\"     Title: DROP TABLE
 
3
.\"    Author: The PostgreSQL Global Development Group
 
4
.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
 
5
.\"      Date: 2011-04-27
 
6
.\"    Manual: PostgreSQL 9.1beta1 Documentation
 
7
.\"    Source: PostgreSQL 9.1beta1
 
8
.\"  Language: English
 
9
.\"
 
10
.TH "DROP TABLE" "7" "2011-04-27" "PostgreSQL 9.1beta1" "PostgreSQL 9.1beta1 Documentation"
 
11
.\" -----------------------------------------------------------------
 
12
.\" * set default formatting
 
13
.\" -----------------------------------------------------------------
 
14
.\" disable hyphenation
 
15
.nh
 
16
.\" disable justification (adjust text to left margin only)
 
17
.ad l
 
18
.\" -----------------------------------------------------------------
 
19
.\" * MAIN CONTENT STARTS HERE *
 
20
.\" -----------------------------------------------------------------
 
21
.SH "NAME"
 
22
DROP_TABLE \- remove a table
 
23
.\" DROP TABLE
 
24
.SH "SYNOPSIS"
 
25
.sp
 
26
.nf
 
27
DROP TABLE [ IF EXISTS ] \fIname\fR [, \&.\&.\&.] [ CASCADE | RESTRICT ]
 
28
.fi
 
29
.SH "DESCRIPTION"
 
30
.PP
 
31
DROP TABLE
 
32
removes tables from the database\&. Only its owner can drop a table\&. To empty a table of rows without destroying the table, use
 
33
\fBDELETE\fR(7)
 
34
or
 
35
\fBTRUNCATE\fR(7)\&.
 
36
.PP
 
37
DROP TABLE
 
38
always removes any indexes, rules, triggers, and constraints that exist for the target table\&. However, to drop a table that is referenced by a view or a foreign\-key constraint of another table,
 
39
CASCADE
 
40
must be specified\&. (CASCADE
 
41
will remove a dependent view entirely, but in the foreign\-key case it will only remove the foreign\-key constraint, not the other table entirely\&.)
 
42
.SH "PARAMETERS"
 
43
.PP
 
44
IF EXISTS
 
45
.RS 4
 
46
Do not throw an error if the table does not exist\&. A notice is issued in this case\&.
 
47
.RE
 
48
.PP
 
49
\fIname\fR
 
50
.RS 4
 
51
The name (optionally schema\-qualified) of the table to drop\&.
 
52
.RE
 
53
.PP
 
54
CASCADE
 
55
.RS 4
 
56
Automatically drop objects that depend on the table (such as views)\&.
 
57
.RE
 
58
.PP
 
59
RESTRICT
 
60
.RS 4
 
61
Refuse to drop the table if any objects depend on it\&. This is the default\&.
 
62
.RE
 
63
.SH "EXAMPLES"
 
64
.PP
 
65
To destroy two tables,
 
66
films
 
67
and
 
68
distributors:
 
69
.sp
 
70
.if n \{\
 
71
.RS 4
 
72
.\}
 
73
.nf
 
74
DROP TABLE films, distributors;
 
75
.fi
 
76
.if n \{\
 
77
.RE
 
78
.\}
 
79
.SH "COMPATIBILITY"
 
80
.PP
 
81
This command conforms to the SQL standard, except that the standard only allows one table to be dropped per command, and apart from the
 
82
IF EXISTS
 
83
option, which is a
 
84
PostgreSQL
 
85
extension\&.
 
86
.SH "SEE ALSO"
 
87
ALTER TABLE (\fBALTER_TABLE\fR(7)), CREATE TABLE (\fBCREATE_TABLE\fR(7))