Skip to main content
The DROP TYPE drops a specified from the current database.
The DROP TYPE statement performs a schema change. For more information about how online schema changes work in CockroachDB, see .

Synopsis

drop_type syntax diagram
To drop a , 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.

Details

  • You cannot drop a type or domain that is in use by a table.
  • You cannot drop a type that a 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 and a table that uses it:
A domain that is in use by a table cannot be dropped:
Drop the dependent table, then drop the domain:

Known limitations

  • Unlike PostgreSQL, a user who owns a schema cannot drop a type or domain in that schema without also being the owner of the type or domain.
  • DROP TYPE ... CASCADE and DROP DOMAIN ... CASCADE are not supported.

See also