DROP_TYPE(7pg13)

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

Okay so bestie, welcome to the DROP_TYPE(7) page from the PostgreSQL 13.23 Documentation β€” this is the whole guide to yeeting a user-defined data type out of your database. πŸ’…βœ¨

πŸŽ€ NAME πŸŽ€

DROP TYPE removes a user-defined data type. Only the owner of a type can remove it. Periodt. πŸ‘‘

✨ SYNOPSIS ✨

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

πŸ’– DESCRIPTION πŸ’–

So what does it do? DROP TYPE removes a user-defined data type. Only the owner of a type can remove it β€” no cap. πŸ’–

πŸ’… PARAMETERS πŸ’…

  • IF EXISTS β€” Don't throw an error if the type doesn't exist. A notice is issued in this case. Cute little heads-up instead of drama. 🫢
  • name β€” The name of the data type to remove, optionally schema-qualified. ✨
  • CASCADE β€” Automatically drop objects that depend on the type β€” such as table columns, functions, and operators β€” and in turn all objects that depend on those objects (see Section 5.14). It's giving domino effect, so be careful. 😭
  • RESTRICT β€” Refuse to drop the type if any objects depend on it. This is the default, bestie β€” so if you don't say CASCADE, this is what you get. πŸ’…

πŸ¦‹ EXAMPLES πŸ¦‹

To remove the data type box:

DROP TYPE box;

🌈 COMPATIBILITY 🌈

This command is similar to the corresponding command in the SQL standard, apart from the IF EXISTS option, which is a PostgreSQL extension. But note that much of the CREATE TYPE command and the data type extension mechanisms in PostgreSQL differ from the SQL standard. πŸ¦‹

πŸ”₯ SEE ALSO πŸ”₯


Big slay from the PostgreSQL 13.23 docs, dated 2025 β€” DROP_TYPE(7) signing off. Stay iconic, bestie. πŸ’–πŸŽ€πŸ’…

πŸ“¦ where this page comes from