]> begriffs open source - ai-pg/blob - full-docs/man7/DROP_SCHEMA.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / DROP_SCHEMA.7
1 '\" t
2 .\"     Title: DROP SCHEMA
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "DROP SCHEMA" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 DROP_SCHEMA \- remove a schema
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 DROP SCHEMA [ IF EXISTS ] \fIname\fR [, \&.\&.\&.] [ CASCADE | RESTRICT ]
36 .fi
37 .SH "DESCRIPTION"
38 .PP
39 \fBDROP SCHEMA\fR
40 removes schemas from the database\&.
41 .PP
42 A schema can only be dropped by its owner or a superuser\&. Note that the owner can drop the schema (and thereby all contained objects) even if they do not own some of the objects within the schema\&.
43 .SH "PARAMETERS"
44 .PP
45 IF EXISTS
46 .RS 4
47 Do not throw an error if the schema does not exist\&. A notice is issued in this case\&.
48 .RE
49 .PP
50 \fIname\fR
51 .RS 4
52 The name of a schema\&.
53 .RE
54 .PP
55 CASCADE
56 .RS 4
57 Automatically drop objects (tables, functions, etc\&.) that are contained in the schema, and in turn all objects that depend on those objects (see
58 Section\ \&5.15)\&.
59 .RE
60 .PP
61 RESTRICT
62 .RS 4
63 Refuse to drop the schema if it contains any objects\&. This is the default\&.
64 .RE
65 .SH "NOTES"
66 .PP
67 Using the
68 CASCADE
69 option might make the command remove objects in other schemas besides the one(s) named\&.
70 .SH "EXAMPLES"
71 .PP
72 To remove schema
73 mystuff
74 from the database, along with everything it contains:
75 .sp
76 .if n \{\
77 .RS 4
78 .\}
79 .nf
80 DROP SCHEMA mystuff CASCADE;
81 .fi
82 .if n \{\
83 .RE
84 .\}
85 .SH "COMPATIBILITY"
86 .PP
87 \fBDROP SCHEMA\fR
88 is fully conforming with the SQL standard, except that the standard only allows one schema to be dropped per command, and apart from the
89 IF EXISTS
90 option, which is a
91 PostgreSQL
92 extension\&.
93 .SH "SEE ALSO"
94 ALTER SCHEMA (\fBALTER_SCHEMA\fR(7)), CREATE SCHEMA (\fBCREATE_SCHEMA\fR(7))