]> begriffs open source - ai-pg/blob - full-docs/man7/DROP_PROCEDURE.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / DROP_PROCEDURE.7
1 '\" t
2 .\"     Title: DROP PROCEDURE
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 PROCEDURE" "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_PROCEDURE \- remove a procedure
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 DROP PROCEDURE [ IF EXISTS ] \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] [, \&.\&.\&.]
36     [ CASCADE | RESTRICT ]
37 .fi
38 .SH "DESCRIPTION"
39 .PP
40 \fBDROP PROCEDURE\fR
41 removes the definition of one or more existing procedures\&. To execute this command the user must be the owner of the procedure(s)\&. The argument types to the procedure(s) usually must be specified, since several different procedures can exist with the same name and different argument lists\&.
42 .SH "PARAMETERS"
43 .PP
44 IF EXISTS
45 .RS 4
46 Do not throw an error if the procedure 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 an existing procedure\&.
52 .RE
53 .PP
54 \fIargmode\fR
55 .RS 4
56 The mode of an argument:
57 IN,
58 OUT,
59 INOUT, or
60 VARIADIC\&. If omitted, the default is
61 IN
62 (but see below)\&.
63 .RE
64 .PP
65 \fIargname\fR
66 .RS 4
67 The name of an argument\&. Note that
68 \fBDROP PROCEDURE\fR
69 does not actually pay any attention to argument names, since only the argument data types are used to determine the procedure\*(Aqs identity\&.
70 .RE
71 .PP
72 \fIargtype\fR
73 .RS 4
74 The data type(s) of the procedure\*(Aqs arguments (optionally schema\-qualified), if any\&. See below for details\&.
75 .RE
76 .PP
77 CASCADE
78 .RS 4
79 Automatically drop objects that depend on the procedure, and in turn all objects that depend on those objects (see
80 Section\ \&5.15)\&.
81 .RE
82 .PP
83 RESTRICT
84 .RS 4
85 Refuse to drop the procedure if any objects depend on it\&. This is the default\&.
86 .RE
87 .SH "NOTES"
88 .PP
89 If there is only one procedure of the given name, the argument list can be omitted\&. Omit the parentheses too in this case\&.
90 .PP
91 In
92 PostgreSQL, it\*(Aqs sufficient to list the input (including
93 INOUT) arguments, because no two routines of the same name are allowed to share the same input\-argument list\&. Moreover, the
94 \fBDROP\fR
95 command will not actually check that you wrote the types of
96 OUT
97 arguments correctly; so any arguments that are explicitly marked
98 OUT
99 are just noise\&. But writing them is recommendable for consistency with the corresponding
100 \fBCREATE\fR
101 command\&.
102 .PP
103 For compatibility with the SQL standard, it is also allowed to write all the argument data types (including those of
104 OUT
105 arguments) without any
106 \fIargmode\fR
107 markers\&. When this is done, the types of the procedure\*(Aqs
108 OUT
109 argument(s)
110 \fIwill\fR
111 be verified against the command\&. This provision creates an ambiguity, in that when the argument list contains no
112 \fIargmode\fR
113 markers, it\*(Aqs unclear which rule is intended\&. The
114 \fBDROP\fR
115 command will attempt the lookup both ways, and will throw an error if two different procedures are found\&. To avoid the risk of such ambiguity, it\*(Aqs recommendable to write
116 IN
117 markers explicitly rather than letting them be defaulted, thus forcing the traditional
118 PostgreSQL
119 interpretation to be used\&.
120 .PP
121 The lookup rules just explained are also used by other commands that act on existing procedures, such as
122 \fBALTER PROCEDURE\fR
123 and
124 \fBCOMMENT ON PROCEDURE\fR\&.
125 .SH "EXAMPLES"
126 .PP
127 If there is only one procedure
128 do_db_maintenance, this command is sufficient to drop it:
129 .sp
130 .if n \{\
131 .RS 4
132 .\}
133 .nf
134 DROP PROCEDURE do_db_maintenance;
135 .fi
136 .if n \{\
137 .RE
138 .\}
139 .PP
140 Given this procedure definition:
141 .sp
142 .if n \{\
143 .RS 4
144 .\}
145 .nf
146 CREATE PROCEDURE do_db_maintenance(IN target_schema text, OUT results text) \&.\&.\&.
147 .fi
148 .if n \{\
149 .RE
150 .\}
151 .sp
152 any one of these commands would work to drop it:
153 .sp
154 .if n \{\
155 .RS 4
156 .\}
157 .nf
158 DROP PROCEDURE do_db_maintenance(IN target_schema text, OUT results text);
159 DROP PROCEDURE do_db_maintenance(IN text, OUT text);
160 DROP PROCEDURE do_db_maintenance(IN text);
161 DROP PROCEDURE do_db_maintenance(text);
162 DROP PROCEDURE do_db_maintenance(text, text);  \-\- potentially ambiguous
163 .fi
164 .if n \{\
165 .RE
166 .\}
167 .sp
168 However, the last example would be ambiguous if there is also, say,
169 .sp
170 .if n \{\
171 .RS 4
172 .\}
173 .nf
174 CREATE PROCEDURE do_db_maintenance(IN target_schema text, IN options text) \&.\&.\&.
175 .fi
176 .if n \{\
177 .RE
178 .\}
179 .SH "COMPATIBILITY"
180 .PP
181 This command conforms to the SQL standard, with these
182 PostgreSQL
183 extensions:
184 .sp
185 .RS 4
186 .ie n \{\
187 \h'-04'\(bu\h'+03'\c
188 .\}
189 .el \{\
190 .sp -1
191 .IP \(bu 2.3
192 .\}
193 The standard only allows one procedure to be dropped per command\&.
194 .RE
195 .sp
196 .RS 4
197 .ie n \{\
198 \h'-04'\(bu\h'+03'\c
199 .\}
200 .el \{\
201 .sp -1
202 .IP \(bu 2.3
203 .\}
204 The
205 IF EXISTS
206 option is an extension\&.
207 .RE
208 .sp
209 .RS 4
210 .ie n \{\
211 \h'-04'\(bu\h'+03'\c
212 .\}
213 .el \{\
214 .sp -1
215 .IP \(bu 2.3
216 .\}
217 The ability to specify argument modes and names is an extension, and the lookup rules differ when modes are given\&.
218 .RE
219 .SH "SEE ALSO"
220 CREATE PROCEDURE (\fBCREATE_PROCEDURE\fR(7)), ALTER PROCEDURE (\fBALTER_PROCEDURE\fR(7)), DROP FUNCTION (\fBDROP_FUNCTION\fR(7)), DROP ROUTINE (\fBDROP_ROUTINE\fR(7))