1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
'\" t
.\" Title: DROP ROUTINE
.\" Author: The PostgreSQL Global Development Group
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 2024
.\" Manual: PostgreSQL 16.2 Documentation
.\" Source: PostgreSQL 16.2
.\" Language: English
.\"
.TH "DROP ROUTINE" "7" "2024" "PostgreSQL 16.2" "PostgreSQL 16.2 Documentation"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
DROP_ROUTINE \- remove a routine
.SH "SYNOPSIS"
.sp
.nf
DROP ROUTINE [ IF EXISTS ] \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] [, \&.\&.\&.]
[ CASCADE | RESTRICT ]
.fi
.SH "DESCRIPTION"
.PP
\fBDROP ROUTINE\fR
removes the definition of one or more existing routines\&. The term
\(lqroutine\(rq
includes aggregate functions, normal functions, and procedures\&. See under
DROP AGGREGATE (\fBDROP_AGGREGATE\fR(7)),
DROP FUNCTION (\fBDROP_FUNCTION\fR(7)), and
DROP PROCEDURE (\fBDROP_PROCEDURE\fR(7))
for the description of the parameters, more examples, and further details\&.
.SH "NOTES"
.PP
The lookup rules used by
\fBDROP ROUTINE\fR
are fundamentally the same as for
\fBDROP PROCEDURE\fR; in particular,
\fBDROP ROUTINE\fR
shares that command\*(Aqs behavior of considering an argument list that has no
\fIargmode\fR
markers to be possibly using the SQL standard\*(Aqs definition that
OUT
arguments are included in the list\&. (\fBDROP AGGREGATE\fR
and
\fBDROP FUNCTION\fR
do not do that\&.)
.PP
In some cases where the same name is shared by routines of different kinds, it is possible for
\fBDROP ROUTINE\fR
to fail with an ambiguity error when a more specific command (\fBDROP FUNCTION\fR, etc\&.) would work\&. Specifying the argument type list more carefully will also resolve such problems\&.
.PP
These lookup rules are also used by other commands that act on existing routines, such as
\fBALTER ROUTINE\fR
and
\fBCOMMENT ON ROUTINE\fR\&.
.SH "EXAMPLES"
.PP
To drop the routine
foo
for type
integer:
.sp
.if n \{\
.RS 4
.\}
.nf
DROP ROUTINE foo(integer);
.fi
.if n \{\
.RE
.\}
.sp
This command will work independent of whether
foo
is an aggregate, function, or procedure\&.
.SH "COMPATIBILITY"
.PP
This command conforms to the SQL standard, with these
PostgreSQL
extensions:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The standard only allows one routine to be dropped per command\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The
IF EXISTS
option is an extension\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The ability to specify argument modes and names is an extension, and the lookup rules differ when modes are given\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
User\-definable aggregate functions are an extension\&.
.RE
.SH "SEE ALSO"
DROP AGGREGATE (\fBDROP_AGGREGATE\fR(7)), DROP FUNCTION (\fBDROP_FUNCTION\fR(7)), DROP PROCEDURE (\fBDROP_PROCEDURE\fR(7)), ALTER ROUTINE (\fBALTER_ROUTINE\fR(7))
.PP
Note that there is no
CREATE ROUTINE
command\&.
|