Redrock Postgres 搜索 英文
版本: 11 / 12 / 13 / 14 / 15 / 16

ALTER ROUTINE

ALTER ROUTINE — 更改例程的定义

语法

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

描述

ALTER ROUTINE 更改例程的定义,例程可以是聚合函数、普通函数或过程。请参阅 ALTER AGGREGATEALTER FUNCTIONALTER PROCEDURE 下的内容,了解参数的描述、更多示例和进一步的详细信息。

示例

将类型为 integer 的例程 foo 重命名为 foobar

ALTER ROUTINE foo(integer) RENAME TO foobar;

无论 foo 是聚合、函数还是过程,此命令都将起作用。

兼容性

此语句与 SQL 标准中的 ALTER ROUTINE 语句部分兼容。请参阅 ALTER FUNCTIONALTER PROCEDURE 下的内容,了解详细信息。允许例程名称引用聚合函数是 PostgreSQL 的扩展。

另请参见

ALTER AGGREGATEALTER FUNCTIONALTER PROCEDUREDROP ROUTINE

请注意,没有 CREATE ROUTINE 命令。