DROP_EXTENSION(7pg14)

πŸ“¦ version 14.24, in opensuse-leap 16.0

πŸ’… 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 🧚

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