'\" t .\" Title: ALTER ROUTINE .\" Author: The PostgreSQL Global Development Group .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 2024 .\" Manual: PostgreSQL 16.3 Documentation .\" Source: PostgreSQL 16.3 .\" Language: English .\" .TH "ALTER ROUTINE" "7" "2024" "PostgreSQL 16.3" "PostgreSQL 16.3 Documentation" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" ALTER_ROUTINE \- change the definition of a routine .SH "SYNOPSIS" .sp .nf ALTER ROUTINE \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] \fIaction\fR [ \&.\&.\&. ] [ RESTRICT ] ALTER ROUTINE \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] RENAME TO \fInew_name\fR ALTER ROUTINE \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] OWNER TO { \fInew_owner\fR | CURRENT_ROLE | CURRENT_USER | SESSION_USER } ALTER ROUTINE \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] SET SCHEMA \fInew_schema\fR ALTER ROUTINE \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] [ NO ] DEPENDS ON EXTENSION \fIextension_name\fR where \fIaction\fR is one of: IMMUTABLE | STABLE | VOLATILE [ NOT ] LEAKPROOF [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER PARALLEL { UNSAFE | RESTRICTED | SAFE } COST \fIexecution_cost\fR ROWS \fIresult_rows\fR SET \fIconfiguration_parameter\fR { TO | = } { \fIvalue\fR | DEFAULT } SET \fIconfiguration_parameter\fR FROM CURRENT RESET \fIconfiguration_parameter\fR RESET ALL .fi .SH "DESCRIPTION" .PP \fBALTER ROUTINE\fR changes the definition of a routine, which can be an aggregate function, a normal function, or a procedure\&. See under ALTER AGGREGATE (\fBALTER_AGGREGATE\fR(7)), ALTER FUNCTION (\fBALTER_FUNCTION\fR(7)), and ALTER PROCEDURE (\fBALTER_PROCEDURE\fR(7)) for the description of the parameters, more examples, and further details\&. .SH "EXAMPLES" .PP To rename the routine foo for type integer to foobar: .sp .if n \{\ .RS 4 .\} .nf ALTER ROUTINE foo(integer) RENAME TO foobar; .fi .if n \{\ .RE .\} .sp This command will work independent of whether foo is an aggregate, function, or procedure\&. .SH "COMPATIBILITY" .PP This statement is partially compatible with the \fBALTER ROUTINE\fR statement in the SQL standard\&. See under ALTER FUNCTION (\fBALTER_FUNCTION\fR(7)) and ALTER PROCEDURE (\fBALTER_PROCEDURE\fR(7)) for more details\&. Allowing routine names to refer to aggregate functions is a PostgreSQL extension\&. .SH "SEE ALSO" ALTER AGGREGATE (\fBALTER_AGGREGATE\fR(7)), ALTER FUNCTION (\fBALTER_FUNCTION\fR(7)), ALTER PROCEDURE (\fBALTER_PROCEDURE\fR(7)), DROP ROUTINE (\fBDROP_ROUTINE\fR(7)) .PP Note that there is no CREATE ROUTINE command\&.