---
title: "DROP FUNCTION"
url: "https://docs.yugabyte.com/stable/api/ysql/the-sql-language/statements/ddl_drop_function/"
---

# DROP FUNCTION

Remove a function from a database.

## Synopsis

Use the `DROP FUNCTION` statement to remove a function from a database.

## Syntax

- [![Grammar Icon](/icons/file-lines.svg)Grammar](#grammar-1)
- [![Diagram Icon](/icons/diagram.svg)Diagram](#diagram-1)

```output.ebnf
drop_function ::= DROP FUNCTION [ IF EXISTS ]  
                  { subprogram_name ( [ subprogram_signature ] ) } 
                  [ , ... ] [ CASCADE | RESTRICT ]

subprogram_signature ::= arg_decl [ , ... ]

arg_decl ::= [ formal_arg ] [ arg_mode ] arg_type
```

#### drop\_function

DROPFUNCTIONIFEXISTS,[subprogram\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#subprogram-name)([subprogram\_signature](#subprogram-signature))CASCADERESTRICT

#### subprogram\_signature

,[arg\_decl](#arg-decl)

#### arg\_decl

[formal\_arg](/stable/api/ysql/syntax_resources/grammar_diagrams#formal-arg)[arg\_mode](/stable/api/ysql/syntax_resources/grammar_diagrams#arg-mode)[arg\_type](/stable/api/ysql/syntax_resources/grammar_diagrams#arg-type)

You must identify the to-be-dropped function by:

- Its name and the schema where it lives. This can be done by using its fully qualified name or by using just its bare name and letting name resolution find it in the first schema on the *search\_path* where it occurs. Notice that you don't need to (and cannot) mention the name of its owner.
- Its signature. The [*subprogram\_call\_signature*](/stable/api/ysql/user-defined-subprograms-and-anon-blocks/subprogram-overloading/#subprogram-call-signature "subprogram_call_signature") is sufficient; and this is typically used. You can use the full *subprogram\_signature*. But you should realize that the *formal\_arg* and *arg\_mode* for each *arg\_decl* carry no identifying information. (This is why it is not typically used when a function or procedure is to be altered or dropped.) This is explained in the section [Subprogram overloading](/stable/api/ysql/user-defined-subprograms-and-anon-blocks/subprogram-overloading/ "Subprogram overloading").

## Semantics

- An error will be thrown if the function does not exist unless `IF EXISTS` is used. Then a notice is issued instead.
- `RESTRICT` is the default and it will not drop the function if any objects depend on it.
- `CASCADE` will drop any objects that transitively depend on the function.

## Examples

```plpgsql
DROP FUNCTION IF EXISTS inc(i integer), mul(integer, integer) CASCADE;
```

## See also

- [CREATE FUNCTION](/stable/api/ysql/the-sql-language/statements/ddl_create_function "CREATE FUNCTION")
- [ALTER FUNCTION](/stable/api/ysql/the-sql-language/statements/ddl_alter_function "ALTER FUNCTION")
- [CREATE PROCEDURE](/stable/api/ysql/the-sql-language/statements/ddl_create_procedure "CREATE PROCEDURE")
- [ALTER PROCEDURE](/stable/api/ysql/the-sql-language/statements/ddl_alter_procedure "ALTER PROCEDURE")
- [DROP PROCEDURE](/stable/api/ysql/the-sql-language/statements/ddl_drop_procedure "DROP PROCEDURE")
