DROP TYPE statement drops a specified enumerated data type from the current database.
The
DROP TYPE statement performs a schema change. For more information about how online schema changes work in CockroachDB, see Online Schema Changes.Synopsis
To drop a domain data type, use the
DROP DOMAIN statement. DROP DOMAIN shares its syntax and behavior with DROP TYPE, as shown in the synopsis. For an example, refer to Drop a domain.Parameters
Required privileges
The user must be the owner of the type or domain, or the owner of the schema that contains the type or domain.Details
- Without
CASCADE, you cannot drop a type or domain that is in use by a table. - Without
CASCADE, you cannot drop a type that a domain data type is based on. Drop the domain first. - You can only drop a user-defined type from the database that contains the type.
Examples
Drop a single type
Drop multiple types
Drop a domain
Create a domain data type and a table that uses it:Drop a type and its dependent objects
The following example usesCASCADE to drop an enumerated type together with a domain that is based on it and a table column that uses the domain.
Create an enumerated type, a domain based on the type, and a table that uses the domain:
CASCADE, the type cannot be dropped because the domain depends on it:
CASCADE:
status type, the account_status domain, and the status column. The accounts table and its other columns are kept:
Known limitations
DROP TYPE ... CASCADEreturns an error if a column of the type is part of a table’s primary key, and nothing is dropped. PostgreSQL instead drops the column, which also drops the table’s primary key.

