DROP FUNCTION v14

Name

DROP FUNCTION -- remove a function.

Synopsis

DROP FUNCTION [ IF EXISTS ] <name>
  [ ([ [ <argmode> ] [ <argname> ] <argtype> ] [, ...]) ]
  [ CASCADE | RESTRICT ]

Description

DROP FUNCTION removes the definition of an existing function. To execute this command you must be a superuser or the owner of the function. All input (IN, IN OUT) argument data types to the function must be specified if this is an overloaded function. (This requirement is not compatible with Oracle databases. In Oracle, only the function name is specified. EDB Postgres Advanced Server allows overloading of function names, so the function signature given by the input argument data types is required in the EDB Postgres Advanced Server DROP FUNCTION command of an overloaded function.)

Usage of IF EXISTS, CASCADE, or RESTRICT is not compatible with Oracle databases and is used only by EDB Postgres Advanced Server.

Parameters

IF EXISTS

Don't throw an error if the function does not exist. A notice is issued in this case.

name

The name (optionally schema-qualified) of an existing function.

argmode

The mode of an argument: IN, IN OUT, or OUT. If omitted, the default is IN. Note that DROP FUNCTION does not actually pay any attention to OUT arguments, since only the input arguments are needed to determine the function’s identity. So it is sufficient to list only the IN and IN OUT arguments. (Specification of argmode is not compatible with Oracle databases and applies only to EDB Postgres Advanced Server.)

argname

The name of an argument. Note that DROP FUNCTION does not actually pay any attention to argument names, since only the argument data types are needed to determine the function’s identity. (Specification of argname is not compatible with Oracle databases and applies only to EDB Postgres Advanced Server.)

argtype

The data type of an argument of the function. (Specification of argtype is not compatible with Oracle databases and applies only to EDB Postgres Advanced Server.)

CASCADE

Automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects.

RESTRICT

Refuse to drop the function if any objects depend on it. This is the default.

Examples

The following command removes the emp_comp function.

DROP FUNCTION emp_comp(NUMBER, NUMBER);

See also

CREATE FUNCTION