DROP_EXTENSION(7pg17)
π DROP EXTENSION
okay so bestie, real talk: this page is DROP EXTENSION from the PostgreSQL 17.11 docs, and it lives in manual section 7pg17. it's the "yeet that extension into the sun" command and honestly? iconic. let's get into it π«Ά
β¨ NAME β¨
DROP EXTENSION β remove an extension π
π SYNOPSIS π
DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
πΈ DESCRIPTION πΈ
so DROP EXTENSION removes extensions from the database. fr fr, that's the whole vibe. and the way that dropping an extension also nukes its member objects, plus other explicitly dependent routines β like, see ALTER ROUTINE (ALTER_ROUTINE(7)), and the DEPENDS ON EXTENSION extension_name action β yeah those get dropped too. they go down together. no cap. π
β¨ important lil rule: you must own the extension to use DROP EXTENSION. not your extension, not your business π
π PARAMETERS π
IF EXISTSβ do not throw an error if the extension doesn't exist. instead a notice gets issued in that case. very "no thoughts, head empty, moving on" of it π¦nameβ the name of an installed extension. literally just the name, bestie, that's it.CASCADEβ automatically drop objects that depend on the extension, and in turn all the objects that depend on those objects (see Section 5.15). it's giving chain reaction. it's giving domino effect. π₯RESTRICTβ this option prevents the specified extensions from being dropped if other objects depend on them β beyond these extensions themselves, their members, and their explicitly dependent routines. and yes, this is the default. cautious queen behavior π
π EXAMPLES π
to remove the extension hstore from the current database:
DROP EXTENSION hstore;
okay so heads up: this command will fail if any of hstore's objects are in use in the database β for example, if any tables have columns of the hstore type. π¬ if that happens and you're feeling brave, add the CASCADE option to forcibly remove those dependent objects as well. just know what you're doing, iykyk.
β COMPATIBILITY β
DROP EXTENSION is a PostgreSQL extension. periodt. π
π¦ SEE ALSO π¦
CREATE EXTENSION(CREATE_EXTENSION(7))ALTER EXTENSION(ALTER_EXTENSION(7))
and that's the whole page, bestie β go forth and drop responsibly π§π
PostgreSQL 17.11 Β· 2026 Β· DROP EXTENSION(7) β mwah, that's the version, the date, and the page name all wrapped up with a lil bow π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-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