DROP_EXTENSION(7)
๐ DROP EXTENSION โ the "okay bestie, we're deleting an extension" page
hey so this is DROP EXTENSION(7) from the PostgreSQL 18.6 Documentation, and it's literally just the manual page for yeeting an extension out of your database. no cap. let's get into it ๐ซถ
โจ NAME โจ
DROP_EXTENSION โ remove an extension ๐๏ธโจ
๐ SYNOPSIS ๐
DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
look at her. so clean. so simple. main character syntax fr fr ๐
๐ฆ DESCRIPTION ๐ฆ
okay so DROP EXTENSION removes extensions from the database. that's the whole vibe. but here's the thing bestie โ dropping an extension does not just quietly remove the extension itself. it also takes out:
- its member objects, and
- other explicitly dependent routines โ like, see
ALTER ROUTINE(ALTER_ROUTINE(7)), theDEPENDS ON EXTENSIONextension_name action.
so yeah, that stuff gets dropped too. it's giving "we're all going down together" ๐ญ๐
โ ๏ธ real talk: you must own the extension to use DROP EXTENSION. no ownership, no dropping. that's the rule, periodt.
๐ PARAMETERS ๐
IF EXISTSโ do not throw an error if the extension does not exist. instead, a notice is issued in this case. basically "no worries bestie, we'll just say something quietly instead of screaming" ๐- name โ the name of an installed extension. just the name. that's it. that's the whole thing ๐ธ
CASCADEโ automatically drop objects that depend on the extension, and in turn all objects that depend on those objects (see Section 5.15). it's the domino effect. one falls, they all fall ๐ฅRESTRICTโ this option prevents the specified extensions from being dropped if other objects, besides these extensions, their members, and their explicitly dependent routines, depend on them. this is the default. so if you don't say anything, you're getting RESTRICT. she's the chill responsible one ๐
๐ EXAMPLES ๐
to remove the extension hstore from the current database:
DROP EXTENSION hstore;
so. 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. annoying but valid.
if you want to forcibly remove those dependent objects as well, add the CASCADE option. that's your "I said what I said" button ๐ฅ
๐ COMPATIBILITY ๐
DROP EXTENSION is a PostgreSQL extension. it's ours, we made it, it's iconic ๐
โญ SEE ALSO โญ
CREATE EXTENSION(CREATE_EXTENSION(7))ALTER EXTENSION(ALTER_EXTENSION(7))
iykyk, go read those next bestie ๐
and that's the page!! brought to you by PostgreSQL 18.6, dated 2026 โ mwah, slay, go drop something responsibly ๐ โจ๐ฆ
๐ฆ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 ยท PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 ยท PostgreSQL
- arch rolling: postgresql 18.6-4 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-client-18 18.6-0ubuntu0.26.04.1 ยท PostgreSQL
- ubuntu stonking: postgresql-client-18 18.6-3build2 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms