{"Entry":{"collection":"sql","key":"drop-operator-class","name":"DROP OPERATOR CLASS","aliases":["dropopclass"],"metadata":{"aliases":["dropopclass"],"changed_in":["7.4","8.2"],"changes":[{"from":"7.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"7.3"},{"from":"7.3","purpose_changed":true,"renamed":null,"sections":{"added":["parameters","examples","see_also"],"changed":["description","compatibility"],"removed":["usage"]},"status":"changed","synopsis":{"added":["DROP OPERATOR CLASS name USING index_method [ CASCADE | RESTRICT ]"],"removed":["DROP OPERATOR CLASS name USING access_method [ CASCADE | RESTRICT ]"]},"to":"7.4"},{"from":"8.1","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":{"added":["DROP OPERATOR CLASS [ IF EXISTS ] name USING index_method [ CASCADE | RESTRICT ]"],"removed":[]},"to":"8.2"},{"from":"8.2","purpose_changed":false,"renamed":null,"sections":{"added":["notes"],"changed":["description","see_also"],"removed":[]},"status":"changed","synopsis":null,"to":"8.3"},{"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":"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":"71f5928849761ec44f11262c3cc175d604e7e73b36bc254faa92ca81dfbaec1e","editorial":{},"first_version":"7.3","group":"type","imported_at":"2026-09-30T17:43:37.571501+08:00","last_version":"20","name":"DROP OPERATOR CLASS","object":"OPERATOR CLASS","position":3016,"present_in":["7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","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 operator class","purpose_zh":"","related":["alter-operator-class","create-operator-class","drop-operator-family"],"slug":"drop-operator-class","source_rev":"a709ab85","synopsis":"DROP OPERATOR CLASS [ IF EXISTS ] name USING index_method [ CASCADE | RESTRICT ]","verb":"DROP"}},"Definition":{"Collection":"sql","Key":"drop-operator-class","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"drop-operator-class","SourceRevision":"a709ab85","Facts":{"anchor":"SQL-DROPOPCLASS","file":"sql-dropopclass.html","lang":"en","name":"DROP OPERATOR CLASS","purpose":"remove an operator class","purpose_zh":"","related":["alter-operator-class","create-operator-class","drop-operator-family"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP OPERATOR CLASS\u003c/code\u003e drops an existing operator class. To execute this command you must be the owner of the operator class.\u003c/p\u003e\u003cp\u003e\u003ccode class=\"command\"\u003eDROP OPERATOR CLASS\u003c/code\u003e does not drop any of the operators or functions referenced by the class. If there are any indexes depending on the operator class, you will need to specify \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e for the drop to complete.\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 operator class 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 (optionally schema-qualified) of an existing operator class.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex_method\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of the index access method the operator class is for.\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 operator class (such as indexes), 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\u003eRefuse to drop the operator class if any objects depend on it. This is the default.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP OPERATOR CLASS\u003c/code\u003e will not drop the operator family containing the class, even if there is nothing else left in the family (in particular, in the case where the family was implicitly created by \u003ccode class=\"command\"\u003eCREATE OPERATOR CLASS\u003c/code\u003e). An empty operator family is harmless, but for the sake of tidiness you might wish to remove the family with \u003ccode class=\"command\"\u003eDROP OPERATOR FAMILY\u003c/code\u003e; or perhaps better, use \u003ccode class=\"command\"\u003eDROP OPERATOR FAMILY\u003c/code\u003e in the first place.\u003c/p\u003e","key":"notes","title":"Notes"},{"html":"\u003cp\u003eRemove the B-tree operator class \u003ccode class=\"literal\"\u003ewidget_ops\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP OPERATOR CLASS widget_ops USING btree;\n\u003c/pre\u003e\u003cp\u003eThis command will not succeed if there are any existing indexes that use the operator class. Add \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e to drop such indexes along with the operator class.\u003c/p\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003eThere is no \u003ccode class=\"command\"\u003eDROP OPERATOR CLASS\u003c/code\u003e statement in the SQL standard.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/alter-operator-class/?v=18\" title=\"ALTER OPERATOR CLASS\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER OPERATOR CLASS\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/create-operator-class/?v=18\" title=\"CREATE OPERATOR CLASS\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE OPERATOR CLASS\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-operator-family/?v=18\" title=\"DROP OPERATOR FAMILY\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP OPERATOR FAMILY\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"DROP OPERATOR CLASS [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e USING \u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex_method\u003c/code\u003e\u003c/em\u003e [ CASCADE | RESTRICT ]","synopsis_text":"DROP OPERATOR CLASS [ IF EXISTS ] name USING index_method [ CASCADE | RESTRICT ]"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"drop-operator-class","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"DROP OPERATOR CLASS","Summary":"移除一个操作符类","BodyHTML":"\u003cpre\u003eDROP OPERATOR CLASS [ IF EXISTS ] name USING index_method [ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP OPERATOR CLASS\u003c/code\u003e删除一个现有操作符类。要执行此命令，你必须是该操作符类的拥有者。\u003c/p\u003e\u003cp\u003e\u003ccode\u003eDROP OPERATOR CLASS\u003c/code\u003e不会删除该类所引用的任何操作符或函数。如果有索引依赖于该操作符类，你将需要指定\u003ccode\u003eCASCADE\u003c/code\u003e 才能完成删除。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\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\u003e如果该操作符类不存在，则不要抛出错误。这种情况下会发出一个提示。\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\u003e一个现有操作符类的名称（可以是模式限定的）。\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003eindex_method\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e该操作符类所属索引访问方法的名称。\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e自动删除依赖于该操作符类的对象（例如索引），以及进一步依赖于这些对象的所有对象（参见\u003ca href=\"/docs/18/ddl-depend.html\" rel=\"nofollow\"\u003e第 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\u003e如果有任何对象依赖于该操作符类，则拒绝删除它。这是默认值。\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e注解\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP OPERATOR CLASS\u003c/code\u003e不会删除包含该类的操作符族，即使该族中已经没有任何其他成员（尤其是在该族由\u003ccode\u003eCREATE OPERATOR CLASS\u003c/code\u003e隐式创建的情况下）。空的操作符族并无害处，但为了整洁起见，你也许会希望用 \u003ccode\u003eDROP OPERATOR FAMILY\u003c/code\u003e删除该族；或者更好的做法是，一开始就直接使用\u003ccode\u003eDROP OPERATOR FAMILY\u003c/code\u003e。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e移除 B-树操作符类\u003ccode\u003ewidget_ops\u003c/code\u003e：\u003c/p\u003e\u003cpre\u003eDROP OPERATOR CLASS widget_ops USING btree;\n\u003c/pre\u003e\u003cp\u003e如果仍有索引使用该操作符类，此命令将不会成功。加上\u003ccode\u003eCASCADE\u003c/code\u003e可以在删除操作符类的同时删除这类索引。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003eSQL 标准中没有\u003ccode\u003eDROP OPERATOR CLASS\u003c/code\u003e语句。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/alter-operator-class/?v=18\" title=\"ALTER OPERATOR CLASS\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER OPERATOR CLASS\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/create-operator-class/?v=18\" title=\"CREATE OPERATOR CLASS\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE OPERATOR CLASS\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-operator-family/?v=18\" title=\"DROP OPERATOR FAMILY\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP OPERATOR FAMILY\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"1b5ca64c","ContentHash":"5980bb9ece4cee965283766e59bb8443882ba9e5a3f753d682428c829ab60e1f","Payload":{"purpose_zh":"移除一个操作符类","sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP OPERATOR CLASS\u003c/code\u003e删除一个现有操作符类。要执行此命令，你必须是该操作符类的拥有者。\u003c/p\u003e\u003cp\u003e\u003ccode class=\"command\"\u003eDROP OPERATOR CLASS\u003c/code\u003e不会删除该类所引用的任何操作符或函数。如果有索引依赖于该操作符类，你将需要指定\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e 才能完成删除。\u003c/p\u003e","key":"description","title":"描述"},{"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\u003e如果该操作符类不存在，则不要抛出错误。这种情况下会发出一个提示。\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一个现有操作符类的名称（可以是模式限定的）。\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex_method\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e该操作符类所属索引访问方法的名称。\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自动删除依赖于该操作符类的对象（例如索引），以及进一步依赖于这些对象的所有对象（参见\u003ca href=\"/docs/18/ddl-depend.html\" title=\"5.15. 依赖跟踪\"\u003e第 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\u003e如果有任何对象依赖于该操作符类，则拒绝删除它。这是默认值。\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"参数"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP OPERATOR CLASS\u003c/code\u003e不会删除包含该类的操作符族，即使该族中已经没有任何其他成员（尤其是在该族由\u003ccode class=\"command\"\u003eCREATE OPERATOR CLASS\u003c/code\u003e隐式创建的情况下）。空的操作符族并无害处，但为了整洁起见，你也许会希望用 \u003ccode class=\"command\"\u003eDROP OPERATOR FAMILY\u003c/code\u003e删除该族；或者更好的做法是，一开始就直接使用\u003ccode class=\"command\"\u003eDROP OPERATOR FAMILY\u003c/code\u003e。\u003c/p\u003e","key":"notes","title":"注解"},{"html":"\u003cp\u003e移除 B-树操作符类\u003ccode class=\"literal\"\u003ewidget_ops\u003c/code\u003e：\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP OPERATOR CLASS widget_ops USING btree;\n\u003c/pre\u003e\u003cp\u003e如果仍有索引使用该操作符类，此命令将不会成功。加上\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e可以在删除操作符类的同时删除这类索引。\u003c/p\u003e","key":"examples","title":"示例"},{"html":"\u003cp\u003eSQL 标准中没有\u003ccode class=\"command\"\u003eDROP OPERATOR CLASS\u003c/code\u003e语句。\u003c/p\u003e","key":"compatibility","title":"兼容性"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/alter-operator-class/?v=18\" title=\"ALTER OPERATOR CLASS\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER OPERATOR CLASS\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/create-operator-class/?v=18\" title=\"CREATE OPERATOR CLASS\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE OPERATOR CLASS\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-operator-family/?v=18\" title=\"DROP OPERATOR FAMILY\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP OPERATOR FAMILY\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"另见"}],"sections_same_as":"","synopsis_html":"DROP OPERATOR CLASS [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e USING \u003cem class=\"replaceable\"\u003e\u003ccode\u003eindex_method\u003c/code\u003e\u003c/em\u003e [ CASCADE | RESTRICT ]","synopsis_text":"DROP OPERATOR CLASS [ IF EXISTS ] name USING index_method [ CASCADE | RESTRICT ]"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
