1DROP ROUTINE(7) PostgreSQL 15.4 Documentation DROP ROUTINE(7)
2
3
4
6 DROP_ROUTINE - remove a routine
7
9 DROP ROUTINE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]
10 [ CASCADE | RESTRICT ]
11
13 DROP ROUTINE removes the definition of one or more existing routines.
14 The term “routine” includes aggregate functions, normal functions, and
15 procedures. See under DROP AGGREGATE (DROP_AGGREGATE(7)), DROP FUNCTION
16 (DROP_FUNCTION(7)), and DROP PROCEDURE (DROP_PROCEDURE(7)) for the
17 description of the parameters, more examples, and further details.
18
20 The lookup rules used by DROP ROUTINE are fundamentally the same as for
21 DROP PROCEDURE; in particular, DROP ROUTINE shares that command's
22 behavior of considering an argument list that has no argmode markers to
23 be possibly using the SQL standard's definition that OUT arguments are
24 included in the list. (DROP AGGREGATE and DROP FUNCTION do not do
25 that.)
26
27 In some cases where the same name is shared by routines of different
28 kinds, it is possible for DROP ROUTINE to fail with an ambiguity error
29 when a more specific command (DROP FUNCTION, etc.) would work.
30 Specifying the argument type list more carefully will also resolve such
31 problems.
32
33 These lookup rules are also used by other commands that act on existing
34 routines, such as ALTER ROUTINE and COMMENT ON ROUTINE.
35
37 To drop the routine foo for type integer:
38
39 DROP ROUTINE foo(integer);
40
41 This command will work independent of whether foo is an aggregate,
42 function, or procedure.
43
45 This command conforms to the SQL standard, with these PostgreSQL
46 extensions:
47
48 • The standard only allows one routine to be dropped per command.
49
50 • The IF EXISTS option is an extension.
51
52 • The ability to specify argument modes and names is an extension,
53 and the lookup rules differ when modes are given.
54
55 • User-definable aggregate functions are an extension.
56
58 DROP AGGREGATE (DROP_AGGREGATE(7)), DROP FUNCTION (DROP_FUNCTION(7)),
59 DROP PROCEDURE (DROP_PROCEDURE(7)), ALTER ROUTINE (ALTER_ROUTINE(7))
60
61 Note that there is no CREATE ROUTINE command.
62
63
64
65PostgreSQL 15.4 2023 DROP ROUTINE(7)