]> begriffs open source - ai-pg/blob - full-docs/man7/ALTER_ROUTINE.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / ALTER_ROUTINE.7
1 '\" t
2 .\"     Title: ALTER ROUTINE
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
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 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 ALTER_ROUTINE \- change the definition of a routine
32 .SH "SYNOPSIS"
33 .sp
34 .nf
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
45
46 where \fIaction\fR is one of:
47
48     IMMUTABLE | STABLE | VOLATILE
49     [ NOT ] LEAKPROOF
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
57     RESET ALL
58 .fi
59 .SH "DESCRIPTION"
60 .PP
61 \fBALTER ROUTINE\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\&.
67 .SH "EXAMPLES"
68 .PP
69 To rename the routine
70 foo
71 for type
72 integer
73 to
74 foobar:
75 .sp
76 .if n \{\
77 .RS 4
78 .\}
79 .nf
80 ALTER ROUTINE foo(integer) RENAME TO foobar;
81 .fi
82 .if n \{\
83 .RE
84 .\}
85 .sp
86 This command will work independent of whether
87 foo
88 is an aggregate, function, or procedure\&.
89 .SH "COMPATIBILITY"
90 .PP
91 This statement is partially compatible with the
92 \fBALTER ROUTINE\fR
93 statement in the SQL standard\&. See under
94 ALTER FUNCTION (\fBALTER_FUNCTION\fR(7))
95 and
96 ALTER PROCEDURE (\fBALTER_PROCEDURE\fR(7))
97 for more details\&. Allowing routine names to refer to aggregate functions is a
98 PostgreSQL
99 extension\&.
100 .SH "SEE ALSO"
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))
102 .PP
103 Note that there is no
104 CREATE ROUTINE
105 command\&.