阅读(3700)
赞(0)
PostgreSQL ALTER ROUTINE
2021-08-23 14:26:43 更新
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_USER | SESSION_USER }
ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] SET SCHEMA new_schema
ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] DEPENDS ON EXTENSION extension_name
其中action
是下列之一:
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 AGGREGATE、ALTER FUNCTION以及ALTER PROCEDURE。
示例
将类型integer
的例程foo
重命名为foobar
:
ALTER ROUTINE foo(integer) RENAME TO foobar;
不管foo
是聚集、函数还是过程,这个命令都能使用。
兼容性
这个语句与SQL标准中的ALTER ROUTINE
语句部分兼容。更多细节请参考ALTER FUNCTION和
ALTER PROCEDURE
。允许例程名称引用聚集函数是一种PostgreSQL的扩展。