{"Entry":{"collection":"sql","key":"drop-extension","name":"DROP EXTENSION","aliases":["dropextension"],"metadata":{"aliases":["dropextension"],"changed_in":["9.2"],"changes":[{"from":"9.0","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"9.1"},{"from":"9.1","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":{"added":["DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]"],"removed":["DROP EXTENSION [ IF EXISTS ] extension_name [, ...] [ CASCADE | RESTRICT ]"]},"to":"9.2"},{"from":"9.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"9.6"},{"from":"11","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"12"},{"from":"12","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"13"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"14"},{"from":"16","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"17"},{"from":"18","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"19"}],"content_hash":"95b3e8c3ecbf2dbba027d97134e4df279108ff3bc8026d69aa134165e60a1bfa","derived_content_hash":"ccc48d03b84d215c22bab5cbed02efbca344cd2f9612e341a72d4f321cc0b8ea","editorial":{},"first_version":"9.1","group":"extension","imported_at":"2026-09-30T17:43:38.557375+08:00","last_version":"20","name":"DROP EXTENSION","object":"EXTENSION","position":7005,"present_in":["9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"purpose":"remove an extension","purpose_zh":"","related":["create-extension","alter-extension"],"repair_provenance":{"original_source_revision":"wiki-repair-20261023:d27c5ca5710ba80e145eafaa6e73e336b7b86ab2278bfc4eaffdc1eb7b8755be","receipt_sha256":"3cecec24e9380101cf58914235d23731637303076aefce403db01a9b6d1fca1b","repair":"wiki-repair-20261023"},"slug":"drop-extension","source_rev":"wiki-repair-20261023:80a6d62869484ad161d5fb1d1c35180857fbf516554a7d5b33e8bcae9cc99c3f","synopsis":"DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]","verb":"DROP"}},"Definition":{"Collection":"sql","Key":"drop-extension","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"drop-extension","SourceRevision":"wiki-repair-20261023:80a6d62869484ad161d5fb1d1c35180857fbf516554a7d5b33e8bcae9cc99c3f","Facts":{"anchor":"SQL-DROPEXTENSION","description_zh":"移除一个扩展","description_zh_html":"\u003cpre\u003eDROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eDROP EXTENSION\u003c/code\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 中的\n   \u003ccode class=\"literal\"\u003eDEPENDS ON EXTENSION \u003cem class=\"replaceable\"\u003e\u003ccode\u003eextension_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\n   动作）也会一并删除。\n  \u003c/p\u003e\u003cp\u003e\n   要使用 \u003ccode class=\"command\"\u003eDROP EXTENSION\u003c/code\u003e，必须拥有该扩展。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      如果该扩展不存在，则不要抛出错误。这种情况下会发出一个提示。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       一个已安装扩展的名称。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      自动删除依赖于该扩展的对象，以及进一步依赖于这些对象的所有对象（参见\u003ca class=\"xref\" href=\"/zh/docs/18/ddl-depend.html\" title=\"5.15. 依赖跟踪\"\u003e第 5.15 节\u003c/a\u003e）。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      如果除这些扩展、其成员以及显式依赖于它们的例程之外，还有其他对象依赖于它们，则此选项会阻止删除指定的扩展。这是默认值。\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e\n   要从当前数据库中移除扩展 \u003ccode class=\"literal\"\u003ehstore\u003c/code\u003e：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nDROP EXTENSION hstore;\n\u003c/pre\u003e\u003cp\u003e\n   如果数据库中使用了 \u003ccode class=\"literal\"\u003ehstore\u003c/code\u003e 的任何对象，例如某些表具有 \u003ccode class=\"type\"\u003ehstore\u003c/code\u003e 类型的列，则该命令会失败。加上 \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e 选项可以强制一并移除这些依赖对象。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eDROP EXTENSION\u003c/code\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-createextension.html\" title=\"CREATE EXTENSION\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE EXTENSION\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterextension.html\" title=\"ALTER EXTENSION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER EXTENSION\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","file":"sql-dropextension.html","lang":"en","name":"DROP EXTENSION","purpose":"remove an extension","purpose_zh":"移除一个扩展","related":["create-extension","alter-extension"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP EXTENSION\u003c/code\u003e removes extensions from the database. Dropping an extension causes its member objects, and other explicitly dependent routines (see \u003ca href=\"/docs/18/sql-alterroutine.html\" title=\"ALTER ROUTINE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER ROUTINE\u003c/span\u003e\u003c/a\u003e, the \u003ccode class=\"literal\"\u003eDEPENDS ON EXTENSION \u003cem class=\"replaceable\"\u003e\u003ccode\u003eextension_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e action), to be dropped as well.\u003c/p\u003e\u003cp\u003eYou must own the extension to use \u003ccode class=\"command\"\u003eDROP EXTENSION\u003c/code\u003e.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the extension does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of an installed extension.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eAutomatically drop objects that depend on the extension, and in turn all objects that depend on those objects (see \u003ca href=\"/docs/18/ddl-depend.html\" title=\"5.15. Dependency Tracking\"\u003eSection 5.15\u003c/a\u003e).\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThis option prevents the specified extensions from being dropped if other objects, besides these extensions, their members, and their explicitly dependent routines, depend on them. This is the default.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eTo remove the extension \u003ccode class=\"literal\"\u003ehstore\u003c/code\u003e from the current database:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP EXTENSION hstore;\n\u003c/pre\u003e\u003cp\u003eThis command will fail if any of \u003ccode class=\"literal\"\u003ehstore\u003c/code\u003e's objects are in use in the database, for example if any tables have columns of the \u003ccode class=\"type\"\u003ehstore\u003c/code\u003e type. Add the \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e option to forcibly remove those dependent objects as well.\u003c/p\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP EXTENSION\u003c/code\u003e 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/create-extension/?v=18\" title=\"CREATE EXTENSION\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE EXTENSION\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-extension/?v=18\" title=\"ALTER EXTENSION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER EXTENSION\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"DROP EXTENSION [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [, ...] [ CASCADE | RESTRICT ]","synopsis_text":"DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-dropextension.html","sha256":"bb46d7b747a5792554a85191c14c8bdc15d521f8096e9be483bfae0c4f3f3153"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"drop-extension","SourceDatabase":"center","Version":"18","Locale":"en","Title":"DROP EXTENSION","Summary":"remove an extension","BodyHTML":"\u003cpre\u003eDROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP EXTENSION\u003c/code\u003e removes extensions from the database. Dropping an extension causes its member objects, and other explicitly dependent routines (see \u003ca href=\"/docs/18/sql-alterroutine.html\" title=\"ALTER ROUTINE\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER ROUTINE\u003c/span\u003e\u003c/a\u003e, the \u003ccode\u003eDEPENDS ON EXTENSION \u003cem\u003e\u003ccode\u003eextension_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e action), to be dropped as well.\u003c/p\u003e\u003cp\u003eYou must own the extension to use \u003ccode\u003eDROP EXTENSION\u003c/code\u003e.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eParameters\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the extension does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of an installed extension.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eAutomatically drop objects that depend on the extension, and in turn all objects that depend on those objects (see \u003ca href=\"/docs/18/ddl-depend.html\" rel=\"nofollow\"\u003eSection 5.15\u003c/a\u003e).\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThis option prevents the specified extensions from being dropped if other objects, besides these extensions, their members, and their explicitly dependent routines, depend on them. This is the default.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003eTo remove the extension \u003ccode\u003ehstore\u003c/code\u003e from the current database:\u003c/p\u003e\u003cpre\u003eDROP EXTENSION hstore;\n\u003c/pre\u003e\u003cp\u003eThis command will fail if any of \u003ccode\u003ehstore\u003c/code\u003e\u0026#39;s objects are in use in the database, for example if any tables have columns of the \u003ccode\u003ehstore\u003c/code\u003e type. Add the \u003ccode\u003eCASCADE\u003c/code\u003e option to forcibly remove those dependent objects as well.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP EXTENSION\u003c/code\u003e 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/create-extension/?v=18\" title=\"CREATE EXTENSION\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE EXTENSION\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-extension/?v=18\" title=\"ALTER EXTENSION\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER EXTENSION\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:80a6d62869484ad161d5fb1d1c35180857fbf516554a7d5b33e8bcae9cc99c3f","ContentHash":"2a295b5d756396faa4888eba80a45fb9dbd6ab0c424d7002f54e05c4d03a19f9","Payload":{"related":["create-extension","alter-extension"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP EXTENSION\u003c/code\u003e removes extensions from the database. Dropping an extension causes its member objects, and other explicitly dependent routines (see \u003ca href=\"/docs/18/sql-alterroutine.html\" title=\"ALTER ROUTINE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER ROUTINE\u003c/span\u003e\u003c/a\u003e, the \u003ccode class=\"literal\"\u003eDEPENDS ON EXTENSION \u003cem class=\"replaceable\"\u003e\u003ccode\u003eextension_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e action), to be dropped as well.\u003c/p\u003e\u003cp\u003eYou must own the extension to use \u003ccode class=\"command\"\u003eDROP EXTENSION\u003c/code\u003e.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the extension does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of an installed extension.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eAutomatically drop objects that depend on the extension, and in turn all objects that depend on those objects (see \u003ca href=\"/docs/18/ddl-depend.html\" title=\"5.15. Dependency Tracking\"\u003eSection 5.15\u003c/a\u003e).\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThis option prevents the specified extensions from being dropped if other objects, besides these extensions, their members, and their explicitly dependent routines, depend on them. This is the default.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eTo remove the extension \u003ccode class=\"literal\"\u003ehstore\u003c/code\u003e from the current database:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP EXTENSION hstore;\n\u003c/pre\u003e\u003cp\u003eThis command will fail if any of \u003ccode class=\"literal\"\u003ehstore\u003c/code\u003e's objects are in use in the database, for example if any tables have columns of the \u003ccode class=\"type\"\u003ehstore\u003c/code\u003e type. Add the \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e option to forcibly remove those dependent objects as well.\u003c/p\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP EXTENSION\u003c/code\u003e 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/create-extension/?v=18\" title=\"CREATE EXTENSION\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE EXTENSION\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-extension/?v=18\" title=\"ALTER EXTENSION\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER EXTENSION\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"DROP EXTENSION [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [, ...] [ CASCADE | RESTRICT ]","synopsis_text":"DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]"}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
