Postgresql 中文操作指南

DROP TYPE

DROP TYPE — 删除数据类型

DROP TYPE — remove a data type

Synopsis

DROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

Description

DROP TYPE 删除用户定义的数据类型。只有类型的拥有者可以删除它。

DROP TYPE removes a user-defined data type. Only the owner of a type can remove it.

Parameters

  • IF EXISTS

    • Do not throw an error if the type does not exist. A notice is issued in this case.

  • name

    • The name (optionally schema-qualified) of the data type to remove.

  • CASCADE

    • Automatically 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 Section 5.14).

  • RESTRICT

    • Refuse to drop the type if any objects depend on it. This is the default.

Examples

如要删除数据类型 box

To remove the data type box:

DROP TYPE box;

Compatibility

此命令类似于 SQL 标准中的对应命令,除了 IF EXISTS 选项(此选项是 PostgreSQL 扩展)。但请注意, CREATE TYPE 命令和 PostgreSQL 中的数据类型扩展机制在 SQL 标准中有所不同。

This command is similar to the corresponding command in the SQL standard, apart from the IF EXISTS option, which is a PostgreSQL extension. But note that much of the CREATE TYPE command and the data type extension mechanisms in PostgreSQL differ from the SQL standard.