{"Entry":{"collection":"sql","key":"drop-routine","name":"DROP ROUTINE","aliases":["droproutine"],"metadata":{"aliases":["droproutine"],"changed_in":[],"changes":[{"from":"10","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"11"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":["notes"],"changed":["description","compatibility"],"removed":[]},"status":"changed","synopsis":null,"to":"14"}],"content_hash":"9a82ec75c3e4dfa6e8606b0c3d688c6ca40ad97d4802c903714ceeb9db1a438a","derived_content_hash":"7454abbdcebfa7f8e8c817bc9bf4ad65f3196832486130c3886d399bf4f4aac7","editorial":{},"first_version":"11","group":"routine","imported_at":"2026-09-30T17:43:37.318204+08:00","last_version":"20","name":"DROP ROUTINE","object":"ROUTINE","position":2015,"present_in":["11","12","13","14","15","16","17","18","19","20"],"purpose":"remove a routine","purpose_zh":"","related":["drop-aggregate","drop-function","drop-procedure","alter-routine"],"repair_provenance":{"original_source_revision":"a709ab85","receipt_sha256":"d3fa55893177d0693783b0db5cc04d76302a7cca7f5399c53691173e47e1cbd1","repair":"wiki-repair-20261023"},"slug":"drop-routine","source_rev":"wiki-repair-20261023:468d11aa9c560071c0a4a4a9fb250090ed1af33480b08dcf2d616b194afaa64d","synopsis":"DROP ROUTINE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]\n[ CASCADE | RESTRICT ]","verb":"DROP"}},"Definition":{"Collection":"sql","Key":"drop-routine","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"drop-routine","SourceRevision":"wiki-repair-20261023:468d11aa9c560071c0a4a4a9fb250090ed1af33480b08dcf2d616b194afaa64d","Facts":{"anchor":"SQL-DROPROUTINE","description_zh":"移除一个例程","description_zh_html":"\u003cpre\u003eDROP ROUTINE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]\n[ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e 移除一个或多个现有例程的定义。术语\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e例程\u003c/span\u003e”\u003c/span\u003e包括聚合函数、普通函数和过程。关于参数的说明、更多示例以及进一步细节，请分别参见 \u003ca class=\"xref\" href=\"/zh/docs/18/sql-dropaggregate.html\" title=\"DROP AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP AGGREGATE\u003c/span\u003e\u003c/a\u003e、\u003ca class=\"xref\" href=\"/zh/docs/18/sql-dropfunction.html\" title=\"DROP FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP FUNCTION\u003c/span\u003e\u003c/a\u003e 和 \u003ca class=\"xref\" href=\"/zh/docs/18/sql-dropprocedure.html\" title=\"DROP PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP PROCEDURE\u003c/span\u003e\u003c/a\u003e。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e注解\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e 所使用的查找规则，从根本上说与\n   \u003ccode class=\"command\"\u003eDROP PROCEDURE\u003c/code\u003e 相同；特别是，\u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e 与该命令一样：如果参数列表中没有\n   \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargmode\u003c/code\u003e\u003c/em\u003e 标记，就会认为它可能采用 SQL 标准的定义，即将 \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e 参数也包含在列表中。（\u003ccode class=\"command\"\u003eDROP AGGREGATE\u003c/code\u003e 和 \u003ccode class=\"command\"\u003eDROP FUNCTION\u003c/code\u003e 不会这样。）\n  \u003c/p\u003e\u003cp\u003e\n   在某些不同种类的例程共享同一名称的情况下，\u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e\n   可能会因为歧义错误而失败，而更具体的命令（\u003ccode class=\"command\"\u003eDROP FUNCTION\u003c/code\u003e 等）则可以工作。更仔细地指定参数类型列表，同样可以解决这类问题。\n  \u003c/p\u003e\u003cp\u003e\n   这些查找规则也被其他作用于现有例程的命令使用，例如\n   \u003ccode class=\"command\"\u003eALTER ROUTINE\u003c/code\u003e 和 \u003ccode class=\"command\"\u003eCOMMENT ON ROUTINE\u003c/code\u003e。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e\n   删除参数类型为 \u003ccode class=\"type\"\u003einteger\u003c/code\u003e 的例程 \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nDROP ROUTINE foo(integer);\n\u003c/pre\u003e\u003cp\u003e\n   不管 \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e 是聚合函数、普通函数还是过程，这条命令都可以工作。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\n   此命令符合 SQL 标准，但有以下 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 扩展：\n   \u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\" style=\"list-style-type: disc; \"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e标准每条命令只允许删除一个例程。\u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e 选项是扩展。\u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e允许指定参数模式和参数名是扩展，而且在给出模式时查找规则也有所不同。\u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e用户可定义的聚合函数是扩展。\u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/zh/docs/18/sql-dropaggregate.html\" title=\"DROP AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-dropfunction.html\" title=\"DROP FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP FUNCTION\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-dropprocedure.html\" title=\"DROP PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP PROCEDURE\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterroutine.html\" title=\"ALTER ROUTINE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER ROUTINE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003cp\u003e\n   注意，没有 \u003ccode class=\"literal\"\u003eCREATE ROUTINE\u003c/code\u003e 命令。\n  \u003c/p\u003e\u003c/section\u003e","file":"sql-droproutine.html","lang":"en","name":"DROP ROUTINE","purpose":"remove a routine","purpose_zh":"移除一个例程","related":["drop-aggregate","drop-function","drop-procedure","alter-routine"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e removes the definition of one or more existing routines. The term \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eroutine\u003c/span\u003e”\u003c/span\u003e includes aggregate functions, normal functions, and procedures. See under \u003ca href=\"/docs/18/sql-dropaggregate.html\" title=\"DROP AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/sql-dropfunction.html\" title=\"DROP FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP FUNCTION\u003c/span\u003e\u003c/a\u003e, and \u003ca href=\"/docs/18/sql-dropprocedure.html\" title=\"DROP PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP PROCEDURE\u003c/span\u003e\u003c/a\u003e for the description of the parameters, more examples, and further details.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cp\u003eThe lookup rules used by \u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e are fundamentally the same as for \u003ccode class=\"command\"\u003eDROP PROCEDURE\u003c/code\u003e; in particular, \u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e shares that command's behavior of considering an argument list that has no \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargmode\u003c/code\u003e\u003c/em\u003e markers to be possibly using the SQL standard's definition that \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e arguments are included in the list. (\u003ccode class=\"command\"\u003eDROP AGGREGATE\u003c/code\u003e and \u003ccode class=\"command\"\u003eDROP FUNCTION\u003c/code\u003e do not do that.)\u003c/p\u003e\u003cp\u003eIn some cases where the same name is shared by routines of different kinds, it is possible for \u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e to fail with an ambiguity error when a more specific command (\u003ccode class=\"command\"\u003eDROP FUNCTION\u003c/code\u003e, etc.) would work. Specifying the argument type list more carefully will also resolve such problems.\u003c/p\u003e\u003cp\u003eThese lookup rules are also used by other commands that act on existing routines, such as \u003ccode class=\"command\"\u003eALTER ROUTINE\u003c/code\u003e and \u003ccode class=\"command\"\u003eCOMMENT ON ROUTINE\u003c/code\u003e.\u003c/p\u003e","key":"notes","title":"Notes"},{"html":"\u003cp\u003eTo drop the routine \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e for type \u003ccode class=\"type\"\u003einteger\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP ROUTINE foo(integer);\n\u003c/pre\u003e\u003cp\u003eThis command will work independent of whether \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e is an aggregate, function, or procedure.\u003c/p\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003eThis command conforms to the SQL standard, with these \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extensions:\u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003eThe standard only allows one routine to be dropped per command.\u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003eThe \u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e option is an extension.\u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003eThe ability to specify argument modes and names is an extension, and the lookup rules differ when modes are given.\u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003eUser-definable aggregate functions are an extension.\u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/drop-aggregate/?v=18\" title=\"DROP AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-function/?v=18\" title=\"DROP FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP FUNCTION\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-procedure/?v=18\" title=\"DROP PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP PROCEDURE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-routine/?v=18\" title=\"ALTER ROUTINE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER ROUTINE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003cp\u003eNote that there is no \u003ccode class=\"literal\"\u003eCREATE ROUTINE\u003c/code\u003e command.\u003c/p\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"DROP ROUTINE [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ ( [ [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargmode\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargname\u003c/code\u003e\u003c/em\u003e ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargtype\u003c/code\u003e\u003c/em\u003e [, ...] ] ) ] [, ...]\n    [ CASCADE | RESTRICT ]","synopsis_text":"DROP ROUTINE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]\n[ CASCADE | RESTRICT ]","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-droproutine.html","sha256":"56a3e0444a2305a37c0821ea624b76c10a23a8f5c1689e6b6d9c2ec61931b4a3"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"drop-routine","SourceDatabase":"center","Version":"18","Locale":"en","Title":"DROP ROUTINE","Summary":"remove a routine","BodyHTML":"\u003cpre\u003eDROP ROUTINE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]\n[ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP ROUTINE\u003c/code\u003e removes the definition of one or more existing routines. The term \u003cspan\u003e“\u003cspan\u003eroutine\u003c/span\u003e”\u003c/span\u003e includes aggregate functions, normal functions, and procedures. See under \u003ca href=\"/docs/18/sql-dropaggregate.html\" title=\"DROP AGGREGATE\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/sql-dropfunction.html\" title=\"DROP FUNCTION\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP FUNCTION\u003c/span\u003e\u003c/a\u003e, and \u003ca href=\"/docs/18/sql-dropprocedure.html\" title=\"DROP PROCEDURE\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP PROCEDURE\u003c/span\u003e\u003c/a\u003e for the description of the parameters, more examples, and further details.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cp\u003eThe lookup rules used by \u003ccode\u003eDROP ROUTINE\u003c/code\u003e are fundamentally the same as for \u003ccode\u003eDROP PROCEDURE\u003c/code\u003e; in particular, \u003ccode\u003eDROP ROUTINE\u003c/code\u003e shares that command\u0026#39;s behavior of considering an argument list that has no \u003cem\u003e\u003ccode\u003eargmode\u003c/code\u003e\u003c/em\u003e markers to be possibly using the SQL standard\u0026#39;s definition that \u003ccode\u003eOUT\u003c/code\u003e arguments are included in the list. (\u003ccode\u003eDROP AGGREGATE\u003c/code\u003e and \u003ccode\u003eDROP FUNCTION\u003c/code\u003e do not do that.)\u003c/p\u003e\u003cp\u003eIn some cases where the same name is shared by routines of different kinds, it is possible for \u003ccode\u003eDROP ROUTINE\u003c/code\u003e to fail with an ambiguity error when a more specific command (\u003ccode\u003eDROP FUNCTION\u003c/code\u003e, etc.) would work. Specifying the argument type list more carefully will also resolve such problems.\u003c/p\u003e\u003cp\u003eThese lookup rules are also used by other commands that act on existing routines, such as \u003ccode\u003eALTER ROUTINE\u003c/code\u003e and \u003ccode\u003eCOMMENT ON ROUTINE\u003c/code\u003e.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003eTo drop the routine \u003ccode\u003efoo\u003c/code\u003e for type \u003ccode\u003einteger\u003c/code\u003e:\u003c/p\u003e\u003cpre\u003eDROP ROUTINE foo(integer);\n\u003c/pre\u003e\u003cp\u003eThis command will work independent of whether \u003ccode\u003efoo\u003c/code\u003e is an aggregate, function, or procedure.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003eThis command conforms to the SQL standard, with these \u003cspan\u003ePostgreSQL\u003c/span\u003e extensions:\u003c/p\u003e\u003cdiv\u003e\u003cul\u003e\u003cli\u003e\u003cp\u003eThe standard only allows one routine to be dropped per command.\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003eThe \u003ccode\u003eIF EXISTS\u003c/code\u003e option is an extension.\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003eThe ability to specify argument modes and names is an extension, and the lookup rules differ when modes are given.\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003eUser-definable aggregate functions are an extension.\u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/drop-aggregate/?v=18\" title=\"DROP AGGREGATE\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-function/?v=18\" title=\"DROP FUNCTION\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP FUNCTION\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-procedure/?v=18\" title=\"DROP PROCEDURE\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP PROCEDURE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-routine/?v=18\" title=\"ALTER ROUTINE\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER ROUTINE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003cp\u003eNote that there is no \u003ccode\u003eCREATE ROUTINE\u003c/code\u003e command.\u003c/p\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:468d11aa9c560071c0a4a4a9fb250090ed1af33480b08dcf2d616b194afaa64d","ContentHash":"c3c5a123e8e9af41408b071aaca318e0e08b1c8ec8eeff744b359c46bcb58036","Payload":{"related":["drop-aggregate","drop-function","drop-procedure","alter-routine"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e removes the definition of one or more existing routines. The term \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eroutine\u003c/span\u003e”\u003c/span\u003e includes aggregate functions, normal functions, and procedures. See under \u003ca href=\"/docs/18/sql-dropaggregate.html\" title=\"DROP AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/sql-dropfunction.html\" title=\"DROP FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP FUNCTION\u003c/span\u003e\u003c/a\u003e, and \u003ca href=\"/docs/18/sql-dropprocedure.html\" title=\"DROP PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP PROCEDURE\u003c/span\u003e\u003c/a\u003e for the description of the parameters, more examples, and further details.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cp\u003eThe lookup rules used by \u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e are fundamentally the same as for \u003ccode class=\"command\"\u003eDROP PROCEDURE\u003c/code\u003e; in particular, \u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e shares that command's behavior of considering an argument list that has no \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargmode\u003c/code\u003e\u003c/em\u003e markers to be possibly using the SQL standard's definition that \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e arguments are included in the list. (\u003ccode class=\"command\"\u003eDROP AGGREGATE\u003c/code\u003e and \u003ccode class=\"command\"\u003eDROP FUNCTION\u003c/code\u003e do not do that.)\u003c/p\u003e\u003cp\u003eIn some cases where the same name is shared by routines of different kinds, it is possible for \u003ccode class=\"command\"\u003eDROP ROUTINE\u003c/code\u003e to fail with an ambiguity error when a more specific command (\u003ccode class=\"command\"\u003eDROP FUNCTION\u003c/code\u003e, etc.) would work. Specifying the argument type list more carefully will also resolve such problems.\u003c/p\u003e\u003cp\u003eThese lookup rules are also used by other commands that act on existing routines, such as \u003ccode class=\"command\"\u003eALTER ROUTINE\u003c/code\u003e and \u003ccode class=\"command\"\u003eCOMMENT ON ROUTINE\u003c/code\u003e.\u003c/p\u003e","key":"notes","title":"Notes"},{"html":"\u003cp\u003eTo drop the routine \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e for type \u003ccode class=\"type\"\u003einteger\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP ROUTINE foo(integer);\n\u003c/pre\u003e\u003cp\u003eThis command will work independent of whether \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e is an aggregate, function, or procedure.\u003c/p\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003eThis command conforms to the SQL standard, with these \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extensions:\u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003eThe standard only allows one routine to be dropped per command.\u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003eThe \u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e option is an extension.\u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003eThe ability to specify argument modes and names is an extension, and the lookup rules differ when modes are given.\u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003eUser-definable aggregate functions are an extension.\u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/drop-aggregate/?v=18\" title=\"DROP AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-function/?v=18\" title=\"DROP FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP FUNCTION\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-procedure/?v=18\" title=\"DROP PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP PROCEDURE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-routine/?v=18\" title=\"ALTER ROUTINE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER ROUTINE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003cp\u003eNote that there is no \u003ccode class=\"literal\"\u003eCREATE ROUTINE\u003c/code\u003e command.\u003c/p\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"DROP ROUTINE [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ ( [ [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargmode\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargname\u003c/code\u003e\u003c/em\u003e ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargtype\u003c/code\u003e\u003c/em\u003e [, ...] ] ) ] [, ...]\n    [ CASCADE | RESTRICT ]","synopsis_text":"DROP ROUTINE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]\n[ CASCADE | RESTRICT ]"}},"RequestedLocale":"en","Fallback":false,"Versions":["11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
