Updated on 2025-07-22 GMT+08:00

DROP TYPE

Function

DROP TYPE deletes a user-defined data type. Only the type owner has permission to run this statement.

Syntax

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

Parameter Description

Table 1 DROP TYPE parameters

Parameter

Description

Value Range

IF EXISTS

Sends a notice instead of an error if the specified type does not exist.

-

name

Specifies the name of the type to be deleted (schema-qualified).

Specifies an existing domain type.

CASCADE | RESTRICT

Specifies how to process related data in the dependent object when a delete operation is performed.

  • CASCADE: Deletes objects (such as columns, functions, and operators) that depend on the type.
  • RESTRICT: Refuses to delete the type if any objects depend on it. This is the default.

Examples

Delete the compfoo type:

1
DROP TYPE compfoo cascade;

Helpful Links

ALTER TYPE, CREATE TYPE