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 ๐Ÿ’œ


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 ๐Ÿ‘‘๐Ÿ’–โœจ