1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>DROP ROUTINE</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="sql-droprole.html" title="DROP ROLE" /><link rel="next" href="sql-droprule.html" title="DROP RULE" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">DROP ROUTINE</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-droprole.html" title="DROP ROLE">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-droprule.html" title="DROP RULE">Next</a></td></tr></table><hr /></div><div class="refentry" id="SQL-DROPROUTINE"><div class="titlepage"></div><a id="id-1.9.3.127.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">DROP ROUTINE</span></h2><p>DROP ROUTINE — remove a routine</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
3 DROP ROUTINE [ IF EXISTS ] <em class="replaceable"><code>name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ] [, ...]
5 </pre></div><div class="refsect1" id="id-1.9.3.127.5"><h2>Description</h2><p>
6 <code class="command">DROP ROUTINE</code> removes the definition of one or more
7 existing routines. The term <span class="quote">“<span class="quote">routine</span>”</span> includes
8 aggregate functions, normal functions, and procedures. See
9 under <a class="xref" href="sql-dropaggregate.html" title="DROP AGGREGATE"><span class="refentrytitle">DROP AGGREGATE</span></a>, <a class="xref" href="sql-dropfunction.html" title="DROP FUNCTION"><span class="refentrytitle">DROP FUNCTION</span></a>,
10 and <a class="xref" href="sql-dropprocedure.html" title="DROP PROCEDURE"><span class="refentrytitle">DROP PROCEDURE</span></a> for the description of the
11 parameters, more examples, and further details.
12 </p></div><div class="refsect1" id="SQL-DROPROUTINE-NOTES"><h2>Notes</h2><p>
13 The lookup rules used by <code class="command">DROP ROUTINE</code> are
14 fundamentally the same as for <code class="command">DROP PROCEDURE</code>; in
15 particular, <code class="command">DROP ROUTINE</code> shares that command's
16 behavior of considering an argument list that has
17 no <em class="replaceable"><code>argmode</code></em> markers to be
18 possibly using the SQL standard's definition that <code class="literal">OUT</code>
19 arguments are included in the list. (<code class="command">DROP AGGREGATE</code>
20 and <code class="command">DROP FUNCTION</code> do not do that.)
22 In some cases where the same name is shared by routines of different
23 kinds, it is possible for <code class="command">DROP ROUTINE</code> to fail with
24 an ambiguity error when a more specific command (<code class="command">DROP
25 FUNCTION</code>, etc.) would work. Specifying the argument type
26 list more carefully will also resolve such problems.
28 These lookup rules are also used by other commands that
29 act on existing routines, such as <code class="command">ALTER ROUTINE</code>
30 and <code class="command">COMMENT ON ROUTINE</code>.
31 </p></div><div class="refsect1" id="SQL-DROPROUTINE-EXAMPLES"><h2>Examples</h2><p>
32 To drop the routine <code class="literal">foo</code> for type
33 <code class="type">integer</code>:
34 </p><pre class="programlisting">
35 DROP ROUTINE foo(integer);
37 This command will work independent of whether <code class="literal">foo</code> is an
38 aggregate, function, or procedure.
39 </p></div><div class="refsect1" id="SQL-DROPROUTINE-COMPATIBILITY"><h2>Compatibility</h2><p>
40 This command conforms to the SQL standard, with
41 these <span class="productname">PostgreSQL</span> extensions:
42 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The standard only allows one routine to be dropped per command.</p></li><li class="listitem"><p>The <code class="literal">IF EXISTS</code> option is an extension.</p></li><li class="listitem"><p>The ability to specify argument modes and names is an
43 extension, and the lookup rules differ when modes are given.</p></li><li class="listitem"><p>User-definable aggregate functions are an extension.</p></li></ul></div></div><div class="refsect1" id="id-1.9.3.127.9"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-dropaggregate.html" title="DROP AGGREGATE"><span class="refentrytitle">DROP AGGREGATE</span></a>, <a class="xref" href="sql-dropfunction.html" title="DROP FUNCTION"><span class="refentrytitle">DROP FUNCTION</span></a>, <a class="xref" href="sql-dropprocedure.html" title="DROP PROCEDURE"><span class="refentrytitle">DROP PROCEDURE</span></a>, <a class="xref" href="sql-alterroutine.html" title="ALTER ROUTINE"><span class="refentrytitle">ALTER ROUTINE</span></a></span><p>
44 Note that there is no <code class="literal">CREATE ROUTINE</code> command.
45 </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-droprole.html" title="DROP ROLE">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-droprule.html" title="DROP RULE">Next</a></td></tr><tr><td width="40%" align="left" valign="top">DROP ROLE </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> DROP RULE</td></tr></table></div></body></html>