DROP_EXTENSION(7pg13)

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

okay so bestie, welcome to the DROP EXTENSION(7) page β€” aka DROP_EXTENSION β€” from the PostgreSQL 13.23 Documentation. it's literally the manual for removing an extension, and we're gonna get into it πŸ’…βœ¨

✨ NAME ✨

DROP_EXTENSION β€” remove an extension πŸŽ€

🌸 SYNOPSIS 🌸

DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

πŸ’– DESCRIPTION πŸ’–

DROP EXTENSION removes extensions from the database. dropping an extension causes its member objects, and other explicitly dependent routines (see ALTER ROUTINE (ALTER_ROUTINE(7)), the depends on extension action), to be dropped as well. yes, it's giving "cleanup era" 😭

You must own the extension to use DROP EXTENSION. no ownership, no dropping, periodt.

πŸŽ€ PARAMETERS πŸŽ€

  • IF EXISTS β€” do not throw an error if the extension does not exist. a notice is issued in this case. lowkey polite of it, ngl.
  • name β€” the name of an installed extension. that's the target, bestie 🎯
  • CASCADE β€” automatically drop objects that depend on the extension, and in turn all objects that depend on those objects (see Section 5.14). it's giving chain reaction, but make it SQL πŸ’€
  • 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 yeah, it's cautious by default 🫢

🌈 EXAMPLES 🌈

to remove the extension hstore from the current database:

DROP EXTENSION hstore;

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. add the CASCADE option to forcibly remove those dependent objects as well. so if you're getting errors, that's the vibe check telling you something still depends on it 😭πŸ”₯

πŸ¦‹ COMPATIBILITY πŸ¦‹

DROP EXTENSION is a PostgreSQL extension. no cap, that's the whole compatibility note πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘


πŸ’– final cute sign-off: source/version is PostgreSQL 13.23, the date is 2025, and the manual name is DROP EXTENSION(7). bye bestie, go drop your extensions responsibly 🫢✨

πŸ“¦ where this page comes from