{"Entry":{"collection":"sql","key":"drop-type","name":"DROP TYPE","aliases":["droptype"],"metadata":{"aliases":["droptype"],"changed_in":["7.1","7.3","7.4","8.2"],"changes":[{"from":"6.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["usage"],"removed":[]},"status":"changed","synopsis":null,"to":"6.5"},{"from":"6.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"7.0"},{"from":"7.0","purpose_changed":true,"renamed":{"from_file":"sql-droptype.htm","to_file":"sql-droptype.html"},"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":{"added":["DROP TYPE typename [, ...]"],"removed":[]},"to":"7.1"},{"from":"7.1","purpose_changed":true,"renamed":null,"sections":{"added":["notes","examples","see_also"],"changed":["description","compatibility"],"removed":["usage"]},"status":"changed","synopsis":null,"to":"7.2"},{"from":"7.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["compatibility"],"removed":["notes"]},"status":"changed","synopsis":{"added":["DROP TYPE typename [, ...] [ CASCADE | RESTRICT ]"],"removed":[]},"to":"7.3"},{"from":"7.3","purpose_changed":true,"renamed":null,"sections":{"added":["parameters"],"changed":["description","examples","compatibility"],"removed":[]},"status":"changed","synopsis":{"added":["DROP TYPE name [, ...] [ CASCADE | RESTRICT ]"],"removed":["DROP TYPE typename [, ...] [ CASCADE | RESTRICT ]"]},"to":"7.4"},{"from":"7.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["see_also"],"removed":[]},"status":"changed","synopsis":null,"to":"8.0"},{"from":"8.1","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters","compatibility"],"removed":[]},"status":"changed","synopsis":{"added":["DROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]"],"removed":[]},"to":"8.2"},{"from":"8.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"8.3"},{"from":"9.0","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["compatibility","see_also"],"removed":[]},"status":"changed","synopsis":null,"to":"9.1"},{"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":"3e5147102c77ad97aceb289bb171c3932b9c540d84ddfe4690cff2148ae25ef2","derived_content_hash":"4afc41a4e4d2d1faae66c5c9521a104711b8c2a5b069390963c14f8be3e12616","editorial":{},"first_version":"6.4","group":"type","imported_at":"2026-09-30T17:43:37.725867+08:00","last_version":"20","name":"DROP TYPE","object":"TYPE","position":3022,"present_in":["6.4","6.5","7.0","7.1","7.2","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 a data type","purpose_zh":"","related":["alter-type","create-type"],"repair_provenance":{"original_source_revision":"wiki-repair-20261023:ea56789d43b5430845d8b5752d1e08e16929d8aa8ad68ab6f86ab2ae88ad1864","receipt_sha256":"f9a2fba8cd7ddc2de2b73585e23933d1ee9c0edd97e660a8b16640d2b312e028","repair":"wiki-repair-20261023"},"slug":"drop-type","source_rev":"wiki-repair-20261023:81fcc6d8400f22def36022a0b30d806146ba6e326e4910607338761cf3721d34","synopsis":"DROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]","verb":"DROP"}},"Definition":{"Collection":"sql","Key":"drop-type","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"drop-type","SourceRevision":"wiki-repair-20261023:81fcc6d8400f22def36022a0b30d806146ba6e326e4910607338761cf3721d34","Facts":{"anchor":"SQL-DROPTYPE","description_zh":"移除一个数据类型","description_zh_html":"\u003cpre\u003eDROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eDROP TYPE\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=\"type\"\u003ebox\u003c/code\u003e：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nDROP TYPE box;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\n   此命令与 SQL 标准中的对应命令相似，但 \u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e 选项是\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 扩展。不过请注意，\u003ccode class=\"command\"\u003eCREATE TYPE\u003c/code\u003e 命令的大部分内容，以及\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 中的数据类型扩展机制，都不同于 SQL 标准。\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-altertype.html\" title=\"ALTER TYPE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER TYPE\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-createtype.html\" title=\"CREATE TYPE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE TYPE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","file":"sql-droptype.html","lang":"en","name":"DROP TYPE","purpose":"remove a data type","purpose_zh":"移除一个数据类型","related":["alter-type","create-type"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP TYPE\u003c/code\u003e removes a user-defined data type. Only the owner of a type can remove it.\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 type 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 the data type to remove.\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 type (such as table columns, functions, and operators), 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 type 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\u003eTo remove the data type \u003ccode class=\"type\"\u003ebox\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP TYPE box;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003eThis command is similar to the corresponding command in the SQL standard, apart from the \u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e option, which is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension. But note that much of the \u003ccode class=\"command\"\u003eCREATE TYPE\u003c/code\u003e command and the data type extension mechanisms in \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e differ from the SQL standard.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/alter-type/?v=18\" title=\"ALTER TYPE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER TYPE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/create-type/?v=18\" title=\"CREATE TYPE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE TYPE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"DROP TYPE [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [, ...] [ CASCADE | RESTRICT ]","synopsis_text":"DROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-droptype.html","sha256":"1ccae644a836f8c19728da20f740fa78c4f6f48491485dd8f106355192a9f41e"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"drop-type","SourceDatabase":"center","Version":"18","Locale":"en","Title":"DROP TYPE","Summary":"remove a data type","BodyHTML":"\u003cpre\u003eDROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP TYPE\u003c/code\u003e removes a user-defined data type. Only the owner of a type can remove it.\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 type 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 (optionally schema-qualified) of the data type to remove.\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 type (such as table columns, functions, and operators), 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\u003eRefuse to drop the type if any objects depend on it. 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 data type \u003ccode\u003ebox\u003c/code\u003e:\u003c/p\u003e\u003cpre\u003eDROP TYPE box;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003eThis command is similar to the corresponding command in the SQL standard, apart from the \u003ccode\u003eIF EXISTS\u003c/code\u003e option, which is a \u003cspan\u003ePostgreSQL\u003c/span\u003e extension. But note that much of the \u003ccode\u003eCREATE TYPE\u003c/code\u003e command and the data type extension mechanisms in \u003cspan\u003ePostgreSQL\u003c/span\u003e differ from the SQL standard.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/alter-type/?v=18\" title=\"ALTER TYPE\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER TYPE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/create-type/?v=18\" title=\"CREATE TYPE\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE TYPE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:81fcc6d8400f22def36022a0b30d806146ba6e326e4910607338761cf3721d34","ContentHash":"f0bc2dce21d69b8900d906629b8d1931baf7754e888ccf5af98b5b39af5aa724","Payload":{"related":["alter-type","create-type"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP TYPE\u003c/code\u003e removes a user-defined data type. Only the owner of a type can remove it.\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 type 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 the data type to remove.\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 type (such as table columns, functions, and operators), 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 type 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\u003eTo remove the data type \u003ccode class=\"type\"\u003ebox\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP TYPE box;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003eThis command is similar to the corresponding command in the SQL standard, apart from the \u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e option, which is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension. But note that much of the \u003ccode class=\"command\"\u003eCREATE TYPE\u003c/code\u003e command and the data type extension mechanisms in \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e differ from the SQL standard.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/alter-type/?v=18\" title=\"ALTER TYPE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER TYPE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/create-type/?v=18\" title=\"CREATE TYPE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE TYPE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"DROP TYPE [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [, ...] [ CASCADE | RESTRICT ]","synopsis_text":"DROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]"}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","6.4","6.5","7.0","7.1","7.2","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}
