4 DROP PROCEDURE — remove a procedure
8 DROP PROCEDURE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...]
10 [ CASCADE | RESTRICT ]
14 DROP PROCEDURE removes the definition of one or more existing
15 procedures. To execute this command the user must be the owner of the
16 procedure(s). The argument types to the procedure(s) usually must be
17 specified, since several different procedures can exist with the same
18 name and different argument lists.
23 Do not throw an error if the procedure does not exist. A notice
24 is issued in this case.
27 The name (optionally schema-qualified) of an existing procedure.
30 The mode of an argument: IN, OUT, INOUT, or VARIADIC. If
31 omitted, the default is IN (but see below).
34 The name of an argument. Note that DROP PROCEDURE does not
35 actually pay any attention to argument names, since only the
36 argument data types are used to determine the procedure's
40 The data type(s) of the procedure's arguments (optionally
41 schema-qualified), if any. See below for details.
44 Automatically drop objects that depend on the procedure, and in
45 turn all objects that depend on those objects (see
49 Refuse to drop the procedure if any objects depend on it. This
54 If there is only one procedure of the given name, the argument list can
55 be omitted. Omit the parentheses too in this case.
57 In PostgreSQL, it's sufficient to list the input (including INOUT)
58 arguments, because no two routines of the same name are allowed to
59 share the same input-argument list. Moreover, the DROP command will not
60 actually check that you wrote the types of OUT arguments correctly; so
61 any arguments that are explicitly marked OUT are just noise. But
62 writing them is recommendable for consistency with the corresponding
65 For compatibility with the SQL standard, it is also allowed to write
66 all the argument data types (including those of OUT arguments) without
67 any argmode markers. When this is done, the types of the procedure's
68 OUT argument(s) will be verified against the command. This provision
69 creates an ambiguity, in that when the argument list contains no
70 argmode markers, it's unclear which rule is intended. The DROP command
71 will attempt the lookup both ways, and will throw an error if two
72 different procedures are found. To avoid the risk of such ambiguity,
73 it's recommendable to write IN markers explicitly rather than letting
74 them be defaulted, thus forcing the traditional PostgreSQL
75 interpretation to be used.
77 The lookup rules just explained are also used by other commands that
78 act on existing procedures, such as ALTER PROCEDURE and COMMENT ON
83 If there is only one procedure do_db_maintenance, this command is
84 sufficient to drop it:
85 DROP PROCEDURE do_db_maintenance;
87 Given this procedure definition:
88 CREATE PROCEDURE do_db_maintenance(IN target_schema text, OUT results text) ...
90 any one of these commands would work to drop it:
91 DROP PROCEDURE do_db_maintenance(IN target_schema text, OUT results text);
92 DROP PROCEDURE do_db_maintenance(IN text, OUT text);
93 DROP PROCEDURE do_db_maintenance(IN text);
94 DROP PROCEDURE do_db_maintenance(text);
95 DROP PROCEDURE do_db_maintenance(text, text); -- potentially ambiguous
97 However, the last example would be ambiguous if there is also, say,
98 CREATE PROCEDURE do_db_maintenance(IN target_schema text, IN options text) ...
102 This command conforms to the SQL standard, with these PostgreSQL
104 * The standard only allows one procedure to be dropped per command.
105 * The IF EXISTS option is an extension.
106 * The ability to specify argument modes and names is an extension,
107 and the lookup rules differ when modes are given.
111 CREATE PROCEDURE, ALTER PROCEDURE, DROP FUNCTION, DROP ROUTINE