DROP_TYPE(7pg15)

πŸ“¦ version 15.19, in opensuse-leap 16.0

πŸ’… DROP TYPE πŸ’…

okay bestie, so this is the DROP TYPE page from the PostgreSQL 15.19 Documentation β€” it's the one about yeeting a data type out of existence. it's short, it's sweet, and it absolutely has opinions about who's allowed to press the delete button πŸŽ€


✨ NAME ✨

DROP_TYPE β€” remove a data type πŸ—‘οΈβœ¨

🌸 SYNOPSIS 🌸

DROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

like, that's the whole vibe. you can drop one, you can drop a whole little list of them, and you get to pick how dramatic the fallout is πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

DROP TYPE removes a user-defined data type. that's the whole job, no cap.

and here's the lil gatekeeping bit: only the owner of a type can remove it πŸ‘‘ so if it's not yours, hands off, respectfully.

πŸ’– PARAMETERS πŸ’–

  • IF EXISTS β€” don't throw an error if the type doesn't exist. instead, a notice gets issued, which is basically postgres being like "mmk bestie, it wasn't there but go off" πŸ™ˆ
  • name β€” the name of the data type you wanna remove. it can be schema-qualified if you're being extra specific (optionally, tho) 🎯
  • CASCADE β€” automatically drop the objects that depend on the type (think table columns, functions, and operators), and then in turn all the objects that depend on those objects. yes it's a whole chain reaction, see Section 5.14 πŸ”₯
  • RESTRICT β€” refuse to drop the type if literally any object depends on it. this is the default, so postgres is cautious unless you tell it otherwise πŸ›‘ this is the safe lil default and honestly? iconic of it.

πŸ’œ EXAMPLES πŸ’œ

to remove the data type box:

DROP TYPE box;

that's it. that's the example. slay πŸ’…

🧚 COMPATIBILITY 🧚

this command is similar to the corresponding command in the SQL standard, apart from the IF EXISTS option β€” that one's a PostgreSQL extension 🐘✨

but lowkey, heads up: much of the CREATE TYPE command and the data type extension mechanisms in PostgreSQL differ from the SQL standard. so like, don't assume the vibes line up perfectly 🫢

🌈 SEE ALSO 🌈


and that's the tea, bestie πŸ“ this was DROP TYPE(7) from PostgreSQL 15.19, dated 2026 β€” go forth and delete responsibly, mwah πŸ’–πŸŽ€

πŸ“¦ where this page comes from