> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# DROP TYPE

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

The `DROP TYPE` <InternalLink path="sql-statements">statement</InternalLink> drops a specified <InternalLink path="enum">enumerated data type</InternalLink> from the current database.

The `DROP TYPE` statement performs a schema change. For more information about how online schema changes work in CockroachDB, see <InternalLink path="online-schema-changes">Online Schema Changes</InternalLink>.

## Synopsis

<img src="https://mintcdn.com/cockroachlabs/N8jqu5GnKPMC09TX/images/sql-diagrams/v25.4/drop_type.svg?fit=max&auto=format&n=N8jqu5GnKPMC09TX&q=85&s=825efd49baf6fffc6cfa905b12b2aa2f" alt="drop_type syntax diagram" style={{maxWidth: "100%", overflowX: "auto"}} width="513" height="69" data-path="images/sql-diagrams/v25.4/drop_type.svg" />

## Parameters

| Parameter          | Description                                                               |
| ------------------ | ------------------------------------------------------------------------- |
| `IF EXISTS`        | Drop the type if it exists. If it does not exist, do not return an error. |
| `type\_name\_list` | A type name or a comma-separated list of type names to drop.              |

## Required privileges

The user must be the owner of the type.

## Details

* You cannot drop a type or view that is in use by a table.
* You can only drop a user-defined type from the database that contains the type.

## Examples

### Drop a single type

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> CREATE TYPE IF NOT EXISTS status AS ENUM ('open', 'closed', 'inactive');
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW ENUMS;
```

```text theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
  schema |  name  |        value
---------+--------+-----------------------
  public | status | open|closed|inactive
(1 row)
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> CREATE TABLE IF NOT EXISTS accounts (
        id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
        balance DECIMAL,
        status status
);
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
-- sqlchecker: ignore
> DROP TYPE status;
```

```text theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
ERROR: cannot drop type "status" because other objects ([bank.public.accounts]) still depend on it
SQLSTATE: 2BP01
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> DROP TABLE accounts;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> DROP TYPE status;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW ENUMS;
```

```text theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
  schema | name | value
---------+------+--------
(0 rows)
```

### Drop multiple types

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> CREATE TYPE weekday AS ENUM ('monday', 'tuesday', 'wednesday', 'thursday', 'friday');
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> CREATE TYPE weekend AS ENUM ('sunday', 'saturday');
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW ENUMS;
```

```text theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
  schema |  name   |                  value
---------+---------+-------------------------------------------
  public | weekday | monday|tuesday|wednesday|thursday|friday
  public | weekend | sunday|saturday
(2 rows)
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> DROP TYPE weekday, weekend;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW ENUMS;
```

```text theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
  schema | name | value
---------+------+--------
(0 rows)
```

## See also

* <InternalLink path="enum">`ENUM`</InternalLink>
* <InternalLink path="data-types">Data types</InternalLink>
* <InternalLink path="create-type">`CREATE TYPE`</InternalLink>
* <InternalLink path="alter-type">`ALTER TYPE`</InternalLink>
* <InternalLink path="show-enums">`SHOW ENUMS`</InternalLink>
