DROP_TYPE(7)
๐ DROP TYPE โ the manual, but make it cute
okay so bestie, welcome to DROP_TYPE(7) from the PostgreSQL 18.6 Documentation โ this is the page about yeeting a data type out of existence. it's giving spring cleaning. it's giving "we don't need her anymore." let's get into it ๐งโจ
โจ NAME โจ
DROP_TYPE โ remove a data type. that's it, that's the whole vibe. bye bye type ๐ซถ
๐ธ SYNOPSIS ๐ธ
DROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
look at her. short, sweet, absolutely unbothered. ๐
๐ DESCRIPTION ๐
DROP TYPE removes a user-defined data type. that's the whole job, no notes.
but โ and this is the important part, bestie, don't skip it โ only the owner of a type can remove it. not your friend, not your coworker, not the random person in the group chat who thinks they run things. the owner. periodt. ๐
๐ PARAMETERS ๐
IF EXISTSโ do NOT throw an error if the type doesn't exist. instead, a notice gets issued. so like, it's the "no worries if not!!" of SQL. no drama, no crash, just a lil heads up. ๐nameโ the name of the data type you wanna remove, and it can be optionally schema-qualified. so you can be as specific or as casual as you want with it. โจCASCADEโ okay so this one goes kinda feral. it automatically drops objects that depend on the type โ think table columns, functions, and operators โ and then in turn all the objects that depend on those objects. it's a whole chain reaction. (see Section 5.15 for the full lore, iykyk.) ๐ฅRESTRICTโ refuses to drop the type if anything depends on it. this is the default, so if you don't say anything, this is the energy you get. it's the responsible friend of the two. ๐ก๏ธ
ngl, CASCADE will take the whole building down with it. know what you're doing before you type that. ๐ญ
๐ EXAMPLES ๐
wanna remove the data type box? say less:
DROP TYPE box;
done. iconic. she's gone. ๐โจ
๐ฆ COMPATIBILITY ๐ฆ
so this command is similar to the corresponding command in the SQL standard โ except for the IF EXISTS option, which is a PostgreSQL extension. little treat, just for us. ๐
BUT โ and this is the plot twist โ note that much of the CREATE TYPE command and the data type extension mechanisms in PostgreSQL differ from the SQL standard. so like, same vibe, different execution. don't @ me. ๐
๐ SEE ALSO ๐
ALTER TYPE(ALTER_TYPE(7))CREATE TYPE(CREATE_TYPE(7))
and that's the page!! go forth and drop responsibly, bestie ๐ซถ
PostgreSQL 18.6 ยท 2026 โ mwah, sending you the biggest kiss, thanks for reading the docs, you're doing amazing sweetie ๐๐โจ
๐ฆ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 ยท PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 ยท PostgreSQL
- arch rolling: postgresql 18.6-4 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-client-18 18.6-0ubuntu0.26.04.1 ยท PostgreSQL
- ubuntu stonking: postgresql-client-18 18.6-3build2 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms