{"Entry":{"collection":"sql","key":"alter-routine","name":"ALTER ROUTINE","aliases":["alterroutine"],"metadata":{"aliases":["alterroutine"],"changed_in":["13","14"],"changes":[{"from":"10","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"11"},{"from":"12","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["[ NO ] DEPENDS ON EXTENSION extension_name"],"removed":[]},"to":"13"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }"],"removed":[]},"to":"14"}],"content_hash":"fd60b851ae03fad4cac48c89fdacf03c5958136eb677e0a411487ae8c7ee022f","derived_content_hash":"6f20f2f57b2a15d7ecf8f2fb9d2d10d65b35703fb1518d28deb6416e7b96f472","editorial":{},"first_version":"11","group":"routine","imported_at":"2026-09-30T17:43:37.311777+08:00","last_version":"20","name":"ALTER ROUTINE","object":"ROUTINE","position":2014,"present_in":["11","12","13","14","15","16","17","18","19","20"],"purpose":"change the definition of a routine","purpose_zh":"","related":["alter-aggregate","alter-function","alter-procedure","drop-routine"],"repair_provenance":{"original_source_revision":"a709ab85","receipt_sha256":"90efe2b7d588f21ae691ee0b61bda38c5c75e9fdb605b1bf38dbceb8492cc1b0","repair":"wiki-repair-20261023"},"slug":"alter-routine","source_rev":"wiki-repair-20261023:75f990ec4194add7fb6ca39b379b933d9a8a18eee7df3debfa2ad7cae364be45","synopsis":"ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\naction [ ... ] [ RESTRICT ]\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nRENAME TO new_name\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nOWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nSET SCHEMA new_schema\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\n[ NO ] DEPENDS ON EXTENSION extension_name\nwhere action is one of:\n\nIMMUTABLE | STABLE | VOLATILE\n[ NOT ] LEAKPROOF\n[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\nPARALLEL { UNSAFE | RESTRICTED | SAFE }\nCOST execution_cost\nROWS result_rows\nSET configuration_parameter { TO | = } { value | DEFAULT }\nSET configuration_parameter FROM CURRENT\nRESET configuration_parameter\nRESET ALL","verb":"ALTER"}},"Definition":{"Collection":"sql","Key":"alter-routine","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"alter-routine","SourceRevision":"wiki-repair-20261023:75f990ec4194add7fb6ca39b379b933d9a8a18eee7df3debfa2ad7cae364be45","Facts":{"anchor":"SQL-ALTERROUTINE","description_zh":"更改一个例程的定义","description_zh_html":"\u003cpre\u003eALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\naction [ ... ] [ RESTRICT ]\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nRENAME TO new_name\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nOWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nSET SCHEMA new_schema\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\n[ NO ] DEPENDS ON EXTENSION extension_name\n其中 action 是以下之一：\n\nIMMUTABLE | STABLE | VOLATILE\n[ NOT ] LEAKPROOF\n[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\nPARALLEL { UNSAFE | RESTRICTED | SAFE }\nCOST execution_cost\nROWS result_rows\nSET configuration_parameter { TO | = } { value | DEFAULT }\nSET configuration_parameter FROM CURRENT\nRESET configuration_parameter\nRESET ALL\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eALTER 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-alteraggregate.html\" title=\"ALTER AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER AGGREGATE\u003c/span\u003e\u003c/a\u003e、\u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterfunction.html\" title=\"ALTER FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e 和 \u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterprocedure.html\" title=\"ALTER PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER 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=\"type\"\u003einteger\u003c/code\u003e 类型的例程 \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e 重命名为 \u003ccode class=\"literal\"\u003efoobar\u003c/code\u003e：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nALTER ROUTINE foo(integer) RENAME TO foobar;\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 标准中的 \u003ccode class=\"command\"\u003eALTER ROUTINE\u003c/code\u003e 语句部分兼容。更多细节请参见 \u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterfunction.html\" title=\"ALTER FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e 和 \u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterprocedure.html\" title=\"ALTER PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER PROCEDURE\u003c/span\u003e\u003c/a\u003e。允许例程名引用聚合函数是 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 的扩展。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/zh/docs/18/sql-alteraggregate.html\" title=\"ALTER AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterfunction.html\" title=\"ALTER FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterprocedure.html\" title=\"ALTER PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER PROCEDURE\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-droproutine.html\" title=\"DROP ROUTINE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP 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-alterroutine.html","lang":"en","name":"ALTER ROUTINE","purpose":"change the definition of a routine","purpose_zh":"更改一个例程的定义","related":["alter-aggregate","alter-function","alter-procedure","drop-routine"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER ROUTINE\u003c/code\u003e changes the definition of a routine, which can be an aggregate function, a normal function, or a procedure. See under \u003ca href=\"/docs/18/sql-alteraggregate.html\" title=\"ALTER AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/sql-alterfunction.html\" title=\"ALTER FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e, and \u003ca href=\"/docs/18/sql-alterprocedure.html\" title=\"ALTER PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER 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\u003eTo rename the routine \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e for type \u003ccode class=\"type\"\u003einteger\u003c/code\u003e to \u003ccode class=\"literal\"\u003efoobar\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eALTER ROUTINE foo(integer) RENAME TO foobar;\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 statement is partially compatible with the \u003ccode class=\"command\"\u003eALTER ROUTINE\u003c/code\u003e statement in the SQL standard. See under \u003ca href=\"/docs/18/sql-alterfunction.html\" title=\"ALTER FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e and \u003ca href=\"/docs/18/sql-alterprocedure.html\" title=\"ALTER PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER PROCEDURE\u003c/span\u003e\u003c/a\u003e for more details. Allowing routine names to refer to aggregate functions is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/alter-aggregate/?v=18\" title=\"ALTER AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-function/?v=18\" title=\"ALTER FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-procedure/?v=18\" title=\"ALTER PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER PROCEDURE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-routine/?v=18\" title=\"DROP ROUTINE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP 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":"ALTER ROUTINE \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    \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaction\u003c/code\u003e\u003c/em\u003e [ ... ] [ RESTRICT ]\nALTER ROUTINE \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    RENAME TO \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\nALTER ROUTINE \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    OWNER TO { \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER ROUTINE \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    SET SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_schema\u003c/code\u003e\u003c/em\u003e\nALTER ROUTINE \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    [ NO ] DEPENDS ON EXTENSION \u003cem class=\"replaceable\"\u003e\u003ccode\u003eextension_name\u003c/code\u003e\u003c/em\u003e\n\n\u003cspan class=\"phrase\"\u003ewhere \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaction\u003c/code\u003e\u003c/em\u003e is one of:\u003c/span\u003e\n\n    IMMUTABLE | STABLE | VOLATILE\n    [ NOT ] LEAKPROOF\n    [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\n    PARALLEL { UNSAFE | RESTRICTED | SAFE }\n    COST \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexecution_cost\u003c/code\u003e\u003c/em\u003e\n    ROWS \u003cem class=\"replaceable\"\u003e\u003ccode\u003eresult_rows\u003c/code\u003e\u003c/em\u003e\n    SET \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e { TO | = } { \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e | DEFAULT }\n    SET \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e FROM CURRENT\n    RESET \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e\n    RESET ALL","synopsis_text":"ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\naction [ ... ] [ RESTRICT ]\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nRENAME TO new_name\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nOWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nSET SCHEMA new_schema\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\n[ NO ] DEPENDS ON EXTENSION extension_name\nwhere action is one of:\n\nIMMUTABLE | STABLE | VOLATILE\n[ NOT ] LEAKPROOF\n[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\nPARALLEL { UNSAFE | RESTRICTED | SAFE }\nCOST execution_cost\nROWS result_rows\nSET configuration_parameter { TO | = } { value | DEFAULT }\nSET configuration_parameter FROM CURRENT\nRESET configuration_parameter\nRESET ALL","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-alterroutine.html","sha256":"057421deed92b7827b08873f65d62065574592b40fbc295ace8f8e5a494fb51e"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"alter-routine","SourceDatabase":"center","Version":"18","Locale":"en","Title":"ALTER ROUTINE","Summary":"change the definition of a routine","BodyHTML":"\u003cpre\u003eALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\naction [ ... ] [ RESTRICT ]\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nRENAME TO new_name\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nOWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nSET SCHEMA new_schema\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\n[ NO ] DEPENDS ON EXTENSION extension_name\nwhere action is one of:\n\nIMMUTABLE | STABLE | VOLATILE\n[ NOT ] LEAKPROOF\n[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\nPARALLEL { UNSAFE | RESTRICTED | SAFE }\nCOST execution_cost\nROWS result_rows\nSET configuration_parameter { TO | = } { value | DEFAULT }\nSET configuration_parameter FROM CURRENT\nRESET configuration_parameter\nRESET ALL\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eALTER ROUTINE\u003c/code\u003e changes the definition of a routine, which can be an aggregate function, a normal function, or a procedure. See under \u003ca href=\"/docs/18/sql-alteraggregate.html\" title=\"ALTER AGGREGATE\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/sql-alterfunction.html\" title=\"ALTER FUNCTION\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e, and \u003ca href=\"/docs/18/sql-alterprocedure.html\" title=\"ALTER PROCEDURE\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER 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\u003eExamples\u003c/h2\u003e\u003cp\u003eTo rename the routine \u003ccode\u003efoo\u003c/code\u003e for type \u003ccode\u003einteger\u003c/code\u003e to \u003ccode\u003efoobar\u003c/code\u003e:\u003c/p\u003e\u003cpre\u003eALTER ROUTINE foo(integer) RENAME TO foobar;\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 statement is partially compatible with the \u003ccode\u003eALTER ROUTINE\u003c/code\u003e statement in the SQL standard. See under \u003ca href=\"/docs/18/sql-alterfunction.html\" title=\"ALTER FUNCTION\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e and \u003ca href=\"/docs/18/sql-alterprocedure.html\" title=\"ALTER PROCEDURE\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER PROCEDURE\u003c/span\u003e\u003c/a\u003e for more details. Allowing routine names to refer to aggregate functions is a \u003cspan\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/alter-aggregate/?v=18\" title=\"ALTER AGGREGATE\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-function/?v=18\" title=\"ALTER FUNCTION\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-procedure/?v=18\" title=\"ALTER PROCEDURE\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER PROCEDURE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-routine/?v=18\" title=\"DROP ROUTINE\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP 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:75f990ec4194add7fb6ca39b379b933d9a8a18eee7df3debfa2ad7cae364be45","ContentHash":"e3f3a44fae4ad278091a6e039616a8af5755f01f733a151f1db4fd83df257bf9","Payload":{"related":["alter-aggregate","alter-function","alter-procedure","drop-routine"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER ROUTINE\u003c/code\u003e changes the definition of a routine, which can be an aggregate function, a normal function, or a procedure. See under \u003ca href=\"/docs/18/sql-alteraggregate.html\" title=\"ALTER AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/sql-alterfunction.html\" title=\"ALTER FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e, and \u003ca href=\"/docs/18/sql-alterprocedure.html\" title=\"ALTER PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER 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\u003eTo rename the routine \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e for type \u003ccode class=\"type\"\u003einteger\u003c/code\u003e to \u003ccode class=\"literal\"\u003efoobar\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eALTER ROUTINE foo(integer) RENAME TO foobar;\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 statement is partially compatible with the \u003ccode class=\"command\"\u003eALTER ROUTINE\u003c/code\u003e statement in the SQL standard. See under \u003ca href=\"/docs/18/sql-alterfunction.html\" title=\"ALTER FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e and \u003ca href=\"/docs/18/sql-alterprocedure.html\" title=\"ALTER PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER PROCEDURE\u003c/span\u003e\u003c/a\u003e for more details. Allowing routine names to refer to aggregate functions is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/alter-aggregate/?v=18\" title=\"ALTER AGGREGATE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER AGGREGATE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-function/?v=18\" title=\"ALTER FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FUNCTION\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-procedure/?v=18\" title=\"ALTER PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER PROCEDURE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-routine/?v=18\" title=\"DROP ROUTINE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP 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":"ALTER ROUTINE \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    \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaction\u003c/code\u003e\u003c/em\u003e [ ... ] [ RESTRICT ]\nALTER ROUTINE \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    RENAME TO \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\nALTER ROUTINE \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    OWNER TO { \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER ROUTINE \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    SET SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_schema\u003c/code\u003e\u003c/em\u003e\nALTER ROUTINE \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    [ NO ] DEPENDS ON EXTENSION \u003cem class=\"replaceable\"\u003e\u003ccode\u003eextension_name\u003c/code\u003e\u003c/em\u003e\n\n\u003cspan class=\"phrase\"\u003ewhere \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaction\u003c/code\u003e\u003c/em\u003e is one of:\u003c/span\u003e\n\n    IMMUTABLE | STABLE | VOLATILE\n    [ NOT ] LEAKPROOF\n    [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\n    PARALLEL { UNSAFE | RESTRICTED | SAFE }\n    COST \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexecution_cost\u003c/code\u003e\u003c/em\u003e\n    ROWS \u003cem class=\"replaceable\"\u003e\u003ccode\u003eresult_rows\u003c/code\u003e\u003c/em\u003e\n    SET \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e { TO | = } { \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e | DEFAULT }\n    SET \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e FROM CURRENT\n    RESET \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e\n    RESET ALL","synopsis_text":"ALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\naction [ ... ] [ RESTRICT ]\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nRENAME TO new_name\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nOWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nSET SCHEMA new_schema\nALTER ROUTINE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\n[ NO ] DEPENDS ON EXTENSION extension_name\nwhere action is one of:\n\nIMMUTABLE | STABLE | VOLATILE\n[ NOT ] LEAKPROOF\n[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\nPARALLEL { UNSAFE | RESTRICTED | SAFE }\nCOST execution_cost\nROWS result_rows\nSET configuration_parameter { TO | = } { value | DEFAULT }\nSET configuration_parameter FROM CURRENT\nRESET configuration_parameter\nRESET ALL"}},"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}
