2 .\" Title: DROP PROCEDURE
3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
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 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 DROP_PROCEDURE \- remove a procedure
35 DROP PROCEDURE [ IF EXISTS ] \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] [, \&.\&.\&.]
36 [ CASCADE | RESTRICT ]
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\&.
46 Do not throw an error if the procedure does not exist\&. A notice is issued in this case\&.
51 The name (optionally schema\-qualified) of an existing procedure\&.
56 The mode of an argument:
60 VARIADIC\&. If omitted, the default is
67 The name of an argument\&. Note that
69 does not actually pay any attention to argument names, since only the argument data types are used to determine the procedure\*(Aqs identity\&.
74 The data type(s) of the procedure\*(Aqs arguments (optionally schema\-qualified), if any\&. See below for details\&.
79 Automatically drop objects that depend on the procedure, and in turn all objects that depend on those objects (see
85 Refuse to drop the procedure if any objects depend on it\&. This is the default\&.
89 If there is only one procedure of the given name, the argument list can be omitted\&. Omit the parentheses too in this case\&.
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
95 command will not actually check that you wrote the types of
97 arguments correctly; so any arguments that are explicitly marked
99 are just noise\&. But writing them is recommendable for consistency with the corresponding
103 For compatibility with the SQL standard, it is also allowed to write all the argument data types (including those of
105 arguments) without any
107 markers\&. When this is done, the types of the procedure\*(Aqs
111 be verified against the command\&. This provision creates an ambiguity, in that when the argument list contains no
113 markers, it\*(Aqs unclear which rule is intended\&. The
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
117 markers explicitly rather than letting them be defaulted, thus forcing the traditional
119 interpretation to be used\&.
121 The lookup rules just explained are also used by other commands that act on existing procedures, such as
122 \fBALTER PROCEDURE\fR
124 \fBCOMMENT ON PROCEDURE\fR\&.
127 If there is only one procedure
128 do_db_maintenance, this command is sufficient to drop it:
134 DROP PROCEDURE do_db_maintenance;
140 Given this procedure definition:
146 CREATE PROCEDURE do_db_maintenance(IN target_schema text, OUT results text) \&.\&.\&.
152 any one of these commands would work to drop it:
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
168 However, the last example would be ambiguous if there is also, say,
174 CREATE PROCEDURE do_db_maintenance(IN target_schema text, IN options text) \&.\&.\&.
181 This command conforms to the SQL standard, with these
193 The standard only allows one procedure to be dropped per command\&.
206 option is an extension\&.
217 The ability to specify argument modes and names is an extension, and the lookup rules differ when modes are given\&.
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))