| 1 |
<!-- |
| 2 |
doc/src/sgml/ref/drop_routine.sgml |
| 3 |
PostgreSQL documentation |
| 4 |
--> |
| 5 |
|
| 6 |
<refentry id="sql-droproutine"> |
| 7 |
<indexterm zone="sql-droproutine"> |
| 8 |
<primary>DROP ROUTINE</primary> |
| 9 |
</indexterm> |
| 10 |
|
| 11 |
<refmeta> |
| 12 |
<refentrytitle>DROP ROUTINE</refentrytitle> |
| 13 |
<manvolnum>7</manvolnum> |
| 14 |
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 15 |
</refmeta> |
| 16 |
|
| 17 |
<refnamediv> |
| 18 |
<refname>DROP ROUTINE</refname> |
| 19 |
<refpurpose>remove a routine</refpurpose> |
| 20 |
</refnamediv> |
| 21 |
|
| 22 |
<refsynopsisdiv> |
| 23 |
<synopsis> |
| 24 |
DROP ROUTINE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] [, ...] |
| 25 |
[ CASCADE | RESTRICT ] |
| 26 |
</synopsis> |
| 27 |
</refsynopsisdiv> |
| 28 |
|
| 29 |
<refsect1> |
| 30 |
<title>Description</title> |
| 31 |
|
| 32 |
<para> |
| 33 |
<command>DROP ROUTINE</command> removes the definition of one or more |
| 34 |
existing routines. The term <quote>routine</quote> includes |
| 35 |
aggregate functions, normal functions, and procedures. See |
| 36 |
under <xref linkend="sql-dropaggregate"/>, <xref linkend="sql-dropfunction"/>, |
| 37 |
and <xref linkend="sql-dropprocedure"/> for the description of the |
| 38 |
parameters, more examples, and further details. |
| 39 |
</para> |
| 40 |
</refsect1> |
| 41 |
|
| 42 |
<refsect1 id="sql-droproutine-notes"> |
| 43 |
<title>Notes</title> |
| 44 |
|
| 45 |
<para> |
| 46 |
The lookup rules used by <command>DROP ROUTINE</command> are |
| 47 |
fundamentally the same as for <command>DROP PROCEDURE</command>; in |
| 48 |
particular, <command>DROP ROUTINE</command> shares that command's |
| 49 |
behavior of considering an argument list that has |
| 50 |
no <replaceable class="parameter">argmode</replaceable> markers to be |
| 51 |
possibly using the SQL standard's definition that <literal>OUT</literal> |
| 52 |
arguments are included in the list. (<command>DROP AGGREGATE</command> |
| 53 |
and <command>DROP FUNCTION</command> do not do that.) |
| 54 |
</para> |
| 55 |
|
| 56 |
<para> |
| 57 |
In some cases where the same name is shared by routines of different |
| 58 |
kinds, it is possible for <command>DROP ROUTINE</command> to fail with |
| 59 |
an ambiguity error when a more specific command (<command>DROP |
| 60 |
FUNCTION</command>, etc.) would work. Specifying the argument type |
| 61 |
list more carefully will also resolve such problems. |
| 62 |
</para> |
| 63 |
|
| 64 |
<para> |
| 65 |
These lookup rules are also used by other commands that |
| 66 |
act on existing routines, such as <command>ALTER ROUTINE</command> |
| 67 |
and <command>COMMENT ON ROUTINE</command>. |
| 68 |
</para> |
| 69 |
</refsect1> |
| 70 |
|
| 71 |
<refsect1 id="sql-droproutine-examples"> |
| 72 |
<title>Examples</title> |
| 73 |
|
| 74 |
<para> |
| 75 |
To drop the routine <literal>foo</literal> for type |
| 76 |
<type>integer</type>: |
| 77 |
<programlisting> |
| 78 |
DROP ROUTINE foo(integer); |
| 79 |
</programlisting> |
| 80 |
This command will work independent of whether <literal>foo</literal> is an |
| 81 |
aggregate, function, or procedure. |
| 82 |
</para> |
| 83 |
</refsect1> |
| 84 |
|
| 85 |
<refsect1 id="sql-droproutine-compatibility"> |
| 86 |
<title>Compatibility</title> |
| 87 |
|
| 88 |
<para> |
| 89 |
This command conforms to the SQL standard, with |
| 90 |
these <productname>PostgreSQL</productname> extensions: |
| 91 |
<itemizedlist> |
| 92 |
<listitem> |
| 93 |
<para>The standard only allows one routine to be dropped per command.</para> |
| 94 |
</listitem> |
| 95 |
<listitem> |
| 96 |
<para>The <literal>IF EXISTS</literal> option is an extension.</para> |
| 97 |
</listitem> |
| 98 |
<listitem> |
| 99 |
<para>The ability to specify argument modes and names is an |
| 100 |
extension, and the lookup rules differ when modes are given.</para> |
| 101 |
</listitem> |
| 102 |
<listitem> |
| 103 |
<para>User-definable aggregate functions are an extension.</para> |
| 104 |
</listitem> |
| 105 |
</itemizedlist></para> |
| 106 |
</refsect1> |
| 107 |
|
| 108 |
<refsect1> |
| 109 |
<title>See Also</title> |
| 110 |
|
| 111 |
<simplelist type="inline"> |
| 112 |
<member><xref linkend="sql-dropaggregate"/></member> |
| 113 |
<member><xref linkend="sql-dropfunction"/></member> |
| 114 |
<member><xref linkend="sql-dropprocedure"/></member> |
| 115 |
<member><xref linkend="sql-alterroutine"/></member> |
| 116 |
</simplelist> |
| 117 |
|
| 118 |
<para> |
| 119 |
Note that there is no <literal>CREATE ROUTINE</literal> command. |
| 120 |
</para> |
| 121 |
</refsect1> |
| 122 |
|
| 123 |
</refentry> |