2 .\" Title: ALTER ROUTINE
3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
10 .TH "ALTER ROUTINE" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 ALTER_ROUTINE \- change the definition of a routine
35 ALTER ROUTINE \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ]
36 \fIaction\fR [ \&.\&.\&. ] [ RESTRICT ]
37 ALTER ROUTINE \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ]
38 RENAME TO \fInew_name\fR
39 ALTER ROUTINE \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ]
40 OWNER TO { \fInew_owner\fR | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
41 ALTER ROUTINE \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ]
42 SET SCHEMA \fInew_schema\fR
43 ALTER ROUTINE \fIname\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ]
44 [ NO ] DEPENDS ON EXTENSION \fIextension_name\fR
46 where \fIaction\fR is one of:
48 IMMUTABLE | STABLE | VOLATILE
50 [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
51 PARALLEL { UNSAFE | RESTRICTED | SAFE }
52 COST \fIexecution_cost\fR
53 ROWS \fIresult_rows\fR
54 SET \fIconfiguration_parameter\fR { TO | = } { \fIvalue\fR | DEFAULT }
55 SET \fIconfiguration_parameter\fR FROM CURRENT
56 RESET \fIconfiguration_parameter\fR
62 changes the definition of a routine, which can be an aggregate function, a normal function, or a procedure\&. See under
63 ALTER AGGREGATE (\fBALTER_AGGREGATE\fR(7)),
64 ALTER FUNCTION (\fBALTER_FUNCTION\fR(7)), and
65 ALTER PROCEDURE (\fBALTER_PROCEDURE\fR(7))
66 for the description of the parameters, more examples, and further details\&.
80 ALTER ROUTINE foo(integer) RENAME TO foobar;
86 This command will work independent of whether
88 is an aggregate, function, or procedure\&.
91 This statement is partially compatible with the
93 statement in the SQL standard\&. See under
94 ALTER FUNCTION (\fBALTER_FUNCTION\fR(7))
96 ALTER PROCEDURE (\fBALTER_PROCEDURE\fR(7))
97 for more details\&. Allowing routine names to refer to aggregate functions is a
101 ALTER AGGREGATE (\fBALTER_AGGREGATE\fR(7)), ALTER FUNCTION (\fBALTER_FUNCTION\fR(7)), ALTER PROCEDURE (\fBALTER_PROCEDURE\fR(7)), DROP ROUTINE (\fBDROP_ROUTINE\fR(7))
103 Note that there is no