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 sql-alteraggregate, sql-alterfunction, and sql-alterprocedure 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;
foo is an aggregate, function, or procedure.
Compatibility
This statement is partially compatible with the ALTER ROUTINE statement in the SQL standard. See under sql-alterfunction and sql-alterprocedure for more details. Allowing routine names to refer to aggregate functions is a PostgreSQL extension.
See Also
sql-alteraggregate, sql-alterfunction, sql-alterprocedure, sql-droproutine
Note that there is no CREATE ROUTINE command.