---
title: "DROP TYPE"
url: "https://docs.yugabyte.com/stable/api/ysql/the-sql-language/statements/ddl_drop_type/"
---

# DROP TYPE

Use the DROP TYPE statement to remove a user-defined type from the database.

## Synopsis

Use the `DROP TYPE` statement to remove a user-defined type from the database.

## Syntax

- [![Grammar Icon](/icons/file-lines.svg)Grammar](#grammar-1)
- [![Diagram Icon](/icons/diagram.svg)Diagram](#diagram-1)

```output.ebnf
drop_type ::= DROP TYPE [ IF EXISTS ] type_name [ , ... ] 
              [ CASCADE | RESTRICT ]
```

#### drop\_type

DROPTYPEIFEXISTS,[type\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#type-name)CASCADERESTRICT

## Semantics

### *drop\_type*

### *type\_name*

Specify the name of the user-defined type to drop.

## Examples

Simple example

```plpgsql
yugabyte=# CREATE TYPE feature_struct AS (id INTEGER, name TEXT);
yugabyte=# DROP TYPE feature_struct;
```

`IF EXISTS` example

```plpgsql
yugabyte=# DROP TYPE IF EXISTS feature_shell;
```

`CASCADE` example

```plpgsql
yugabyte=# CREATE TYPE feature_enum AS ENUM ('one', 'two', 'three');
yugabyte=# CREATE TABLE feature_tab_enum (feature_col feature_enum);
yugabyte=# DROP TYPE feature_tab_enum CASCADE;
```

`RESTRICT` example

```plpgsql
yugabyte=# CREATE TYPE feature_range AS RANGE (subtype=INTEGER);
yugabyte=# CREATE TABLE feature_tab_range (feature_col feature_range);
yugabyte=# -- The following should error:
yugabyte=# DROP TYPE feature_range RESTRICT;
yugabyte=# DROP TABLE feature_tab_range;
yugabyte=# DROP TYPE feature_range RESTRICT;
```

## See also

- [ALTER TYPE](/stable/api/ysql/the-sql-language/statements/ddl_alter_type "ALTER TYPE")
- [CREATE TYPE](/stable/api/ysql/the-sql-language/statements/ddl_create_type "CREATE TYPE")
