DROP_EXTENSION(7pg14)
π DROP EXTENSION π
okay so real talk, this is the DROP EXTENSION page from the PostgreSQL 14.24 Documentation, and I'm gonna walk you through it like we're texting at 2am π«Ά
β¨ SYNOPSIS β¨
DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
like, that's the whole vibe check right there π
πΈ DESCRIPTION πΈ
So DROP EXTENSION removes extensions from the database. and bestie, when you drop an extension it's not just the extension itself that goes β its member objects get yoinked too, and so do other explicitly dependent routines (peep ALTER ROUTINE (ALTER_ROUTINE(7)), and the DEPENDS ON EXTENSION extension_name action) π they all get dropped along with it. it's giving "you go, she goes" energy fr fr.
You must own the extension to use DROP EXTENSION. no ownership, no dropping, that's the rule π
π¦ PARAMETERS π¦
IF EXISTSβ do not throw an error if the extension doesn't exist, mwah π a notice is issued in this case instead. like it's fine, it's fine, calm down.nameβ the name of an installed extension. yep, that's it, that's the whole thing πCASCADEβ automatically drop objects that depend on the extension, and then in turn all objects that depend on those objects (see Section 5.14). it's giving chain reaction β¨ iconic, honestly.RESTRICTβ this one stops the specified extensions from being dropped if other objects depend on them β besides these extensions themselves, their members, and their explicitly dependent routines, obvi. also this is the default π
π EXAMPLES π
wanna remove the extension hstore from the current database? say less:
DROP EXTENSION hstore;
but ngl this command will fail if any of hstore's objects are in use in the database β like, for example, if any tables have columns of the hstore type ππ in that case just add the CASCADE option to forcibly remove those dependent objects as well. periodt.
π COMPATIBILITY π
DROP EXTENSION is a PostgreSQL extension β like it literally is one, iykyk.
π§ SEE ALSO π§
CREATE EXTENSION(CREATE_EXTENSION(7)))ALTER EXTENSION(ALTER_EXTENSION(7)))
go read those too bestie, they're lowkey obsessed with each other π«Άπ₯
aaaand that's the page!! brought to you by PostgreSQL 14.24, dated 2026 β slay, drink water, don't drop extensions you don't own πππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-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