1ALTER ROUTINE(7) PostgreSQL 15.4 Documentation ALTER ROUTINE(7)
2
3
4
6 ALTER_ROUTINE - change the definition of a routine
7
9 ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
10 action [ ... ] [ RESTRICT ]
11 ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
12 RENAME TO new_name
13 ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
14 OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
15 ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
16 SET SCHEMA new_schema
17 ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
18 [ NO ] DEPENDS ON EXTENSION extension_name
19
20 where action is one of:
21
22 IMMUTABLE | STABLE | VOLATILE
23 [ NOT ] LEAKPROOF
24 [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
25 PARALLEL { UNSAFE | RESTRICTED | SAFE }
26 COST execution_cost
27 ROWS result_rows
28 SET configuration_parameter { TO | = } { value | DEFAULT }
29 SET configuration_parameter FROM CURRENT
30 RESET configuration_parameter
31 RESET ALL
32
34 ALTER ROUTINE changes the definition of a routine, which can be an
35 aggregate function, a normal function, or a procedure. See under ALTER
36 AGGREGATE (ALTER_AGGREGATE(7)), ALTER FUNCTION (ALTER_FUNCTION(7)), and
37 ALTER PROCEDURE (ALTER_PROCEDURE(7)) for the description of the
38 parameters, more examples, and further details.
39
41 To rename the routine foo for type integer to foobar:
42
43 ALTER ROUTINE foo(integer) RENAME TO foobar;
44
45 This command will work independent of whether foo is an aggregate,
46 function, or procedure.
47
49 This statement is partially compatible with the ALTER ROUTINE statement
50 in the SQL standard. See under ALTER FUNCTION (ALTER_FUNCTION(7)) and
51 ALTER PROCEDURE (ALTER_PROCEDURE(7)) for more details. Allowing routine
52 names to refer to aggregate functions is a PostgreSQL extension.
53
55 ALTER AGGREGATE (ALTER_AGGREGATE(7)), ALTER FUNCTION
56 (ALTER_FUNCTION(7)), ALTER PROCEDURE (ALTER_PROCEDURE(7)), DROP ROUTINE
57 (DROP_ROUTINE(7))
58
59 Note that there is no CREATE ROUTINE command.
60
61
62
63PostgreSQL 15.4 2023 ALTER ROUTINE(7)