DROP TYPE
DROP TYPE — удалить тип данных
Синтаксис
DROP TYPE [ IF EXISTS ] имя [, ...] [ CASCADE | RESTRICT ]Описание
DROP TYPE удаляет определённый пользователем тип данных. Удалить тип может только его владелец.
Параметры
IF EXISTSНе считать ошибкой, если тип не существует. В этом случае будет выдано замечание.
имяИмя (возможно, дополненное схемой) типа данных, подлежащего удалению.
CASCADEАвтоматически удалять объекты, зависящие от данного типа (например, столбцы таблиц, функции и операторы), и, в свою очередь, все зависящие от них объекты (см. Раздел 5.14).
RESTRICTОтказать в удалении типа, если от него зависят какие-либо объекты. Это поведение по умолчанию.
Примеры
Удаление типа данных box:
DROP TYPE box;
Совместимость
Эта команда подобна соответствующей команде в стандарте SQL, но указание IF EXISTS является расширением Postgres Pro. Однако учтите, что команда CREATE TYPE и механизм расширения типов в Postgres Pro значительно отличаются от стандарта SQL.
См. также
ALTER TYPE, CREATE TYPEDROP TYPE
DROP TYPE — remove a data type
Synopsis
DROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
Description
DROP TYPE removes a user-defined data type. Only the owner of a type can remove it.
Parameters
IF EXISTSDo not throw an error if the type does not exist. A notice is issued in this case.
nameThe name (optionally schema-qualified) of the data type to remove.
CASCADEAutomatically 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).
RESTRICTRefuse to drop the type if any objects depend on it. This is the default.
Examples
To remove the data type box:
DROP TYPE box;
Compatibility
This command is similar to the corresponding command in the SQL standard, apart from the IF EXISTS option, which is a Postgres Pro extension. But note that much of the CREATE TYPE command and the data type extension mechanisms in Postgres Pro differ from the SQL standard.