1DROP TABLE(7) PostgreSQL 9.2.24 Documentation DROP TABLE(7)
2
3
4
6 DROP_TABLE - remove a table
7
9 DROP TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
10
12 DROP TABLE removes tables from the database. Only the table owner, the
13 schema owner, and superuser can drop a table. To empty a table of rows
14 without destroying the table, use DELETE(7) or TRUNCATE(7).
15
16 DROP TABLE always removes any indexes, rules, triggers, and constraints
17 that exist for the target table. However, to drop a table that is
18 referenced by a view or a foreign-key constraint of another table,
19 CASCADE must be specified. (CASCADE will remove a dependent view
20 entirely, but in the foreign-key case it will only remove the
21 foreign-key constraint, not the other table entirely.)
22
24 IF EXISTS
25 Do not throw an error if the table does not exist. A notice is
26 issued in this case.
27
28 name
29 The name (optionally schema-qualified) of the table to drop.
30
31 CASCADE
32 Automatically drop objects that depend on the table (such as
33 views).
34
35 RESTRICT
36 Refuse to drop the table if any objects depend on it. This is the
37 default.
38
40 To destroy two tables, films and distributors:
41
42 DROP TABLE films, distributors;
43
45 This command conforms to the SQL standard, except that the standard
46 only allows one table to be dropped per command, and apart from the IF
47 EXISTS option, which is a PostgreSQL extension.
48
50 ALTER TABLE (ALTER_TABLE(7)), CREATE TABLE (CREATE_TABLE(7))
51
52
53
54PostgreSQL 9.2.24 2017-11-06 DROP TABLE(7)