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)), the DEPENDS ON EXTENSION extension_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 โญ

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 ๐Ÿ’…โœจ๐Ÿฆ‹