ALTER_ROUTINE(7pg14)
β¨ NAME β¨
okay so bestie, this is the ALTER_ROUTINE(7pg14) page β aka ALTER ROUTINE(7) in the PostgreSQL 14.24 docs β and itβs here to change the definition of a routine. π
π SYNOPSIS π
ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
action [ ... ] [ RESTRICT ]
ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
RENAME TO new_name
ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
SET SCHEMA new_schema
ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
[ NO ] DEPENDS ON EXTENSION extension_name
where action is one of:
IMMUTABLE | STABLE | VOLATILE
[ NOT ] LEAKPROOF
[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
PARALLEL { UNSAFE | RESTRICTED | SAFE }
COST execution_cost
ROWS result_rows
SET configuration_parameter { TO | = } { value | DEFAULT }
SET configuration_parameter FROM CURRENT
RESET configuration_parameter
RESET ALL
π«Ά DESCRIPTION π«Ά
ALTER ROUTINE changes the definition of a routine, and a routine can be an aggregate function, a normal function, or a procedure. Yes bestie, itβs giving βone command, three possible main characters.β π
for the full breakdown of parameters, extra examples, and further details, see under ALTER AGGREGATE (ALTER_AGGREGATE(7)), ALTER FUNCTION (ALTER_FUNCTION(7)), and ALTER PROCEDURE (ALTER_PROCEDURE(7)). π«‘
π EXAMPLES π
to rename the routine foo for type integer to foobar:
ALTER ROUTINE foo(integer) RENAME TO foobar;
this command will work independent of whether foo is an aggregate, function, or procedure. no cap. β¨
π¦ COMPATIBILITY π¦
this statement is partially compatible with the ALTER ROUTINE statement in the SQL standard. see under ALTER FUNCTION (ALTER_FUNCTION(7)) and ALTER PROCEDURE (ALTER_PROCEDURE(7)) for more details. π
allowing routine names to refer to aggregate functions is a PostgreSQL extension. π
πΈ SEE ALSO πΈ
ALTER AGGREGATE(ALTER_AGGREGATE(7))ALTER FUNCTION(ALTER_FUNCTION(7))ALTER PROCEDURE(ALTER_PROCEDURE(7))DROP ROUTINE(DROP_ROUTINE(7))
note that there is no CREATE ROUTINE command. not me checking twice, but yes, itβs not there. π
xoxo, signed off from PostgreSQL 14.24, dated 2026, on the ALTER ROUTINE(7) page β slay and stay safe out there ππβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms