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

NAME

6       DROP_FUNCTION - remove a function
7

SYNOPSIS

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

DESCRIPTION

13       DROP FUNCTION removes the definition of an existing function. To
14       execute this command the user must be the owner of the function. The
15       argument types to the function must be specified, since several
16       different functions can exist with the same name and different argument
17       lists.
18

PARAMETERS

20       IF EXISTS
21           Do not throw an error if the function does not exist. A notice is
22           issued in this case.
23
24       name
25           The name (optionally schema-qualified) of an existing function. If
26           no argument list is specified, the name must be unique in its
27           schema.
28
29       argmode
30           The mode of an argument: IN, OUT, INOUT, or VARIADIC. If omitted,
31           the default is IN. Note that DROP FUNCTION does not actually pay
32           any attention to OUT arguments, since only the input arguments are
33           needed to determine the function's identity. So it is sufficient to
34           list the IN, INOUT, and VARIADIC arguments.
35
36       argname
37           The name of an argument. Note that DROP FUNCTION does not actually
38           pay any attention to argument names, since only the argument data
39           types are needed to determine the function's identity.
40
41       argtype
42           The data type(s) of the function's arguments (optionally
43           schema-qualified), if any.
44
45       CASCADE
46           Automatically drop objects that depend on the function (such as
47           operators or triggers), and in turn all objects that depend on
48           those objects (see Section 5.14).
49
50       RESTRICT
51           Refuse to drop the function if any objects depend on it. This is
52           the default.
53

EXAMPLES

55       This command removes the square root function:
56
57           DROP FUNCTION sqrt(integer);
58
59       Drop multiple functions in one command:
60
61           DROP FUNCTION sqrt(integer), sqrt(bigint);
62
63       If the function name is unique in its schema, it can be referred to
64       without an argument list:
65
66           DROP FUNCTION update_employee_salaries;
67
68       Note that this is different from
69
70           DROP FUNCTION update_employee_salaries();
71
72       which refers to a function with zero arguments, whereas the first
73       variant can refer to a function with any number of arguments, including
74       zero, as long as the name is unique.
75

COMPATIBILITY

77       This command conforms to the SQL standard, with these PostgreSQL
78       extensions:
79
80       •   The standard only allows one function to be dropped per command.
81
82       •   The IF EXISTS option
83
84       •   The ability to specify argument modes and names
85

SEE ALSO

87       CREATE FUNCTION (CREATE_FUNCTION(7)), ALTER FUNCTION
88       (ALTER_FUNCTION(7)), DROP PROCEDURE (DROP_PROCEDURE(7)), DROP ROUTINE
89       (DROP_ROUTINE(7))
90
91
92
93PostgreSQL 15.4                      2023                     DROP FUNCTION(7)
Impressum