DROP_DOMAIN(7pg13)

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

okay so bestie, welcome to the DROP DOMAIN(7) page from the PostgreSQL 13.23 Documentation πŸ’–

✨ NAME ✨

DROP DOMAIN β€” remove a domain. That’s the whole name, no cap.

πŸ¦‹ SYNOPSIS πŸ¦‹

Here’s the syntax, copy it exactly because syntax is not a vibe you freestyle:

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

πŸ’… DESCRIPTION πŸ’…

So DROP DOMAIN removes a domain. Literally its whole job. Important vibe check though: only the owner of a domain can remove it. If you’re not the owner, this is not your main character moment β€” you can’t just delete someone else’s domain. Periodt.

πŸŽ€ PARAMETERS πŸŽ€

  • IF EXISTS β€” Do not throw an error if the domain does not exist. A notice is issued in this case instead. Very chill, no dramatic exit 😌
  • name β€” The name of an existing domain, and yes it can be optionally schema-qualified. So you can point at exactly the domain you mean, iykyk.
  • CASCADE β€” Automatically drop objects that depend on the domain (such as table columns), and in turn all objects that depend on those objects (see Section 5.14). This is the β€œtake the dependents down with it” option, so highkey be careful πŸ’€
  • RESTRICT β€” Refuse to drop the domain if any objects depend on it. This is the default, so if you don’t pick CASCADE, RESTRICT is already the vibe.

🌸 EXAMPLES 🌸

To remove the domain box:

DROP DOMAIN box;

That’s it. That’s the example. Slay ✨

⭐ COMPATIBILITY ⭐

This command conforms to the SQL standard, bestie β€” except for the IF EXISTS option, which is a PostgreSQL extension. So that little safety net is very PostgreSQL, not standard SQL. Iykyk 🫢

πŸ‘‘ SEE ALSO πŸ‘‘


okay that’s the whole page, bestie! This was PostgreSQL 13.23, dated 2025, and the page is DROP DOMAIN(7). Mwah πŸ’–βœ¨

πŸ“¦ where this page comes from