DROP_EXTENSION(7pg17)

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

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


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