> ## Documentation Index
> Fetch the complete documentation index at: https://docs.risingwave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DROP FUNCTION

Use the `DROP FUNCTION` command to remove an existing [user-defined function (UDF)](https://docs.risingwave.com/sql/udfs/user-defined-functions.md).

## Syntax

```sql theme={null}
DROP FUNCTION [ IF EXISTS ] function_name [ ( argument_type [, ...] ) ] [ CASCADE ];
```

| Parameter or clause | Description |
| :- | :- |
| *function\_name* | Name of the UDF you want to drop. |
| ( *argument\_type* \[ , ... ] ) | Optional: Argument types of the function.Specify the argument types when the name of the function you want to drop isn't unique within the schema. |
| IF EXISTS | Do not return an error if the specified function does not exist. A notice is issued in this case. |
| **CASCADE** option | If this option is specified, all objects (such as materialized views) that depend on the function, and in turn all objects that depend on those objects will be dropped. |

## Usage

A function can be dropped using one of the following methods:

* Full function signature:

```sql theme={null}
DROP FUNCTION function_name ( argument_type [, ...] );
```

* Function name only, if it's unique in its schema:

```sql theme={null}
DROP FUNCTION function_name;
```

You can run [SHOW FUNCTIONS;](https://docs.risingwave.com/sql/commands/sql-show-functions.md) to list all existing UDFs to see if a function name is unique.

> [!TIP]
>
> `DROP FUNCTION function_name();` drops a function with zero arguments.
>
> `DROP FUNCTION function_name;` drops a function with any number of arguments, including zero, as long as the name is unique.

## Examples

First, let's [create some functions](https://docs.risingwave.com/sql/commands/sql-create-function.md).

```sql theme={null}
CREATE FUNCTION f1() RETURNS real LANGUAGE python AS func1 USING LINK 'http://localhost:8815';
CREATE FUNCTION f1(int) RETURNS int LANGUAGE python AS func2 USING LINK 'http://localhost:8815';
CREATE FUNCTION f1(int,int) RETURNS int LANGUAGE python AS func3 USING LINK 'http://localhost:8815';
CREATE FUNCTION f2(int,int) RETURNS int LANGUAGE python AS func4 USING LINK 'http://localhost:8815';
```

You can drop a unique function by name:

```sql theme={null}
DROP FUNCTION f2;
```

You cannot drop a function by name when its name is not unique:

```sql theme={null}
DROP FUNCTION f1;
```

```sql theme={null}
ERROR:  QueryError: Catalog error: function name "f1" is not unique
HINT: Specify the argument list to select the function unambiguously.
```

You can drop a function by full signature:

```sql theme={null}
DROP FUNCTION f1();
DROP FUNCTION f1(int);
```

Now, `f1(int,int)` is the only function named `f1`, you can drop it by name or full signature:

```sql theme={null}
DROP FUNCTION f1;
-- Or DROP FUNCTION f1(int,int);
```

## See also

> [card] [User-defined functions](https://docs.risingwave.com/sql/udfs/user-defined-functions.md)
>
> A step-by-step guide for using UDFs in RisingWave: installing the RisingWave UDF API, defining functions in a Python file, starting the UDF server, and declaring UDFs in RisingWave.

> [card] [SHOW FUNCTIONS](https://docs.risingwave.com/sql/commands/sql-show-functions.md)
>
> Show all existing UDFs


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.