Menu
Amazon Redshift
Database Developer Guide (API Version 2012-12-01)

DROP FUNCTION

Removes a user-defined function (UDF) from the database. The function's signature, or list of argument data types, must be specified because multiple functions can exist with the same name but different signatures. You cannot drop an Amazon Redshift built-in function.

This command is not reversible.

Syntax

Copy
DROP FUNCTION name ( [arg_name] arg_type [, ...] ) [ CASCADE | RESTRICT ]

Parameters

name

The name of the function to be removed.

arg_name

The name of an input argument. DROP FUNCTION ignores argument names, because only the argument data types are needed to determine the function's identity.

arg_type

The data type of the input argument. You can supply a comma-separated list with a maximum of 32 data types.

CASCADE

Keyword specifying to automatically drop objects that depend on the function.

RESTRICT

Keyword specifying that if any objects depend on depend on the function, do not drop the function and return a message. This action is the default.

Examples

The following example drops the function named f_sqrt:

Copy
drop function f_sqrt(int);

To remove a function that has dependencies, use the CASCADE option, as shown in the following example:

Copy
drop function f_sqrt(int)cascade;