DROP_TYPE(7pg15)
π DROP TYPE π
okay bestie, so this is the DROP TYPE page from the PostgreSQL 15.19 Documentation β it's the one about yeeting a data type out of existence. it's short, it's sweet, and it absolutely has opinions about who's allowed to press the delete button π
β¨ NAME β¨
DROP_TYPE β remove a data type ποΈβ¨
πΈ SYNOPSIS πΈ
DROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
like, that's the whole vibe. you can drop one, you can drop a whole little list of them, and you get to pick how dramatic the fallout is π
π¦ DESCRIPTION π¦
DROP TYPE removes a user-defined data type. that's the whole job, no cap.
and here's the lil gatekeeping bit: only the owner of a type can remove it π so if it's not yours, hands off, respectfully.
π PARAMETERS π
IF EXISTSβ don't throw an error if the type doesn't exist. instead, a notice gets issued, which is basically postgres being like "mmk bestie, it wasn't there but go off" πnameβ the name of the data type you wanna remove. it can be schema-qualified if you're being extra specific (optionally, tho) π―CASCADEβ automatically drop the objects that depend on the type (think table columns, functions, and operators), and then in turn all the objects that depend on those objects. yes it's a whole chain reaction, see Section 5.14 π₯RESTRICTβ refuse to drop the type if literally any object depends on it. this is the default, so postgres is cautious unless you tell it otherwise π this is the safe lil default and honestly? iconic of it.
π EXAMPLES π
to remove the data type box:
DROP TYPE box;
that's it. that's the example. slay π
π§ COMPATIBILITY π§
this command is similar to the corresponding command in the SQL standard, apart from the IF EXISTS option β that one's a PostgreSQL extension πβ¨
but lowkey, heads up: much of the CREATE TYPE command and the data type extension mechanisms in PostgreSQL differ from the SQL standard. so like, don't assume the vibes line up perfectly π«Ά
π SEE ALSO π
ALTER TYPE(ALTER_TYPE(7))CREATE TYPE(CREATE_TYPE(7))
and that's the tea, bestie π this was DROP TYPE(7) from PostgreSQL 15.19, dated 2026 β go forth and delete responsibly, mwah ππ
π¦ 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