]> begriffs open source - ai-pg/blob - full-docs/man7/DROP_FUNCTION.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / DROP_FUNCTION.7
1 '\" t
2 .\"     Title: DROP FUNCTION
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "DROP FUNCTION" "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 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 DROP_FUNCTION \- remove a function
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 DROP FUNCTION [ IF EXISTS ] \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] [, \&.\&.\&.]
36     [ CASCADE | RESTRICT ]
37 .fi
38 .SH "DESCRIPTION"
39 .PP
40 \fBDROP FUNCTION\fR
41 removes the definition of an existing function\&. To execute this command the user must be the owner of the function\&. The argument types to the function must be specified, since several different functions can exist with the same name and different argument lists\&.
42 .SH "PARAMETERS"
43 .PP
44 IF EXISTS
45 .RS 4
46 Do not throw an error if the function does not exist\&. A notice is issued in this case\&.
47 .RE
48 .PP
49 \fIname\fR
50 .RS 4
51 The name (optionally schema\-qualified) of an existing function\&. If no argument list is specified, the name must be unique in its schema\&.
52 .RE
53 .PP
54 \fIargmode\fR
55 .RS 4
56 The mode of an argument:
57 IN,
58 OUT,
59 INOUT, or
60 VARIADIC\&. If omitted, the default is
61 IN\&. Note that
62 \fBDROP FUNCTION\fR
63 does not actually pay any attention to
64 OUT
65 arguments, since only the input arguments are needed to determine the function\*(Aqs identity\&. So it is sufficient to list the
66 IN,
67 INOUT, and
68 VARIADIC
69 arguments\&.
70 .RE
71 .PP
72 \fIargname\fR
73 .RS 4
74 The name of an argument\&. Note that
75 \fBDROP FUNCTION\fR
76 does not actually pay any attention to argument names, since only the argument data types are needed to determine the function\*(Aqs identity\&.
77 .RE
78 .PP
79 \fIargtype\fR
80 .RS 4
81 The data type(s) of the function\*(Aqs arguments (optionally schema\-qualified), if any\&.
82 .RE
83 .PP
84 CASCADE
85 .RS 4
86 Automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects (see
87 Section\ \&5.15)\&.
88 .RE
89 .PP
90 RESTRICT
91 .RS 4
92 Refuse to drop the function if any objects depend on it\&. This is the default\&.
93 .RE
94 .SH "EXAMPLES"
95 .PP
96 This command removes the square root function:
97 .sp
98 .if n \{\
99 .RS 4
100 .\}
101 .nf
102 DROP FUNCTION sqrt(integer);
103 .fi
104 .if n \{\
105 .RE
106 .\}
107 .PP
108 Drop multiple functions in one command:
109 .sp
110 .if n \{\
111 .RS 4
112 .\}
113 .nf
114 DROP FUNCTION sqrt(integer), sqrt(bigint);
115 .fi
116 .if n \{\
117 .RE
118 .\}
119 .PP
120 If the function name is unique in its schema, it can be referred to without an argument list:
121 .sp
122 .if n \{\
123 .RS 4
124 .\}
125 .nf
126 DROP FUNCTION update_employee_salaries;
127 .fi
128 .if n \{\
129 .RE
130 .\}
131 .sp
132 Note that this is different from
133 .sp
134 .if n \{\
135 .RS 4
136 .\}
137 .nf
138 DROP FUNCTION update_employee_salaries();
139 .fi
140 .if n \{\
141 .RE
142 .\}
143 .sp
144 which refers to a function with zero arguments, whereas the first variant can refer to a function with any number of arguments, including zero, as long as the name is unique\&.
145 .SH "COMPATIBILITY"
146 .PP
147 This command conforms to the SQL standard, with these
148 PostgreSQL
149 extensions:
150 .sp
151 .RS 4
152 .ie n \{\
153 \h'-04'\(bu\h'+03'\c
154 .\}
155 .el \{\
156 .sp -1
157 .IP \(bu 2.3
158 .\}
159 The standard only allows one function to be dropped per command\&.
160 .RE
161 .sp
162 .RS 4
163 .ie n \{\
164 \h'-04'\(bu\h'+03'\c
165 .\}
166 .el \{\
167 .sp -1
168 .IP \(bu 2.3
169 .\}
170 The
171 IF EXISTS
172 option
173 .RE
174 .sp
175 .RS 4
176 .ie n \{\
177 \h'-04'\(bu\h'+03'\c
178 .\}
179 .el \{\
180 .sp -1
181 .IP \(bu 2.3
182 .\}
183 The ability to specify argument modes and names
184 .RE
185 .SH "SEE ALSO"
186 CREATE FUNCTION (\fBCREATE_FUNCTION\fR(7)), ALTER FUNCTION (\fBALTER_FUNCTION\fR(7)), DROP PROCEDURE (\fBDROP_PROCEDURE\fR(7)), DROP ROUTINE (\fBDROP_ROUTINE\fR(7))