1DROP PROCEDURE(7)        PostgreSQL 15.4 Documentation       DROP PROCEDURE(7)
2
3
4

NAME

6       DROP_PROCEDURE - remove a procedure
7

SYNOPSIS

9       DROP PROCEDURE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]
10           [ CASCADE | RESTRICT ]
11

DESCRIPTION

13       DROP PROCEDURE removes the definition of one or more existing
14       procedures. To execute this command the user must be the owner of the
15       procedure(s). The argument types to the procedure(s) usually must be
16       specified, since several different procedures can exist with the same
17       name and different argument lists.
18

PARAMETERS

20       IF EXISTS
21           Do not throw an error if the procedure does not exist. A notice is
22           issued in this case.
23
24       name
25           The name (optionally schema-qualified) of an existing procedure.
26
27       argmode
28           The mode of an argument: IN, OUT, INOUT, or VARIADIC. If omitted,
29           the default is IN (but see below).
30
31       argname
32           The name of an argument. Note that DROP PROCEDURE does not actually
33           pay any attention to argument names, since only the argument data
34           types are used to determine the procedure's identity.
35
36       argtype
37           The data type(s) of the procedure's arguments (optionally
38           schema-qualified), if any. See below for details.
39
40       CASCADE
41           Automatically drop objects that depend on the procedure, and in
42           turn all objects that depend on those objects (see Section 5.14).
43
44       RESTRICT
45           Refuse to drop the procedure if any objects depend on it. This is
46           the default.
47

NOTES

49       If there is only one procedure of the given name, the argument list can
50       be omitted. Omit the parentheses too in this case.
51
52       In PostgreSQL, it's sufficient to list the input (including INOUT)
53       arguments, because no two routines of the same name are allowed to
54       share the same input-argument list. Moreover, the DROP command will not
55       actually check that you wrote the types of OUT arguments correctly; so
56       any arguments that are explicitly marked OUT are just noise. But
57       writing them is recommendable for consistency with the corresponding
58       CREATE command.
59
60       For compatibility with the SQL standard, it is also allowed to write
61       all the argument data types (including those of OUT arguments) without
62       any argmode markers. When this is done, the types of the procedure's
63       OUT argument(s) will be verified against the command. This provision
64       creates an ambiguity, in that when the argument list contains no
65       argmode markers, it's unclear which rule is intended. The DROP command
66       will attempt the lookup both ways, and will throw an error if two
67       different procedures are found. To avoid the risk of such ambiguity,
68       it's recommendable to write IN markers explicitly rather than letting
69       them be defaulted, thus forcing the traditional PostgreSQL
70       interpretation to be used.
71
72       The lookup rules just explained are also used by other commands that
73       act on existing procedures, such as ALTER PROCEDURE and COMMENT ON
74       PROCEDURE.
75

EXAMPLES

77       If there is only one procedure do_db_maintenance, this command is
78       sufficient to drop it:
79
80           DROP PROCEDURE do_db_maintenance;
81
82       Given this procedure definition:
83
84           CREATE PROCEDURE do_db_maintenance(IN target_schema text, OUT results text) ...
85
86       any one of these commands would work to drop it:
87
88           DROP PROCEDURE do_db_maintenance(IN target_schema text, OUT results text);
89           DROP PROCEDURE do_db_maintenance(IN text, OUT text);
90           DROP PROCEDURE do_db_maintenance(IN text);
91           DROP PROCEDURE do_db_maintenance(text);
92           DROP PROCEDURE do_db_maintenance(text, text);  -- potentially ambiguous
93
94       However, the last example would be ambiguous if there is also, say,
95
96           CREATE PROCEDURE do_db_maintenance(IN target_schema text, IN options text) ...
97

COMPATIBILITY

99       This command conforms to the SQL standard, with these PostgreSQL
100       extensions:
101
102       •   The standard only allows one procedure to be dropped per command.
103
104       •   The IF EXISTS option is an extension.
105
106       •   The ability to specify argument modes and names is an extension,
107           and the lookup rules differ when modes are given.
108

SEE ALSO

110       CREATE PROCEDURE (CREATE_PROCEDURE(7)), ALTER PROCEDURE
111       (ALTER_PROCEDURE(7)), DROP FUNCTION (DROP_FUNCTION(7)), DROP ROUTINE
112       (DROP_ROUTINE(7))
113
114
115
116PostgreSQL 15.4                      2023                    DROP PROCEDURE(7)
Impressum