Postgresql 中文操作指南

DROP ROUTINE

DROP ROUTINE — 删除例程

DROP ROUTINE — remove a routine

Synopsis

DROP ROUTINE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]
    [ CASCADE | RESTRICT ]

Description

DROP ROUTINE 会删除一个或多个现有例程的定义。“例程”一词包括聚合函数、普通函数和过程。有关参数的描述、更多示例和更多详细信息,请参阅 DROP AGGREGATEDROP FUNCTIONDROP PROCEDURE 下的内容。

DROP ROUTINE removes the definition of one or more existing routines. The term “routine” includes aggregate functions, normal functions, and procedures. See under DROP AGGREGATE, DROP FUNCTION, and DROP PROCEDURE for the description of the parameters, more examples, and further details.

Notes

DROP ROUTINE 使用的查找规则与 DROP PROCEDURE 基本相同;特别是, DROP ROUTINE 共享该命令的行为方式,即认为没有 argmode 标记的参数列表可能使用 SQL 标准的定义,即 OUT 参数包含在列表中。( DROP AGGREGATEDROP FUNCTION 不会这样做。)

The lookup rules used by DROP ROUTINE are fundamentally the same as for DROP PROCEDURE; in particular, DROP ROUTINE shares that command’s behavior of considering an argument list that has no argmode markers to be possibly using the SQL standard’s definition that OUT arguments are included in the list. (DROP AGGREGATE and DROP FUNCTION do not do that.)

在某些情况下,如果不同类型的例程共享相同的名称,则有可能造成 DROP ROUTINE 失败并出现歧义错误,而更具体的命令( DROP FUNCTION 等)能够正常工作。更仔细地指定参数类型列表也将解决此类问题。

In some cases where the same name is shared by routines of different kinds, it is possible for DROP ROUTINE to fail with an ambiguity error when a more specific command (DROP FUNCTION, etc.) would work. Specifying the argument type list more carefully will also resolve such problems.

其他操作现有例程的命令也会使用查找规则,如 ALTER ROUTINECOMMENT ON ROUTINE

These lookup rules are also used by other commands that act on existing routines, such as ALTER ROUTINE and COMMENT ON ROUTINE.

Examples

要删除类型 integer 的例程 foo

To drop the routine foo for type integer:

DROP ROUTINE foo(integer);

此命令将独立于 foo 是聚合、函数或过程来执行。

This command will work independent of whether foo is an aggregate, function, or procedure.

Compatibility

此命令符合 SQL 标准,带有以下 PostgreSQL 扩展:

This command conforms to the SQL standard, with these PostgreSQL extensions:

See Also

DROP AGGREGATEDROP FUNCTIONDROP PROCEDUREALTER ROUTINE 请注意没有 CREATE ROUTINE 命令。

DROP AGGREGATE, DROP FUNCTION, DROP PROCEDURE, ALTER ROUTINE Note that there is no CREATE ROUTINE command.