DROP TYPE

A DDL command for removing a custom data type

DROP TYPE is a DDL command for removing a custom data type.

DROP TYPE has always been present in PostgreSQL.

Change history

Examples

postgres=# DROP TYPE unused_type;
DROP TYPE

postgres=# DROP TYPE some_enum_type;
ERROR:  cannot drop type some_enum_type because other objects depend on it
DETAIL:  column thing_type of table thing depends on type some_enum_type

postgres=# DROP TYPE some_enum_type CASCADE;
NOTICE:  drop cascades to column thing_type of table thing
DROP TYPE

postgres=# DROP TYPE no_such_type;
ERROR:  type "no_such_type" does not exist

postgres=# DROP TYPE IF EXISTS no_such_type;
NOTICE:  type "no_such_type" does not exist, skipping
DROP TYPE

Categories

Data type, DDL

See also

CREATE TYPE, ALTER TYPE, pg_type