ALTER ROUTINE(7) PostgreSQL 18.6 Documentation ALTER ROUTINE(7) 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 aggre- gate function, a normal function, or a procedure. See under ALTER AGGREGATE (ALTER_AGGREGATE(7)), ALTER FUNCTION (ALTER_FUNCTION(7)), and ALTER PROCE- DURE (ALTER_PROCEDURE(7)) for the description of the parameters, more exam- ples, 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, func- tion, or procedure. COMPATIBILITY This statement is partially compatible with the ALTER ROUTINE statement in the SQL standard. See under ALTER FUNCTION (ALTER_FUNCTION(7)) and ALTER PROCEDURE (ALTER_PROCEDURE(7)) for more details. Allowing routine names to refer to aggregate functions is a PostgreSQL extension. SEE ALSO ALTER AGGREGATE (ALTER_AGGREGATE(7)), ALTER FUNCTION (ALTER_FUNCTION(7)), ALTER PROCEDURE (ALTER_PROCEDURE(7)), DROP ROUTINE (DROP_ROUTINE(7)) Note that there is no CREATE ROUTINE command. PostgreSQL 18.6 2026 ALTER ROUTINE(7)
NAME | SYNOPSIS | DESCRIPTION | EXAMPLES | COMPATIBILITY | SEE ALSO
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=ALTER_ROUTINE&sektion=7&manpath=FreeBSD+Ports+15.1.quarterly>
