# man > ALTER_FUNCTION(7)

---
type: CommandReference
command: ALTER FUNCTION
mode: man
section: 7
source: man-pages
---

## Quick Reference
- `ALTER FUNCTION name ( args ) RENAME TO new_name` — Rename function
- `ALTER FUNCTION name ( args ) OWNER TO new_owner` — Change owner
- `ALTER FUNCTION name ( args ) SET SCHEMA new_schema` — Move to new schema
- `ALTER FUNCTION name ( args ) DEPENDS ON EXTENSION ext` — Mark dependent on extension
- `ALTER FUNCTION name ( args ) SET param = value` — Set configuration parameter
- `ALTER FUNCTION name ( args ) RESET param` — Reset configuration parameter to default
- `ALTER FUNCTION name ( args ) STRICT` — Make function return NULL on NULL input
- `ALTER FUNCTION name ( args ) IMMUTABLE` — Set volatility to IMMUTABLE

## Name
ALTER FUNCTION — change the definition of a function

## Synopsis
sql
ALTER FUNCTION name ( [ [ argmode ] [ argname ] argtype [, ...] ] )
    action [ ... ] [ RESTRICT ]

ALTER FUNCTION name ( [ [ argmode ] [ argname ] argtype [, ...] ] )
    RENAME TO new_name

ALTER FUNCTION name ( [ [ argmode ] [ argname ] argtype [, ...] ] )
    OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }

ALTER FUNCTION name ( [ [ argmode ] [ argname ] argtype [, ...] ] )
    SET SCHEMA new_schema

ALTER FUNCTION name ( [ [ argmode ] [ argname ] argtype [, ...] ] )
    [ NO ] DEPENDS ON EXTENSION extension_name
where `action` can be:

sql
CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
IMMUTABLE | STABLE | VOLATILE
[ NOT ] LEAKPROOF
[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
PARALLEL { UNSAFE | RESTRICTED | SAFE }
COST execution_cost
ROWS result_rows
SUPPORT support_function
SET configuration_parameter { TO | = } { value | DEFAULT }
SET configuration_parameter FROM CURRENT
RESET configuration_parameter
RESET ALL
## Options
- `name` — The name (optionally schema-qualified) of an existing function. If no argument list is given, the name must be unique in its schema.
- `argmode` — Argument mode: IN (default), OUT, INOUT, or VARIADIC. Only IN, INOUT, and VARIADIC arguments are needed for function identity.
- `argname` — Argument name; ignored for identity, only types matter.
- `argtype` — Data type(s) of the function’s arguments (optionally schema-qualified).
- `RENAME TO new_name` — Rename the function.
- `OWNER TO new_owner` — Change function owner. If the function is `SECURITY DEFINER`, it will execute as the new owner.
- `SET SCHEMA new_schema` — Move the function to a different schema.
- `[ NO ] DEPENDS ON EXTENSION extension_name` — Mark or unmark the function as dependent on an extension. When the extension is dropped, dependent functions are dropped as well.
- `CALLED ON NULL INPUT` — Invoke function even if some arguments are NULL.
- `RETURNS NULL ON NULL INPUT` / `STRICT` — Do not invoke function if any argument is NULL; return NULL automatically.
- `IMMUTABLE` / `STABLE` / `VOLATILE` — Change the function’s volatility.
- `[ NOT ] LEAKPROOF` — Change whether the function is considered leakproof.
- `[ EXTERNAL ] SECURITY INVOKER` / `SECURITY DEFINER` — Change security context. `EXTERNAL` is ignored (SQL conformance).
- `PARALLEL { UNSAFE | RESTRICTED | SAFE }` — Change parallelism safety setting.
- `COST execution_cost` — Set estimated execution cost.
- `ROWS result_rows` — Set estimated number of rows for a set-returning function.
- `SUPPORT support_function` — Set or change the planner support function (superuser only). Cannot be used to remove the support function entirely.
- `SET configuration_parameter { TO | = } { value | DEFAULT }` — Set a configuration parameter for the function.
- `SET configuration_parameter FROM CURRENT` — Save the current value of the parameter as the function-local setting.
- `RESET configuration_parameter` — Remove the function-local setting; the function inherits the environment’s value.
- `RESET ALL` — Clear all function-local settings.
- `RESTRICT` — Ignored for SQL standard conformance.

## Examples
sql
ALTER FUNCTION sqrt(integer) RENAME TO square_root;
sql
ALTER FUNCTION sqrt(integer) OWNER TO joe;
sql
ALTER FUNCTION sqrt(integer) SET SCHEMA maths;
sql
ALTER FUNCTION sqrt(integer) DEPENDS ON EXTENSION mathlib;
sql
ALTER FUNCTION check_password(text) SET search_path = admin, pg_temp;
sql
ALTER FUNCTION check_password(text) RESET search_path;
## See Also
- [CREATE FUNCTION](http://localhost/phpMan.php/man/CREATE_FUNCTION/7/markdown)
- [DROP FUNCTION](http://localhost/phpMan.php/man/DROP_FUNCTION/7/markdown)
- [ALTER PROCEDURE](http://localhost/phpMan.php/man/ALTER_PROCEDURE/7/markdown)
- [ALTER ROUTINE](http://localhost/phpMan.php/man/ALTER_ROUTINE/7/markdown)