DROP_TYPE(7pg14)

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

πŸ’… DROP TYPE πŸ’…

okay so bestie, welcome to DROP_TYPE(7pg14) β€” the page where PostgreSQL lets you remove a data type, and yes, it's giving "cleanup era" ✨


✨ NAME ✨

DROP TYPE β€” remove a data type πŸ’–

πŸ¦‹ SYNOPSIS πŸ¦‹

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

🌸 DESCRIPTION 🌸

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

πŸŽ€ PARAMETERS πŸŽ€

  • IF EXISTS β€” do not throw an error if the type does not exist. A notice is issued in this case, so it's like a little "bestie, it's already gone" heads-up πŸ’Œ
  • name β€” the name of the data type to remove. It can be optionally schema-qualified, iykyk 🧚
  • 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 the "and everything attached to it comes too" option 😭πŸ”₯
  • RESTRICT β€” refuse to drop the type if any objects depend on it. This is the default, so it's the cautious icon behavior 🫢

🌈 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 β€” so like, standard-ish, but make it PostgreSQL πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘


πŸ’– cute little sign-off: this slay page is from PostgreSQL 14.24, dated 2026, and it's the DROP TYPE(7) page. mwah πŸ’‹

πŸ“¦ where this page comes from