ALTER ROUTINE
ALTER ROUTINE — change the definition of a routine
Synopsis
ALTER ROUTINEname[ ( [ [argmode] [argname]argtype[, ...] ] ) ]action[ ... ] [ RESTRICT ]ALTER ROUTINEname[ ( [ [argmode] [argname]argtype[, ...] ] ) ] RENAME TOnew_nameALTER ROUTINEname[ ( [ [argmode] [argname]argtype[, ...] ] ) ] OWNER TO {new_owner| CURRENT_ROLE | CURRENT_USER | SESSION_USER }ALTER ROUTINEname[ ( [ [argmode] [argname]argtype[, ...] ] ) ] SET SCHEMAnew_schemaALTER ROUTINEname[ ( [ [argmode] [argname]argtype[, ...] ] ) ] [ NO ] DEPENDS ON EXTENSIONextension_namewhereactionis one of: IMMUTABLE | STABLE | VOLATILE [ NOT ] LEAKPROOF [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER PARALLEL { UNSAFE | RESTRICTED | SAFE } COSTexecution_costROWSresult_rowsSETconfiguration_parameter{ TO | = } {value| DEFAULT } SETconfiguration_parameterFROM CURRENT RESETconfiguration_parameterRESET ALL
Description
ALTER ROUTINE changes the definition of a routine, which can be an aggregate function, a normal function, or a procedure. See underALTER AGGREGATE,ALTER FUNCTION, andALTER PROCEDURE for the description of the parameters, more examples, and further details.
Examples
To rename the routinefoo for typeinteger tofoobar:
ALTER ROUTINE foo(integer) RENAME TO foobar;
This command will work independent of whetherfoo is an aggregate, function, or procedure.
Compatibility
This statement is partially compatible with theALTER ROUTINE statement in the SQL standard. See underALTER FUNCTION andALTER PROCEDURE for more details. Allowing routine names to refer to aggregate functions is aPostgreSQL extension.
See Also
ALTER AGGREGATE,ALTER FUNCTION,ALTER PROCEDURE,DROP ROUTINE Note that there is noCREATE ROUTINE command.