DROP_DOMAIN(7pg15)
π
DROP DOMAIN(7) β the drop_domain page, bestie
okay so real talk: this is page DROP DOMAIN(7) from the PostgreSQL 15.19 docs, and it's literally the glow-up-and-goodbye page for domains. let's get into it β¨
π NAME π
DROP_DOMAIN β remove a domain. yeah. that's the whole vibe. deleting it. gone. π
β¨ SYNOPSIS β¨
DROP DOMAIN [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
that's it. that's the whole spell. cast it and the domain is over π«Ά
π¦ DESCRIPTION π¦
DROP DOMAIN removes a domain. simple as. but here's the catch, and it's giving "you're not the owner, you're a guest":
Only the owner of a domain can remove it. β
no owner energy? no deletion energy. periodt.
πΈ PARAMETERS πΈ (the part you actually need)
IF EXISTSβ do not throw an error if the domain does not exist. instead a notice gets issued in this case, which is the polite little "hey, there was nothing there bestie" of the SQL world πnameβ the name (optionally schema-qualified) of an existing domain. that's your target, main character of this operation π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). lowkey this is the chain-reaction option, it takes everything downstream with it πRESTRICTβ refuse to drop the domain if any objects depend on it. this is the default. very much the "nope, not touching that, something's attached" setting π§
heads up bestie:CASCADEis not a joke β it cascades. it drops dependent objects and then the objects depending on those. if you don't want that,RESTRICTis already the default and it's already got your back.
π EXAMPLES π
to remove the domain box:
DROP DOMAIN box;
iconic. bye box. π ate and left no crumbs.
π COMPATIBILITY π
this command conforms to the SQL standard, except for the IF EXISTS option, which is a PostgreSQL extension. so basically standard-coded with one lil PostgreSQL exclusive β¨ iykyk.
π₯ SEE ALSO π₯
CREATE DOMAIN(CREATE_DOMAIN(7)) β the birthALTER DOMAIN(ALTER_DOMAIN(7)) β the makeover
and that's the page, bestie π«Ά go forth and drop responsibly.
this masterpiece brought to you by PostgreSQL 15.19, dated 2026, page DROP DOMAIN(7) β stay hydrated, back up your schemas, and don't CASCADE on a Friday πππ¦
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms