# phpman > man > ALTER_ROUTINE(7)

ALTER [ROUTINE(7)](https://www.chedong.com/phpMan.php/man/ROUTINE/7/markdown)                   PostgreSQL 14.23 Documentation                   ALTER [ROUTINE(7)](https://www.chedong.com/phpMan.php/man/ROUTINE/7/markdown)



## NAME
       ALTER_ROUTINE - change the definition of a routine

## SYNOPSIS
       ALTER ROUTINE _name_ [ ( [ [ _argmode_ ] [ _argname_ ] _argtype_ [, ...] ] ) ]
           _action_ [ ... ] [ RESTRICT ]
       ALTER ROUTINE _name_ [ ( [ [ _argmode_ ] [ _argname_ ] _argtype_ [, ...] ] ) ]
           RENAME TO _new_name_
       ALTER ROUTINE _name_ [ ( [ [ _argmode_ ] [ _argname_ ] _argtype_ [, ...] ] ) ]
           OWNER TO { _new_owner_ | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
       ALTER ROUTINE _name_ [ ( [ [ _argmode_ ] [ _argname_ ] _argtype_ [, ...] ] ) ]
           SET SCHEMA _new_schema_
       ALTER ROUTINE _name_ [ ( [ [ _argmode_ ] [ _argname_ ] _argtype_ [, ...] ] ) ]
           [ NO ] DEPENDS ON EXTENSION _extension_name_

       where _action_ is one of:

           IMMUTABLE | STABLE | VOLATILE
           [ NOT ] LEAKPROOF
           [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
           PARALLEL { UNSAFE | RESTRICTED | SAFE }
           COST _execution_cost_
           ROWS _result_rows_
           SET _configuration_parameter_ { TO | = } { _value_ | DEFAULT }
           SET _configuration_parameter_ FROM CURRENT
           RESET _configuration_parameter_
           RESET ALL

## DESCRIPTION
       **ALTER** **ROUTINE** changes the definition of a routine, which can be an aggregate function, a
       normal function, or a procedure. See under ALTER AGGREGATE (**ALTER**___**[AGGREGATE**(7)](https://www.chedong.com/phpMan.php/man/AGGREGATE/7/markdown)), ALTER
       FUNCTION (**ALTER**___**[FUNCTION**(7)](https://www.chedong.com/phpMan.php/man/FUNCTION/7/markdown)), and ALTER PROCEDURE (**ALTER**___**[PROCEDURE**(7)](https://www.chedong.com/phpMan.php/man/PROCEDURE/7/markdown)) for the description of
       the parameters, more examples, and further details.

## EXAMPLES
       To rename the routine foo for type integer to foobar:

           ALTER ROUTINE foo(integer) RENAME TO foobar;

       This command will work independent of whether foo is an aggregate, function, or procedure.

## COMPATIBILITY
       This statement is partially compatible with the **ALTER** **ROUTINE** statement in the SQL standard.
       See under ALTER FUNCTION (**ALTER**___**[FUNCTION**(7)](https://www.chedong.com/phpMan.php/man/FUNCTION/7/markdown)) and ALTER PROCEDURE (**ALTER**___**[PROCEDURE**(7)](https://www.chedong.com/phpMan.php/man/PROCEDURE/7/markdown)) for
       more details. Allowing routine names to refer to aggregate functions is a PostgreSQL
       extension.

## SEE ALSO
       ALTER AGGREGATE (**ALTER**___**[AGGREGATE**(7)](https://www.chedong.com/phpMan.php/man/AGGREGATE/7/markdown)), ALTER FUNCTION (**ALTER**___**[FUNCTION**(7)](https://www.chedong.com/phpMan.php/man/FUNCTION/7/markdown)), ALTER PROCEDURE
       (**ALTER**___**[PROCEDURE**(7)](https://www.chedong.com/phpMan.php/man/PROCEDURE/7/markdown)), DROP ROUTINE (**DROP**___**[ROUTINE**(7)](https://www.chedong.com/phpMan.php/man/ROUTINE/7/markdown))

       Note that there is no CREATE ROUTINE command.



PostgreSQL 14.23                                2026                                ALTER [ROUTINE(7)](https://www.chedong.com/phpMan.php/man/ROUTINE/7/markdown)
