Skip to main content
Version: 1.0.16

ALTER ROUTINE

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_USER | SESSION_USER }

ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]

SET SCHEMA new_schema

ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]

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 regular function, or a procedure. See ALTER AGGREGATE, ALTER FUNCTION, and ALTER PROCEDURE for parameter descriptions, 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 works regardless of whether foo is an aggregate, function, or procedure.

See Also

ALTER AGGREGATE, ALTER FUNCTION, ALTER PROCEDURE, DROP ROUTINE Note that there is no CREATE ROUTINE command.