1999-07-22 17:09:15 +02:00
|
|
|
<!--
|
2010-09-20 22:08:53 +02:00
|
|
|
doc/src/sgml/ref/drop_function.sgml
|
2001-12-08 04:24:40 +01:00
|
|
|
PostgreSQL documentation
|
1999-07-22 17:09:15 +02:00
|
|
|
-->
|
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<refentry id="SQL-DROPFUNCTION">
|
2014-02-24 03:25:35 +01:00
|
|
|
<indexterm zone="sql-dropfunction">
|
|
|
|
<primary>DROP FUNCTION</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<refmeta>
|
2010-04-03 09:23:02 +02:00
|
|
|
<refentrytitle>DROP FUNCTION</refentrytitle>
|
2008-11-14 11:22:48 +01:00
|
|
|
<manvolnum>7</manvolnum>
|
1999-07-06 19:16:42 +02:00
|
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
|
|
|
</refmeta>
|
2003-05-04 04:23:16 +02:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<refnamediv>
|
2003-05-04 04:23:16 +02:00
|
|
|
<refname>DROP FUNCTION</refname>
|
2003-09-22 02:16:58 +02:00
|
|
|
<refpurpose>remove a function</refpurpose>
|
1998-12-29 03:24:47 +01:00
|
|
|
</refnamediv>
|
2003-05-04 04:23:16 +02:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<refsynopsisdiv>
|
2003-05-04 04:23:16 +02:00
|
|
|
<synopsis>
|
2017-03-10 05:58:48 +01:00
|
|
|
DROP FUNCTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] [, ...]
|
2005-05-26 22:05:03 +02:00
|
|
|
[ CASCADE | RESTRICT ]
|
2003-05-04 04:23:16 +02:00
|
|
|
</synopsis>
|
1999-07-06 19:16:42 +02:00
|
|
|
</refsynopsisdiv>
|
|
|
|
|
2003-05-04 04:23:16 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<para>
|
2003-05-04 04:23:16 +02:00
|
|
|
<command>DROP FUNCTION</command> removes the definition of an existing
|
1998-05-13 07:34:00 +02:00
|
|
|
function. To execute this command the user must be the
|
2003-05-04 04:23:16 +02:00
|
|
|
owner of the function. The argument types to the
|
2001-11-19 04:58:25 +01:00
|
|
|
function must be specified, since several different functions
|
Update reference documentation on may/can/might:
Standard English uses "may", "can", and "might" in different ways:
may - permission, "You may borrow my rake."
can - ability, "I can lift that log."
might - possibility, "It might rain today."
Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice. Similarly, "It may crash" is better stated, "It might crash".
2007-02-01 00:26:05 +01:00
|
|
|
can exist with the same name and different argument lists.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
2001-09-13 21:40:34 +02:00
|
|
|
</refsect1>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2003-05-04 04:23:16 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Parameters</title>
|
|
|
|
|
|
|
|
<variablelist>
|
2006-06-17 00:27:55 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term><literal>IF EXISTS</literal></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2010-11-23 21:27:50 +01:00
|
|
|
Do not throw an error if the function does not exist. A notice is issued
|
2006-06-17 00:27:55 +02:00
|
|
|
in this case.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2003-05-04 04:23:16 +02:00
|
|
|
<term><replaceable class="parameter">name</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2017-03-10 05:58:48 +01:00
|
|
|
The name (optionally schema-qualified) of an existing function. If no
|
|
|
|
argument list is specified, the name must be unique in its schema.
|
2003-05-04 04:23:16 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2005-05-26 22:05:03 +02:00
|
|
|
<term><replaceable class="parameter">argmode</replaceable></term>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2008-07-16 03:30:23 +02:00
|
|
|
The mode of an argument: <literal>IN</>, <literal>OUT</>,
|
|
|
|
<literal>INOUT</>, or <literal>VARIADIC</>.
|
|
|
|
If omitted, the default is <literal>IN</>.
|
2005-05-26 22:05:03 +02:00
|
|
|
Note that <command>DROP FUNCTION</command> does not actually pay
|
|
|
|
any attention to <literal>OUT</> arguments, since only the input
|
|
|
|
arguments are needed to determine the function's identity.
|
2008-07-16 03:30:23 +02:00
|
|
|
So it is sufficient to list the <literal>IN</>, <literal>INOUT</>,
|
|
|
|
and <literal>VARIADIC</> arguments.
|
2005-05-26 22:05:03 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><replaceable class="parameter">argname</replaceable></term>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The name of an argument.
|
|
|
|
Note that <command>DROP FUNCTION</command> does not actually pay
|
|
|
|
any attention to argument names, since only the argument data
|
|
|
|
types are needed to determine the function's identity.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><replaceable class="parameter">argtype</replaceable></term>
|
|
|
|
|
2003-05-04 04:23:16 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2010-11-23 21:27:50 +01:00
|
|
|
The data type(s) of the function's arguments (optionally
|
2005-05-26 22:05:03 +02:00
|
|
|
schema-qualified), if any.
|
2003-05-04 04:23:16 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><literal>CASCADE</literal></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Automatically drop objects that depend on the function (such as
|
2016-08-13 00:45:18 +02:00
|
|
|
operators or triggers),
|
|
|
|
and in turn all objects that depend on those objects
|
|
|
|
(see <xref linkend="ddl-depend">).
|
2003-05-04 04:23:16 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><literal>RESTRICT</literal></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Refuse to drop the function if any objects depend on it. This
|
|
|
|
is the default.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
|
2001-09-13 21:40:34 +02:00
|
|
|
<refsect1 id="SQL-DROPFUNCTION-examples">
|
|
|
|
<title>Examples</title>
|
1999-07-22 17:09:15 +02:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<para>
|
1998-05-13 07:34:00 +02:00
|
|
|
This command removes the square root function:
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2001-09-13 21:40:34 +02:00
|
|
|
<programlisting>
|
|
|
|
DROP FUNCTION sqrt(integer);
|
2016-12-28 18:00:00 +01:00
|
|
|
</programlisting></para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Drop multiple functions in one command:
|
|
|
|
<programlisting>
|
|
|
|
DROP FUNCTION sqrt(integer), sqrt(bigint);
|
2011-08-07 09:49:45 +02:00
|
|
|
</programlisting></para>
|
2017-03-10 05:58:48 +01:00
|
|
|
|
|
|
|
<para>
|
|
|
|
If the function name is unique in its schema, it can be referred to without
|
|
|
|
an argument list:
|
|
|
|
<programlisting>
|
|
|
|
DROP FUNCTION update_employee_salaries;
|
|
|
|
</programlisting>
|
|
|
|
Note that this is different from
|
|
|
|
<programlisting>
|
|
|
|
DROP FUNCTION update_employee_salaries();
|
|
|
|
</programlisting>
|
|
|
|
which refers to a function with zero arguments, whereas the first variant
|
|
|
|
can refer to a function with any number of arguments, including zero, as
|
|
|
|
long as the name is unique.
|
|
|
|
</para>
|
1999-07-06 19:16:42 +02:00
|
|
|
</refsect1>
|
1998-12-29 03:24:47 +01:00
|
|
|
|
2001-09-13 21:40:34 +02:00
|
|
|
<refsect1 id="SQL-DROPFUNCTION-compatibility">
|
|
|
|
<title>Compatibility</title>
|
2010-11-23 21:27:50 +01:00
|
|
|
|
2001-09-13 21:40:34 +02:00
|
|
|
<para>
|
2017-03-10 05:58:48 +01:00
|
|
|
This command conforms to the SQL standard, with
|
|
|
|
these <productname>PostgreSQL</productname> extensions:
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>The standard only allows one function to be dropped per command.</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>The <literal>IF EXISTS</literal> option</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>The ability to specify argument modes and names</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
2001-09-13 21:40:34 +02:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
1999-07-22 17:09:15 +02:00
|
|
|
|
2001-09-13 21:40:34 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
|
|
|
|
|
|
|
<simplelist type="inline">
|
2010-04-03 09:23:02 +02:00
|
|
|
<member><xref linkend="sql-createfunction"></member>
|
|
|
|
<member><xref linkend="sql-alterfunction"></member>
|
2001-09-13 21:40:34 +02:00
|
|
|
</simplelist>
|
1998-05-13 07:34:00 +02:00
|
|
|
</refsect1>
|
2003-05-04 04:23:16 +02:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
</refentry>
|