1<!--
2doc/src/sgml/ref/drop_procedure.sgml
3PostgreSQL documentation
4-->
5
6<refentry id="sql-dropprocedure">
7 <indexterm zone="sql-dropprocedure">
8  <primary>DROP PROCEDURE</primary>
9 </indexterm>
10
11 <refmeta>
12  <refentrytitle>DROP PROCEDURE</refentrytitle>
13  <manvolnum>7</manvolnum>
14  <refmiscinfo>SQL - Language Statements</refmiscinfo>
15 </refmeta>
16
17 <refnamediv>
18  <refname>DROP PROCEDURE</refname>
19  <refpurpose>remove a procedure</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23<synopsis>
24DROP PROCEDURE [ 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 PROCEDURE</command> removes the definition of an existing
34   procedure. To execute this command the user must be the
35   owner of the procedure. The argument types to the
36   procedure must be specified, since several different procedures
37   can exist with the same name and different argument lists.
38  </para>
39 </refsect1>
40
41 <refsect1>
42  <title>Parameters</title>
43
44  <variablelist>
45    <varlistentry>
46    <term><literal>IF EXISTS</literal></term>
47    <listitem>
48     <para>
49      Do not throw an error if the procedure does not exist. A notice is issued
50      in this case.
51     </para>
52    </listitem>
53   </varlistentry>
54
55  <varlistentry>
56    <term><replaceable class="parameter">name</replaceable></term>
57    <listitem>
58     <para>
59      The name (optionally schema-qualified) of an existing procedure.  If no
60      argument list is specified, the name must be unique in its schema.
61     </para>
62    </listitem>
63   </varlistentry>
64
65   <varlistentry>
66    <term><replaceable class="parameter">argmode</replaceable></term>
67
68    <listitem>
69     <para>
70      The mode of an argument: <literal>IN</literal> or <literal>VARIADIC</literal>.
71      If omitted, the default is <literal>IN</literal>.
72     </para>
73    </listitem>
74   </varlistentry>
75
76   <varlistentry>
77    <term><replaceable class="parameter">argname</replaceable></term>
78
79    <listitem>
80     <para>
81      The name of an argument.
82      Note that <command>DROP PROCEDURE</command> does not actually pay
83      any attention to argument names, since only the argument data
84      types are needed to determine the procedure's identity.
85     </para>
86    </listitem>
87   </varlistentry>
88
89   <varlistentry>
90    <term><replaceable class="parameter">argtype</replaceable></term>
91
92    <listitem>
93     <para>
94      The data type(s) of the procedure's arguments (optionally
95      schema-qualified), if any.
96     </para>
97    </listitem>
98   </varlistentry>
99
100   <varlistentry>
101    <term><literal>CASCADE</literal></term>
102    <listitem>
103     <para>
104      Automatically drop objects that depend on the procedure,
105      and in turn all objects that depend on those objects
106      (see <xref linkend="ddl-depend"/>).
107     </para>
108    </listitem>
109   </varlistentry>
110
111   <varlistentry>
112    <term><literal>RESTRICT</literal></term>
113    <listitem>
114     <para>
115      Refuse to drop the procedure if any objects depend on it.  This
116      is the default.
117     </para>
118    </listitem>
119   </varlistentry>
120  </variablelist>
121 </refsect1>
122
123 <refsect1 id="sql-dropprocedure-examples">
124  <title>Examples</title>
125
126<programlisting>
127DROP PROCEDURE do_db_maintenance();
128</programlisting>
129 </refsect1>
130
131 <refsect1 id="sql-dropprocedure-compatibility">
132  <title>Compatibility</title>
133
134  <para>
135   This command conforms to the SQL standard, with
136   these <productname>PostgreSQL</productname> extensions:
137   <itemizedlist>
138    <listitem>
139     <para>The standard only allows one procedure to be dropped per command.</para>
140    </listitem>
141    <listitem>
142     <para>The <literal>IF EXISTS</literal> option</para>
143    </listitem>
144    <listitem>
145     <para>The ability to specify argument modes and names</para>
146    </listitem>
147   </itemizedlist></para>
148 </refsect1>
149
150 <refsect1>
151  <title>See Also</title>
152
153  <simplelist type="inline">
154   <member><xref linkend="sql-createprocedure"/></member>
155   <member><xref linkend="sql-alterprocedure"/></member>
156   <member><xref linkend="sql-dropfunction"/></member>
157   <member><xref linkend="sql-droproutine"/></member>
158  </simplelist>
159 </refsect1>
160
161</refentry>
162