File: //usr/local/pgsql/share/man/man7/DROP_ROUTINE.7
'\" t
.\" Title: DROP ROUTINE
.\" Author: The PostgreSQL Global Development Group
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 2025
.\" Manual: PostgreSQL 14.18 Documentation
.\" Source: PostgreSQL 14.18
.\" Language: English
.\"
.TH "DROP ROUTINE" "7" "2025" "PostgreSQL 14.18" "PostgreSQL 14.18 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\&.