DROP_DOMAIN(7pg18)
๐ DROP DOMAIN ๐
okay bestie, so you know what a domain is? it's like a custom type with โจrulesโจ and we're about to say bye to one. this page is from the PostgreSQL 18.6 Documentation, section 7 (that's the SQL commands girlies), and it's called DROP DOMAIN. yes it's literally the manual page for dropping a domain. iconic. let's go ๐
๐ธ NAME ๐ธ
DROP_DOMAIN โ bestie we are removing a domain. that's it. that's the whole job. ๐
โจ SYNOPSIS โจ
DROP DOMAIN [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
look at her. so clean. so simple. one line and a whole domain is gone. ๐ญ
๐ฆ DESCRIPTION ๐ฆ
DROP DOMAIN removes a domain. periodt. ๐
but listen โ and this is the important part, don't skip it โ only the owner of a domain can remove it. so if it's not yours, hands off, no cap. ๐
๐ PARAMETERS ๐
okay so the options, one by one, no skipping, we're thorough in this house:
IF EXISTSโ don't throw an error if the domain doesn't even exist, like, be chill about it. in that case a notice gets issued instead. very "no drama" of you. ๐ซถnameโ the name of an existing domain, optionally schema-qualified. yep. it can be schema-qualified. that's your girl. ๐CASCADEโ automatically drop objects that depend on the domain (think table columns, bestie), and then in turn all the objects that depend on those objects too. it's giving domino effect. it's giving chain reaction. see Section 5.15 for the whole saga. ๐ฅRESTRICTโ refuse to drop the domain if any objects depend on it. she said "no, we're not doing that." and guess what? this is the default, so if you don't say anything, this is what you get. ๐
ok real talk for a sec:CASCADEis the loud one at the party that takes everyone else down with her.RESTRICTis the responsible friend. choose wisely bestie. ๐ญ
๐ EXAMPLES ๐
say you wanna remove the domain box. (the domain is literally named box. cute.) you do:
DROP DOMAIN box;
and she's gone. bye girl ๐
โญ COMPATIBILITY โญ
this command conforms to the SQL standard... except for the IF EXISTS option, which is a PostgreSQL extension. so if you're out here flexing IF EXISTS in another database, that's a you problem, ngl. ๐
๐ฅ SEE ALSO ๐ฅ
the whole family, go read them:
CREATE DOMAIN(CREATE_DOMAIN(7)) โ for making one in the first place ๐ALTER DOMAIN(ALTER_DOMAIN(7)) โ for changing your mind about it ๐ฆ
anyway that's the page!! go forth and drop responsibly, you main character ๐โจ
this has been PostgreSQL 18.6, dated 2026, and the page is DROP DOMAIN(7) โ mwah, slay, bye bestie ๐
๐๐ซถ
๐ฆ where this page comes from
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms